Skip to content

Commit

Permalink
Add automatic versioning to the library
Browse files Browse the repository at this point in the history
  • Loading branch information
tomicapretto committed Jan 24, 2024
1 parent f6199f1 commit 0cb632a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,10 @@ jobs:
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN_FORMULAE }}
run: python3 -m twine upload dist/*
run: python3 -m twine upload dist/*


# See documentation on accesing the tag from the release
# Look for 'github.ref' and 'github.ref_name' in https://docs.github.com/en/actions/learn-github-actions/contexts
# On October, 2023 it says "For workflows triggered by release, this is the release tag created"
# So 'github.ref_name' should be the version number of the release we're making.
7 changes: 6 additions & 1 deletion formulae/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import logging

from importlib.metadata import version

from .config import config
from .matrices import design_matrices
from .model_description import model_description
from .version import __version__

# from .version import __version__

__version__ = version("formulae")

__all__ = [
"config",
Expand Down
12 changes: 0 additions & 12 deletions formulae/version.py

This file was deleted.

1 change: 0 additions & 1 deletion formulae/version.txt

This file was deleted.

7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=61.0"]
requires = ["setuptools>=61.0", "setuptools_scm>=8"]

[tool.setuptools_scm]

[project]
name = "formulae"
Expand Down Expand Up @@ -40,9 +42,6 @@ changelog = "https://github.com/bambinos/formulae/blob/main/docs/CHANGELOG.md"
[tool.setuptools]
packages = ["formulae", "formulae.terms"]

[tool.setuptools.dynamic]
version = {file = "formulae/version.txt"}

[tool.black]
line-length = 100
target-version = ["py39", "py310"]

0 comments on commit 0cb632a

Please sign in to comment.