Skip to content

Commit

Permalink
project: Switch to pyproject
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Ayush1325 authored and marc-hb committed Sep 12, 2024
1 parent d4ad256 commit c399c01
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 58 deletions.
11 changes: 7 additions & 4 deletions MAINTAINERS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ Pre-release test plan

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

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

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

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

git clean -ffdx
python3 setup.py sdist bdist_wheel
pip3 install --upgrade build twine
pyproject-build
twine upload -u zephyr-project dist/*

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

Check out [packaging.python.org](https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives) for more detailed instructions.

Tagging the release
-------------------

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

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

5. Create an annotated tag vX.Y.99 which points to the main branch commit you
Expand Down
46 changes: 46 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[build-system]
requires = ["setuptools>=61.2"]
build-backend = "setuptools.build_meta"

[project]
name = "west"
version = "1.2.99"
authors = [{name = "Zephyr Project", email = "[email protected]"}]
description = "Zephyr RTOS Project meta-tool"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
]
requires-python = ">=3.8"
dependencies = [
"colorama",
"PyYAML>=5.1",
"pykwalify",
"setuptools",
"packaging",
]

[project.license]
file = "LICENSE"

[project.readme]
file = "README.rst"
content-type = "text/x-rst"

[project.urls]
Homepage = "https://github.com/zephyrproject-rtos/west"

[project.scripts]
west = "west.app.main:main"

[tool.setuptools]
package-dir = {"" = "src"}
zip-safe = false
include-package-data = true

[tool.setuptools.packages.find]
where = ["src"]
namespaces = false
53 changes: 0 additions & 53 deletions setup.py

This file was deleted.

4 changes: 3 additions & 1 deletion src/west/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# This is the Python 3 version of option 3 in:
# https://packaging.python.org/guides/single-sourcing-package-version/#single-sourcing-the-version

__version__ = '1.2.99'
import importlib.metadata

__version__ = importlib.metadata.version("west")
#
# MAINTAINERS:
#
Expand Down

0 comments on commit c399c01

Please sign in to comment.