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

Add a dynamic version attribute for the setuptools build-backend #188

Merged

Conversation

agriyakhetarpal
Copy link
Contributor

Pull Request description

The template for the setuptools build-backend had an issue where the project version was declared as a dynamic attribute but the associated pyproject.toml file did not contain a [tool.setuptools.dynamic] TOML table. This caused the version to be returned as 0.0.0, instead of the correct version being read from the specified file.

Closes #187

How to test these changes

  • Create a new package and choose setuptools, and the following code snippet
from importlib.metadata import version
print(version("mypackage"))

should return the default string (0.1.0) instead of the current (incorrect) 0.0.0.

Pull Request checklists

This PR is a:

  • bug-fix
  • new feature
  • maintenance

About this PR:

  • it includes tests.
  • the tests are executed on CI.
  • the tests generate log file(s) (path).
  • pre-commit hooks were executed locally.
  • this PR requires a project documentation update.

Author's checklist:

  • I have reviewed the changes and it contains no misspelling.
  • The code is well commented, especially in the parts that contain more complexity.
  • New and old tests passed locally.

Additional information

N/A

Reviewer's checklist

Copy and paste this template for your review's note:

## Reviewer's Checklist

- [ ] I managed to reproduce the problem locally from the `main` branch
- [ ] I managed to test the new changes locally
- [ ] I confirm that the issues mentioned were fixed/resolved

Since the version has been defined as dynamic, it requires a dynamic attribute whose value can be read at the time of acquiring metadata or editable metadata.
Copy link
Member

@Saransh-cpp Saransh-cpp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for working on this, @agriyakhetarpal! 🙂

  • I managed to reproduce the problem locally from the main branch
  • I managed to test the new changes locally
  • I confirm that the issues mentioned were fixed/resolved

@Saransh-cpp Saransh-cpp requested a review from xmnlab November 13, 2023 19:01
@xmnlab
Copy link
Member

xmnlab commented Nov 13, 2023

thanks for working on that @agriyakhetarpal !
and thanks for the review @Saransh-cpp !

@xmnlab xmnlab merged commit 21fa953 into osl-incubator:main Nov 13, 2023
11 checks passed
@agriyakhetarpal agriyakhetarpal deleted the fix-setuptools-dynamic-versioning branch November 13, 2023 21:34
Copy link

github-actions bot commented Dec 8, 2023

🎉 This PR is included in version 0.6.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

YurelyCamacho pushed a commit to YurelyCamacho/cookiecutter-python that referenced this pull request Dec 27, 2024
…nd (osl-incubator#188)

The template for the setuptools build-backend had an issue where the project version was declared as a dynamic attribute but the associated pyproject.toml file did not contain a [tool.setuptools.dynamic] TOML table. This caused the version to be returned as 0.0.0, instead of the correct version being read from the specified file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Versioning bug in setuptools backend
3 participants