Skip to content

Commit 1a2b5a6

Browse files
authored
Merge pull request #7 from MPython-Package-Factory/dev-version
Fixes #6: Version specified in `_version.py`
2 parents 7f6a365 + 5971229 commit 1a2b5a6

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

.github/workflows/publish-to-pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
push:
66
paths:
7-
- pyproject.toml
7+
- mpython/_version.py
88

99
jobs:
1010
create-tag:
@@ -21,7 +21,7 @@ jobs:
2121
- name: Get package version
2222
id: getversion
2323
run: |
24-
VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' pyproject.toml)
24+
VERSION=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' mpython/_version.py)
2525
echo "pyproject.toml version: $VERSION"
2626
git config user.name github-actions
2727
git config user.email [email protected]

mpython/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from .runtime import Runtime
66
from .sparse_array import SparseArray
77
from .struct import Struct
8+
from ._version import __version__
89

910
__all__ = [
1011
"Runtime",
@@ -14,6 +15,7 @@
1415
"Struct",
1516
"Array",
1617
"SparseArray",
18+
"__version__",
1719
]
1820

1921
# ----------------------------------------------------------------------

mpython/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "25.04alpha2.post2"

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "mpython-core"
7-
version = "25.04alpha2.post2"
7+
dynamic = ["version"]
88
description = "Core Python elements for wrapped MPython packages."
99
readme = "README.md"
1010
license = {file = "LICENSE"}
@@ -24,6 +24,9 @@ dependencies = [
2424
"numpy"
2525
]
2626

27+
[tool.setuptools.dynamic]
28+
version = {attr = "mpython._version.__version__"}
29+
2730
[project.urls]
2831
Repository = "https://github.com/MPython-Package-Factory/mpython-core"
2932

0 commit comments

Comments
 (0)