jimbraun / XCDF

XCDF: eXplicitly Compacted Data Format. See documentation at Read the Docs:
https://xcdf.readthedocs.io/en/latest/
Other
14 stars 8 forks source link

Add workflow for deployment to PyPI #106

Open HealthyPear opened 11 months ago

HealthyPear commented 11 months ago

This PR implements a new GitHub workflow based on the current best practice recommended by the Python Packaging Authority.

I already created a “pending” trusted publisher on PyPI with my account for this project and the workflow is set to run only when a release is published (whatever the tag name).

@maxnoe could you give a second look at this? My biggest doubt is about how to treat the git-metadata version which is now read by the CMake configuration, but still hardcoded in setup.cfg to "4.0.0" (which is still unreleased); from the setuptools guide I don't see dynamic version available but from the pyproject.toml implementation - should this part be done like in e.g. ctapipe with the version.py file?

I'll keep it as a draft PR until we have sorted out if it's correct.

maxnoe commented 11 months ago

There are two things you can do I think: use setuptools_scm to get the version from the git tags for the python bindings independently of cmake.

Or import the version from the c++ library in the python module and use a "dynamic" version: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata

HealthyPear commented 11 months ago

Thanks @maxnoe .

I'd go for the second approach in order to not duplicate code (even though it's not really a duplication in this case).

I see that you link the pyproject.toml example: do you know if it is possible to define the version metadata entry there and keep the rest of the project metadata into setup.cfg or since it's related to the [project] part it's better to directly upgrade to use only pyproject.toml?

maxnoe commented 11 months ago

You can give the same option in the setup.cfg.