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

Update versioneer #36

Merged
merged 4 commits into from
Mar 15, 2024
Merged

Update versioneer #36

merged 4 commits into from
Mar 15, 2024

Conversation

standage
Copy link
Member

PyTaxonKit uses versioneer to read version numbers from the git repo at deploy time. Typically, for Python packages, I configure versioneer to drop a mypackage/_version.py file in the package itself. When I originally configured versioneer for PyTaxonKit, I followed a similar strategy without thinking too much about it.

But PyTaxonKit is not a package, it's a single module. So when it is installed into the environment, the _version.py file is placed alongside it outside of any package. This is what experts in the field call Not Great.

I updated the PyTaxonKit config so that it would create a pytaxonkit_version.py file rather than just _version.py. While I was at it, I also upgraded the vendored versioneer bundled in the repo, which appears to work fine with Python 3.12.

Copy link
Member Author

@standage standage left a comment

Choose a reason for hiding this comment

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

Hi @danejo3 @RyanBerger98 @agshumate @rnmitchell, we've had to pin some of our workflows to Python < 3.12 recently. In many cases, this was due to older versions of versioneer. Following this process may help with 3.12 compatibility.

Comment on lines -4 to +5
versionfile_source = _version.py
versionfile_build = _version.py
versionfile_source = pytaxonkit_version.py
versionfile_build = pytaxonkit_version.py
Copy link
Member Author

Choose a reason for hiding this comment

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

I made this change, made sure I had the latest version of versioneer installed in my environment, then ran versioneer install in the repo root directory. This updated versioneer.py. I still had to make a few manual changes—delete _version.py, update the import statement in pytaxonkit.py, remove _version.py from .gitattributes, etc.

Comment on lines +26 to +29
- os: ubuntu-latest
python-version: "3.11"
- os: ubuntu-latest
python-version: "3.12"
Copy link
Member Author

Choose a reason for hiding this comment

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

Yay for Python 3.12 compatibility.

Copy link
Member Author

Choose a reason for hiding this comment

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

Now the purpose and contents of this file will be clear from its filename when it's in the Python environment.

@standage standage requested a review from RyanBerger98 March 14, 2024 15:00
Copy link
Collaborator

@RyanBerger98 RyanBerger98 left a comment

Choose a reason for hiding this comment

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

LGTM!

@RyanBerger98 RyanBerger98 merged commit 18bd6f6 into master Mar 15, 2024
5 checks passed
@standage standage deleted the update/versioneer branch August 6, 2024 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants