matus-chochlik / ctcache

Cache for clang-tidy static analysis results
Boost Software License 1.0
84 stars 30 forks source link

Turn ctcache into a Python package #65

Closed PatrickKa closed 4 months ago

PatrickKa commented 4 months ago

Right now, ctcache is installed by copying Python scripts manually. The execution of the scripts also relies on the shebangs, which AFAIK are not supported, i.e., do nothing on Windows. This is inconvenient for me, so I suggest turning this project into a proper Python package that can be installed with pip. Publishing the package on PyPI is not necessary. I am happy with installing it from source or version control systems in this case Git:

# Installation from source
cd path/to/ctcache
python -m pip install .
# Developers can install in editable mode
python -m pip install --editable .
# Installation from Git repo
python -m pip install git+https://github.com/matus-chochlik/ctcache.git
# You can also install a specific ref like a branch or tag
python -m pip install git+https://github.com/matus-chochlik/ctcache.git@main
python -m pip install git+https://github.com/matus-chochlik/ctcache.git@v1.2.3

I tried to change as little as possible to make this work.

Regarding the last point, I am not well versed in bash scripts or Dockerfiles. Please check if the installation scripts still work and the Dockerfile is correct.

Please, also take a look at the metadata provided in pyproject.toml. See Writing your pyproject.toml from the Python packaging user guide for more information. So far I only made clang-tidy-cache installable, and added its required dependencies. I think installing the server script should be an optional "extra". The same goes for the support of Google Cloud Storage, S3, etc.

matus-chochlik commented 4 months ago

LGTM after a quick review, we'll see if it breaks anything.

PatrickKa commented 4 months ago

That's the spirit 😄. I just realized that I didn't look through the README, though. I guess it will need some changes. It should at least mention that clang-tidy-cache can be installed with pip as well now.

matus-chochlik commented 4 months ago

it's not ideal, I have a long TODO list with things like testing of ctcache and cpack packaging of ctcache somewhere on it :P I'll have a look at the readme (and the other documentation as well)