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

Move package/subpackage version inside package source #142

Merged
merged 2 commits into from
Oct 29, 2021

Conversation

aaraney
Copy link
Member

@aaraney aaraney commented Oct 26, 2021

This PR moves package versions' from setup.cfg to src/<subpackage>/_version.py in an attribute named __version__. An attr: directive is used in setup.cfg to access this versioning information for packaging metadata purposes.

Ive tested installing subpackages locally in editable and non-editable modes. Likewise, Ive also tested that both wheels and tar gz archives of a subpackage created using python -m build also install properly without issue. That is not to say there is not a way to break it though.

Note: it is required that the __version__ attribute be imported in a subpackage's top level __init__.py. See setuptools #1753 for more detail. I don't think this is a deal breaker (meaning adding complexity to the packaging process) and overly boiler plate, given that in the future I would like to introduce a public api for each subpackage that discriminates the current subpackage version to the user.

Changes

  • Subpackage version's are now held in an attribute __version__ in a _version.py file. (this file sits even with the top level __init__.py).

Todos

Checklist

  • PR has an informative and human-readable title
  • PR is well outlined and documented. See #12 for an example
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (see CONTRIBUTING.md)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output) using numpy docstring formatting
  • Placeholder code is flagged / future todos are captured in comments
  • Reviewers requested with the Reviewers tool ➡️

…hin each subpackage. In future a public api will be exposed allowing users to more easily check the version they are using whilst using it
…ng. see setuptools #1724 for more information
Copy link
Collaborator

@jarq6c jarq6c 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. I checked all the versions locally.

src/hydrotools/__init__.py Show resolved Hide resolved
@jarq6c jarq6c merged commit 5a55567 into NOAA-OWP:main Oct 29, 2021
aaraney added a commit to aaraney/hydrotools that referenced this pull request Oct 29, 2021
@aaraney aaraney deleted the move_versioning_inside_package branch May 19, 2023 01:24
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