circuitpython/tools/mpremote/pyproject.toml
Jim Mussared ce9f7cd00a tools/mpremote: Use hatch to build mpremote package.
This allows the entire configuration to be defined in a single file,
including the logic for including pyboard.py and automatically versioning
based on the git tag.

Building the package works both via `python -m build` as well as
`hatch build`.  `python -m build ` has the advantage of automatically
fetching all dependencies, you don't need to manually install any hatch
packages.

In order to make the versioning work, and also keep things simpler for end
users, mpremote releases will now be the same as MicroPython releases and
use the same tag.  The version strings for mpremote will look like:
- X.Y.Z -- clean build at the tag
- X.Y.Z.postN+gHASH -- clean build, N revisions from the most recent tag
- X.Y.Z.postN+gHASH.dYYYYMMDD -- dirty build, N revisions from out

This commit extends on the idea from #8404.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-02-24 11:40:22 +11:00

55 lines
1.4 KiB
TOML

[build-system]
requires = [
"hatchling",
"hatch-requirements-txt",
"hatch-vcs",
]
build-backend = "hatchling.build"
[project]
name = "mpremote"
description = "Tool for interacting remotely with MicroPython devices"
readme = "README.md"
authors = [
{name = "Damien George", email = "damien@micropython.org"},
]
urls = {Homepage = "https://github.com/micropython/micropython"}
keywords = [
"hardware",
"micropython",
]
license = {text = "MIT"}
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Embedded Systems",
"Topic :: System :: Hardware",
]
requires-python = ">=3.4"
dynamic = ["dependencies", "version"]
[project.scripts]
mpremote = "mpremote.main:main"
[tool.hatch.metadata.hooks.requirements_txt]
files = ["requirements.txt"]
[tool.hatch.version]
source = "vcs"
tag-pattern = "(?P<version>v(\\d+).(\\d+).(\\d+))"
raw-options = { root = "../..", version_scheme = "post-release" }
[tool.hatch.build]
packages = ["mpremote"]
# Also grab pyboard.py from /tools and add it to the package for both wheel and sdist.
[tool.hatch.build.force-include]
"../pyboard.py" = "mpremote/pyboard.py"
# Workaround to allow `python -m build` to work.
[tool.hatch.build.targets.sdist.force-include]
"../pyboard.py" = "mpremote/pyboard.py"
"requirements.txt" = "requirements.txt"