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.

Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
  • Loading branch information
Ayush1325 committed Jun 29, 2024
1 parent 155b242 commit b496cb4
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 77 deletions.
6 changes: 3 additions & 3 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 Down Expand Up @@ -158,7 +158,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 = "devel@lists.zephyrproject.org"}]
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/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
ManifestVersionError, ManifestImportFailed, _ManifestImportDepth, \
ManifestProject, MANIFEST_REV_BRANCH
from west.util import quote_sh_list, west_topdir, WestNotFound
from west.version import __version__
import importlib.metadata

__version__ = importlib.metadata.version("west")

class EarlyArgs(NamedTuple):
# Data type for storing "early" argument parsing results.
Expand Down
18 changes: 0 additions & 18 deletions src/west/version.py

This file was deleted.

5 changes: 3 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import importlib.metadata
import os
import subprocess
import sys

import west.version
__version__ = importlib.metadata.version("west")

assert 'TOXTEMPDIR' in os.environ, "you must run these tests using tox"

Expand All @@ -16,5 +17,5 @@ def test_main():
output_as_module = subprocess.check_output([sys.executable, '-m', 'west',
'--version']).decode()
output_directly = subprocess.check_output(['west', '--version']).decode()
assert west.version.__version__ in output_as_module
assert __version__ in output_as_module
assert output_as_module == output_directly

0 comments on commit b496cb4

Please sign in to comment.