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

Derive project version from a single source. #122

Closed
capn-freako opened this issue Apr 5, 2023 · 0 comments · Fixed by #124
Closed

Derive project version from a single source. #122

capn-freako opened this issue Apr 5, 2023 · 0 comments · Fixed by #124
Assignees

Comments

@capn-freako
Copy link
Owner

Problem Description & Change Request

Currently, we have to record a version change in 3 files:

  • pyproject.toml,
  • conda.recipe/<project>/meta.yaml, and
  • __init__.py.

This is fragile and often results in inconsistent version reporting.

==> Implement some form of single source versioning.

Helpful Resources

The following may contain various bits of information helpful in this pursuit:

Importing information from pyproject.toml into conda-build flow

Code in the meta.yaml similar to the following may be used to import information (such as the project version number) from the pyproject.toml file into the conda-build flow:

{% set pyproject = load_file_data('pyproject.toml') %}
{% set poetry = pyproject.get('tool', {}).get('poetry') %}
package:
  name: {{ poetry.get('name') }}
  version: {{ poetry.get('version') }}

See this page for more detail.

Importing package version from pyproject.toml into __init__.py

This SO answer suggests a way to import the version number from pyproject.toml into __init__.py.
When combined with the above technique, this should allow the pyproject.toml file to become the sole source for package version number information.

@capn-freako capn-freako self-assigned this Apr 5, 2023
capn-freako added a commit that referenced this issue Apr 6, 2023
The `pyproject.toml` file is now the sole definer of the project version number.

Fixes #122
@capn-freako capn-freako linked a pull request Apr 6, 2023 that will close this issue
capn-freako added a commit that referenced this issue Apr 6, 2023
* Implemented single source revisioning.

The `pyproject.toml` file is now the sole definer of the project version number.

Fixes #122

* Implemented single source versioning for PyAMI.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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 a pull request may close this issue.

1 participant