Skip to content

Commit

Permalink
add package dynamic versioning capabilities (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
d33bs authored May 15, 2024
1 parent 2c6b64c commit 9e1a136
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ repos:
- id: check-yaml
- id: check-added-large-files
- id: detect-private-key
- repo: https://github.com/python-poetry/poetry
rev: "1.5.1"
hooks:
- id: poetry-check
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
Expand Down
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,14 @@ Pull request review and approval is required by at least one project maintainer
We will do our best to review the code addition in a timely fashion.
Ensuring that you follow all steps above will increase our speed and ability to review.
We will check for accuracy, style, code coverage, and scope.

## Versioning

We use [`poetry-dynamic-versioning`](https://github.com/mtkennerly/poetry-dynamic-versioning) to help version this software through [`PEP 440`](https://peps.python.org/pep-0440/) standards.
Configuration for versioning is found within the `pyproject.toml` file.
All builds for packages include dynamic version data to help label distinct versions of the software.
`poetry-dynamic-versioning` uses `git` tags to help distinguish version data.
We also use the `__init__.py` file as a place to persist the version data for occaissions where the `git` history is unavailable or unwanted.

The following command is used to add `poetry-dynamic-versioning` to Poetry for use with this project: `poetry self add "poetry-dynamic-versioning[plugin]"`.
Versioning for the project is intended to align with GitHub Releases which provide `git` tag capabilities.
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 17 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,24 @@ select = [
# Ignore `E402` and `F401` (unused imports) in all `__init__.py` files
"__init__.py" = ["E402", "F401"]

# set dynamic versioning capabilities for project
[tool.poetry-dynamic-versioning]
enable = true
style = "pep440"
vcs = "git"

# specify where version replacement is performed
[tool.poetry-dynamic-versioning.substitution]
files = ["src/sculptqc/__init__.py"]

# set persistent versions within the __init__.py file in cases
# where we may not have or want access to full git history
[tool.poetry-dynamic-versioning.files."src/sculptqc/__init__.py"]
persistent-substitution = true

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.setuptools_scm]
root = "."
4 changes: 4 additions & 0 deletions src/sculptqc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
"""

from .analyze import find_outliers

# note: version placeholder is updated during build
# by poetry-dynamic-versioning.
__version__ = "0.0.1"

0 comments on commit 9e1a136

Please sign in to comment.