Skip to content

Commit

Permalink
Add automatic versioning to the library (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomicapretto authored Jan 24, 2024
1 parent f6199f1 commit 23e5603
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: "3.7"
python-version: "3.9"

- name: Install Dependencies
run: |
Expand Down
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.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9"]
python-version: ["3.9", "3.10", "3.11"]

name: Set up Python ${{ matrix.python-version }}
steps:
Expand Down
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.

9 changes: 4 additions & 5 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 All @@ -25,7 +27,7 @@ dev = [
"jupyter-sphinx",
"nbsphinx",
"pydata-sphinx-theme>=0.6.3",
"pylint==2.10.2",
"pylint==2.17.5",
"pytest-cov>=2.6.1",
"pytest==6.2.5",
"Sphinx>=1.8.3"
Expand All @@ -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 23e5603

Please sign in to comment.