Skip to content

Commit 1a0fdd4

Browse files
BLD: Revert to pyproject being the version source of truth
1 parent 1b96b40 commit 1a0fdd4

5 files changed

Lines changed: 76 additions & 50 deletions

File tree

.github/workflows/docs.yml

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,46 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: mamba-org/setup-micromamba@v2
16-
with:
17-
init-shell: bash
18-
cache-downloads: true
19-
20-
- name: Checkout mapflpy
21-
uses: actions/checkout@v4
22-
23-
- name: Setup Python
24-
uses: actions/setup-python@v5
25-
with:
26-
python-version: 3.13
27-
28-
- name: Install build dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install nox[pbs]
32-
33-
- name: Set nox conda backend
34-
run: echo "CONDA_EXE=micromamba" >> "$GITHUB_ENV"
35-
36-
- name: Build wheels
37-
run: |
38-
nox -s build
39-
40-
- name: Repair wheels
41-
run: |
42-
nox -s repair
43-
44-
- name: Build docs
45-
run: |
46-
nox -s docs
47-
48-
- name: Upload docs artifact
49-
if: always()
50-
uses: actions/upload-artifact@v4
51-
with:
52-
name: docs
53-
path: .nox/_artifacts/docs/html*/
54-
retention-days: 7
15+
# - uses: mamba-org/setup-micromamba@v2
16+
# with:
17+
# init-shell: bash
18+
# cache-downloads: true
19+
#
20+
# - name: Checkout mapflpy
21+
# uses: actions/checkout@v4
22+
#
23+
# - name: Setup Python
24+
# uses: actions/setup-python@v5
25+
# with:
26+
# python-version: 3.13
27+
#
28+
# - name: Install build dependencies
29+
# run: |
30+
# python -m pip install --upgrade pip
31+
# pip install nox[pbs]
32+
#
33+
# - name: Set nox conda backend
34+
# run: echo "CONDA_EXE=micromamba" >> "$GITHUB_ENV"
35+
#
36+
# - name: Build wheels
37+
# run: |
38+
# nox -s build
39+
#
40+
# - name: Repair wheels
41+
# run: |
42+
# nox -s repair
43+
#
44+
# - name: Build docs
45+
# run: |
46+
# nox -s docs
47+
#
48+
# - name: Upload docs artifact
49+
# if: always()
50+
# uses: actions/upload-artifact@v4
51+
# with:
52+
# name: docs
53+
# path: .nox/_artifacts/docs/html*/
54+
# retention-days: 7
5555

5656
- name: Prepare SSH
5757
env:

.github/workflows/publish.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ jobs:
5555
matrix:
5656
os:
5757
- ubuntu-24.04
58-
# - ubuntu-22.04-arm
59-
# - macos-15-intel
60-
# - macos-15
58+
- ubuntu-22.04-arm
59+
- macos-15-intel
60+
- macos-15
6161
steps:
6262
- uses: mamba-org/setup-micromamba@v2
6363
with:
@@ -117,9 +117,9 @@ jobs:
117117
matrix:
118118
os:
119119
- ubuntu-24.04
120-
# - ubuntu-22.04-arm
121-
# - macos-15-intel
122-
# - macos-15
120+
- ubuntu-22.04-arm
121+
- macos-15-intel
122+
- macos-15
123123
steps:
124124
- uses: mamba-org/setup-micromamba@v2
125125
with:

meson.build

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11

22
project(
33
'mapflpy',
4-
['c', 'fortran'],
5-
version : '1.1.2.pre2',
4+
'c', 'cpp', 'fortran',
5+
version: run_command(['tools/pyproject_version.py'], check: true).stdout().strip(),
66
license : 'Apache-2.0',
77
meson_version : '>=1.1.0',
8-
default_options : ['warning_level=1', 'buildtype=release'],
8+
default_options : [
9+
'warning_level=1',
10+
'buildtype=release'
11+
],
912
)
1013

1114
# ---- Compilers / platform niceties

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ requires = [
1616
# ----------------
1717
[project]
1818
name = "mapflpy"
19-
dynamic = ["version"]
19+
version = "1.1.2"
2020
description = "Python extension for tracing field lines using the Fortran tracer from MapFL"
2121
authors = [
2222
{name = "Predictive Science Inc.", email = "webmaster@predsci.com"},

tools/pyproject_version.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python3
2+
import os
3+
import textwrap
4+
from pathlib import Path
5+
6+
7+
def init_version():
8+
# Load TOML (tomllib on 3.11+, fallback to tomli)
9+
try:
10+
import tomllib # Python 3.11+
11+
except ModuleNotFoundError: # pragma: no cover
12+
import tomli as tomllib # pip install tomli
13+
14+
pyproject = Path(__file__).parents[1].resolve() / 'pyproject.toml'
15+
with open(pyproject, 'rb') as f:
16+
data = tomllib.load(f)
17+
18+
version = data.get("project", {}).get("version", '0.0.0')
19+
return version.replace('"', '').replace("'", '')
20+
21+
if __name__ == "__main__":
22+
version = init_version()
23+
print(version)

0 commit comments

Comments
 (0)