Skip to content

Commit

Permalink
chore: sets up python-semantic-release
Browse files Browse the repository at this point in the history
Changes dynamic version to a manually typed version 0.1.0, and tells python-semanitc-release where this version is specified. Removes setuptools_scm. Configures semanitic-release.
  • Loading branch information
mdtanker committed Nov 22, 2023
1 parent 5a8ea9d commit f4269ee
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 29 deletions.
37 changes: 20 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,25 @@ on:
- published

jobs:
# job to determine appropriate version number, update changelog, and create a release commit
# release:
# runs-on: ubuntu-latest
# concurrency: release
# permissions:
# id-token: write
# contents: write

# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - name: Python Semantic Release
# uses: python-semantic-release/python-semantic-release@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}

# job to build and inspect the package
dist:
runs-on: ubuntu-latest
steps:
Expand All @@ -20,6 +39,7 @@ jobs:

- uses: hynek/build-and-inspect-python-package@v1

# job to publish the new version to pypi
publish:
needs: [dist]
environment: pypi
Expand All @@ -35,20 +55,3 @@ jobs:
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1

# release:
# runs-on: ubuntu-latest
# concurrency: release
# permissions:
# id-token: write
# contents: write

# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - name: Python Semantic Release
# uses: python-semantic-release/python-semantic-release@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from __future__ import annotations

import importlib.metadata
import invert4geom

project = "invert4geom"
copyright = "2023, Matt Tankersley"
author = "Matt Tankersley"
version = release = importlib.metadata.version("invert4geom")
version = release = invert4geom.__version__
extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.autodoc",
Expand Down
17 changes: 10 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=64", "setuptools_scm[toml]>=8"]
requires = ["setuptools>=64"]
build-backend = "setuptools.build_meta"

[project]
Expand Down Expand Up @@ -27,7 +27,7 @@ classifiers = [
"Typing :: Typed",
]
readme = "README.md"
dynamic = ["version"]
version = "0.1.0"

dependencies = [
"numpy",
Expand Down Expand Up @@ -69,7 +69,7 @@ dev = [
"nox",
"pre-commit",
"pylint",
"python-semantic-release",
"python-semantic-release >=8",
]
docs = [
"sphinx>=4.0",
Expand All @@ -88,9 +88,6 @@ Documentation = "https://invert4geom.readthedocs.io/"
Discussions = "https://github.com/mdtanker/invert4geom/discussions"
Changelog = "https://invert4geom.readthedocs.io/en/latest/changelog.html"

[tool.setuptools_scm]
write_to = "src/invert4geom/_version.py"

[tool.pytest.ini_options]
minversion = "6.0"
addopts = [
Expand Down Expand Up @@ -210,5 +207,11 @@ messages_control.disable = [
]

[tool.semantic_release]
version_variable = "pyproject.toml:version"
version_variables = ["src/invert4geom/__init__.py:__version__"]
version_toml = ["pyproject.toml:project.version"]
major_on_zero = false
# build_command = "pip install poetry && poetry build"
# build_command = """
# python -m pip install build~=0.10.0
# python -m build .
# """
4 changes: 1 addition & 3 deletions src/invert4geom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@

from __future__ import annotations

from ._version import version as __version__

__all__ = ("__version__",)
__version__ = "0.1.0"

0 comments on commit f4269ee

Please sign in to comment.