Skip to content

Commit

Permalink
Merge pull request #67 from ZedThree/automate-version
Browse files Browse the repository at this point in the history
Use setuptools_scm to set version from git tags
  • Loading branch information
bendudson committed Oct 13, 2022
2 parents 1aea35c + a14dd2f commit 9fd3270
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install setuptools wheel twine build
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
python -m build --sdist --wheel
twine upload dist/*
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install flake8
python -m pip install .[tests]
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ build/
dist/

venv
freegs/_version.py
2 changes: 1 addition & 1 deletion freegs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"""

__version__ = "0.7.0"
from ._version import __version__

from .equilibrium import Equilibrium

Expand Down
13 changes: 11 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[build-system]
requires = ["setuptools >= 61.0.0"]
requires = [
"setuptools >= 61.0.0",
"setuptools_scm[toml] >= 6.2",
]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -18,7 +21,6 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Scientific/Engineering :: Physics"
]
version = "0.7.0"
license = {text = "GNU Lesser General Public License v3 or later (LGPLv3+)"}
authors = [{name = "Ben Dudson", email = "benjamin.dudson@york.ac.uk"}]
urls = {project = "https://github.com/freegs-plasma/freegs"}
Expand All @@ -29,6 +31,7 @@ dependencies = [
"h5py>=2.10.0",
"Shapely>=1.7.1",
]
dynamic = ["version"]

[project.optional-dependencies]
tests = [
Expand All @@ -37,3 +40,9 @@ tests = [
docs = [
"sphinx>=3.4,<5",
]

[tool.setuptools.dynamic]
version = { attr = "setuptools_scm.get_version" }

[tool.setuptools_scm]
write_to = "freegs/_version.py"

0 comments on commit 9fd3270

Please sign in to comment.