Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eventually deprecate setup.cfg, setup.py and move to pyproject.toml #70

Closed
cdboer opened this issue Aug 28, 2022 · 3 comments
Closed

Eventually deprecate setup.cfg, setup.py and move to pyproject.toml #70

cdboer opened this issue Aug 28, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request feature Implement this feature

Comments

@cdboer
Copy link
Collaborator

cdboer commented Aug 28, 2022

Is your feature request related to a problem? Please describe.
I'm always frustrated when preparing a new release, as i have to edit the project metadata in three different files.
For example, for minor version bumps or patches i have to edit:

  • the gitlab2prov.__version__ module attribute contained in gitlab2prov/__init__.py
  • the version number contained in the CITATION.cff
  • the version number contained in the setup.cfg

Considering the DRY principle, this seems far from ideal.

I would like to reduce the number of files that hold the same information. Ideally i'd only want to edit a single file when preparing a release. Considering the tooling behind CITATION.cff doesn't allow to source metadata dynamically, a single file won't be achievable, though we can reduce the amount of files with duplicate information.

Describe the solution you'd like
In PEP 621 the python community chose to store project metadata in the pyproject.toml file. Our current build backend setuptools supports PEP 621 and is able to source the build metadata from it.

Proposal

  • abandon/remove setup.py and setup.cfg
  • store all project metadata in pyproject.toml, CITATION.cff
  • let gitlab2prov.__version__ be the single ground truth for the package version number (Not achievable yet, CITATION.cff has to be edited aswell)

pyproject.toml supports dynamic metadata such as reading the version number from a module attribute, which allows us to read the package version from gitlab2prov.__version__. gitlab2prov.__version__ has to hold the version number, since the cli option --version has to correctly display the current version number and we can't read the version number from metadata files outside of the package scope.

This would leave us with two files that we have to edit for each release:

  • CITATION.cff, since it does not allow us to source metadata dynamically
  • gitlab2prov/__init__.py, to edit the module attribute gitlab2prov.__version__

One file less than before and hopefully the future allows us to reduce the amount of duplicated metadata even further, see citation-file-format/citation-file-format#374 (comment).

Additional context

@cdboer cdboer added enhancement New feature or request feature Implement this feature labels Aug 28, 2022
@cdboer cdboer self-assigned this Aug 28, 2022
@cdboer
Copy link
Collaborator Author

cdboer commented Aug 28, 2022

We will have to change the current publishing workflow to reflect the removal of setup.py. See here for a publishing workflow using only pip.

@cdboer
Copy link
Collaborator Author

cdboer commented Aug 28, 2022

We also have to require setuptools 61.0.0 or higher. As it is the first version with PEP 621 support.

@cdboer cdboer changed the title Move project metadata to pyproject.toml Eventually deprecate setup.cfg and move to pyproject.toml Aug 29, 2022
@cdboer
Copy link
Collaborator Author

cdboer commented Sep 1, 2022

Instead of installing requirements/dev-requirements using

pip install -r requirements.txt
pip install -r requirementst-dev.txt

users could install requirments using

pip install .
pip install .[dev]

@cdboer cdboer changed the title Eventually deprecate setup.cfg and move to pyproject.toml Eventually deprecate setup.cfg, setup.py and move to pyproject.toml Sep 3, 2022
cdboer added a commit that referenced this issue Sep 7, 2022
cdboer added a commit that referenced this issue Sep 7, 2022
@cdboer cdboer closed this as completed Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature Implement this feature
Projects
None yet
Development

No branches or pull requests

1 participant