Skip to content

Commit c399c01

Browse files
Ayush1325marc-hb
authored andcommitted
project: Switch to pyproject
Starting with PEP 621, `pyproject.toml` is the standard way of specifying project metadata. Also switch to using the version from `pyproject.toml` instead of having a west.version python module. Adjust documentation for the same. Update MAINTAINERS.rst to use build for dist building. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
1 parent d4ad256 commit c399c01

File tree

4 files changed

+56
-58
lines changed

4 files changed

+56
-58
lines changed

MAINTAINERS.rst

+7-4
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ Pre-release test plan
6666

6767
7. Assuming that all went well (if it didn't, go fix it and repeat):
6868

69-
- update __version__ to 'X.Y.Z' (i.e. drop the 'aN' suffix that denotes
70-
alpha N)
69+
- update version in pyproject.toml to 'X.Y.Z' (i.e. drop the 'aN' suffix
70+
that denotes alpha N)
7171

7272
- tag the release on GitHub (see "Tagging the release" for a procedure)
7373

@@ -88,12 +88,15 @@ Building and uploading the release wheels
8888
You need the zephyr-project PyPI credentials for the 'twine upload' command. ::
8989

9090
git clean -ffdx
91-
python3 setup.py sdist bdist_wheel
91+
pip3 install --upgrade build twine
92+
pyproject-build
9293
twine upload -u zephyr-project dist/*
9394

9495
The 'git clean' step is important. We've anecdotally observed broken wheels
9596
being generated from dirty repositories.
9697

98+
Check out [packaging.python.org](https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives) for more detailed instructions.
99+
97100
Tagging the release
98101
-------------------
99102

@@ -158,7 +161,7 @@ Summary of what happens:
158161
3. In vX.Y-branch, in src/west/version.py, set __version__ to X.Y.0a1.
159162
Push this to origin/vX.Y-branch. You don't need a PR for this.
160163

161-
4. In the main branch, set __version__ to X.Y.99.
164+
4. In the main branch, set version in pyproject.toml to X.Y.99.
162165
Push this to origin/main. You don't need a PR for this.
163166

164167
5. Create an annotated tag vX.Y.99 which points to the main branch commit you

pyproject.toml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[build-system]
2+
requires = ["setuptools>=61.2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "west"
7+
version = "1.2.99"
8+
authors = [{name = "Zephyr Project", email = "devel@lists.zephyrproject.org"}]
9+
description = "Zephyr RTOS Project meta-tool"
10+
classifiers = [
11+
"Programming Language :: Python :: 3",
12+
"License :: OSI Approved :: Apache Software License",
13+
"Operating System :: POSIX :: Linux",
14+
"Operating System :: MacOS :: MacOS X",
15+
"Operating System :: Microsoft :: Windows",
16+
]
17+
requires-python = ">=3.8"
18+
dependencies = [
19+
"colorama",
20+
"PyYAML>=5.1",
21+
"pykwalify",
22+
"setuptools",
23+
"packaging",
24+
]
25+
26+
[project.license]
27+
file = "LICENSE"
28+
29+
[project.readme]
30+
file = "README.rst"
31+
content-type = "text/x-rst"
32+
33+
[project.urls]
34+
Homepage = "https://github.com/zephyrproject-rtos/west"
35+
36+
[project.scripts]
37+
west = "west.app.main:main"
38+
39+
[tool.setuptools]
40+
package-dir = {"" = "src"}
41+
zip-safe = false
42+
include-package-data = true
43+
44+
[tool.setuptools.packages.find]
45+
where = ["src"]
46+
namespaces = false

setup.py

-53
This file was deleted.

src/west/version.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
# This is the Python 3 version of option 3 in:
66
# https://packaging.python.org/guides/single-sourcing-package-version/#single-sourcing-the-version
77

8-
__version__ = '1.2.99'
8+
import importlib.metadata
9+
10+
__version__ = importlib.metadata.version("west")
911
#
1012
# MAINTAINERS:
1113
#

0 commit comments

Comments
 (0)