Skip to content

Commit 51d5d13

Browse files
Compute version with setuptools_scm
Co-authored-by: Brandon T. Willard <971601+brandonwillard@users.noreply.github.com>
1 parent 9a5dd45 commit 51d5d13

File tree

6 files changed

+34
-36
lines changed

6 files changed

+34
-36
lines changed

.github/workflows/nightly.yml renamed to .github/workflows/dev-builds.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Development builds
22
on:
3-
workflow_dispatch:
4-
schedule:
5-
- cron: "0 0 * * *"
3+
push:
4+
branches:
5+
- main
66

77
jobs:
88
build_and_publish:
@@ -22,14 +22,16 @@ jobs:
2222
curl -sSLf https://github.com/TomWright/dasel/releases/download/v2.0.2/dasel_linux_amd64 \
2323
-L -o /tmp/dasel && chmod +x /tmp/dasel
2424
25+
# Modify pyproject.toml to set the nightly version in the form of
26+
# x.y.z.postN, where N is the number of commits since the last release
2527
/tmp/dasel put -f pyproject.toml project.name -v aesara-nightly
28+
/tmp/dasel put -f pyproject.toml tool.setuptools_scm.version_scheme -v post-release
29+
/tmp/dasel put -f pyproject.toml tool.setuptools_scm.local_scheme -v no-local-version
2630
2731
# Install build prerequisites
2832
python -m pip install -U pip build
2933
- name: Build the sdist
3034
run: python -m build --sdist .
31-
env:
32-
BUILD_AESARA_NIGHTLY: true
3335
- uses: pypa/gh-action-pypi-publish@release/v1
3436
with:
3537
password: ${{ secrets.nightly_pypi_secret }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ aesara-venv/
5555
testing-report.html
5656
coverage.xml
5757
.coverage.*
58+
aesara/_version.py

MANIFEST.in

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
global-include *.txt
2-
global-include *.c
3-
global-include *.cu
4-
global-include *.cuh
5-
global-include *.cpp
6-
global-include *.h
7-
global-include *.sh
8-
recursive-include doc *
91
include bin/aesara-cache
2+
prune .github
3+
prune html
4+
prune tests
5+
prune dist
6+
exclude .flake8 .gitignore .pre-commit-config.yaml CODE_OF_CONDUCT.md
7+
exclude CONTRIBUTING.md Makefile codecov.yml conftest.py environment.yml
8+
exclude environment-arm.yml readthedocs.yml

aesara/version.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
try:
2+
from aesara._version import __version__ as version
3+
except ImportError:
4+
raise RuntimeError(
5+
"Unable to find the version number that is generated when either building or "
6+
"installing from source. Please make sure that this Aesara has been properly "
7+
"installed, e.g. with\n\n pip install -e .\n"
8+
)
9+
110
deprecated_names = [
211
"FALLBACK_VERSION",
312
"full_version",
@@ -14,9 +23,8 @@ def __getattr__(name):
1423
f"{name} was deprecated when migrating away from versioneer. If you "
1524
f"need it, please search for or open an issue on GitHub entitled "
1625
f"'Restore deprecated versioneer variable {name}'.",
17-
DeprecationWarning,
1826
)
1927
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
2028

2129

22-
version = "TODO"
30+
__all__ = ["version"]

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[build-system]
22
requires = [
33
"setuptools>=61.2",
4+
"setuptools_scm[toml]>=6.2",
45
]
56
build-backend = "setuptools.build_meta"
67

@@ -57,6 +58,7 @@ dependencies = [
5758
"typing_extensions",
5859
"setuptools >=48.0.0",
5960
]
61+
dynamic = ["version"]
6062

6163
[project.readme]
6264
file = "DESCRIPTION.txt"
@@ -65,6 +67,11 @@ content-type = "text/x-rst"
6567
[project.scripts]
6668
aesara-cache = "aesara.bin.aesara_cache:main"
6769

70+
[tool.setuptools_scm]
71+
write_to = "aesara/_version.py"
72+
# Restrict the default regex to only match tags that start with "rel-".
73+
tag_regex = '^rel-(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$'
74+
6875
[tool.setuptools]
6976
platforms = [
7077
"Windows",
@@ -95,6 +102,7 @@ namespaces = false
95102
"*.pkl",
96103
"*.h",
97104
"*.cpp",
105+
"*.pyx",
98106
"ChangeLog",
99107
"c_code/*",
100108
]
@@ -112,6 +120,7 @@ namespaces = false
112120
omit = [
113121
"tests/*",
114122
"aesara/assert_op.py",
123+
"aesara/version.py",
115124
"aesara/bin/aesara_cache.py",
116125
"aesara/graph/opt.py",
117126
"aesara/graph/opt_utils.py",

setup.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)