Skip to content

Commit

Permalink
Use setuptools_scm for automatic versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
gmloose committed Apr 24, 2024
1 parent aedace0 commit f0503da
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Needed for `setuptools-scm`
fetch-depth: 0

- name: Build sdist
run: pipx run build --sdist
Expand All @@ -33,6 +36,9 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
# Needed for `setuptools-scm`
fetch-depth: 0

- name: Build wheels
uses: pypa/[email protected]
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ venv/
wheelhouse/
htmlcov
*.so
.vscode/
casacore/_version.py
6 changes: 3 additions & 3 deletions casacore/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__version__ = "3.5.3"
__mincasacoreversion__ = "3.1.1"

import os
from ._version import __version__

__mincasacoreversion__ = "3.1.1"

# If environment variable `AIPSPATH` is not set, then set it to the directory
# containing the `.aipsrc` file that is distributed with this package.
Expand Down
14 changes: 8 additions & 6 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
# absolute, like shown here.
#sys.path.append(os.path.abspath('.'))

try:
import importlib.metadata as metadata
except ImportError: # for python<3.8
import importlib_metadata as metadata

# General configuration
# ---------------------

Expand All @@ -41,14 +46,11 @@
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#

from casacore import __version__

# The short X.Y version.
version = __version__
# The full version, including alpha/beta/rc tags.
release = __version__
release = metadata.version('python-casacore')
# The short X.Y version.
version = '.'.join(release.split('.')[:2])

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
1 change: 1 addition & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
importlib-metadata; python_version<'3.8'
12 changes: 11 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ build-backend = "scikit_build_core.build"

[project]
name = "python-casacore"
version = "3.5.3"
description = "A wrapper around CASACORE, the radio astronomy library"
dynamic = ["version"]
keywords = ["pyrap", "casacore", "utilities", "astronomy"]
license = {file = "LICENSE"}
readme = {file = "README.rst", content-type = "test/x-rst"}
Expand Down Expand Up @@ -103,8 +103,18 @@ cmake.version = ">=3.15"
ninja.version = ">=1.5"
logging.level = "INFO"
install.components = ["data", "libraries"]
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
sdist.exclude = [".github", ".gitignore"]
sdist.include = ["casacore/_version.py"]
wheel.packages = ["casacore", "pyrap"]

[tool.scikit-build.cmake.define]
BUILD_TESTING = "ON"


###########################
# setuptools_scm settings #
###########################

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

0 comments on commit f0503da

Please sign in to comment.