package versioning
This commit is contained in:
parent
8a9a50346d
commit
a146dd80e4
37
README.md
37
README.md
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This is a brief introduction to python packages. How to make them, how
|
This is a brief introduction to python packages. How to make them, how
|
||||||
to install them, how to upload them, how to maintain them, how to work
|
to install them, how to upload them, how to maintain them, how to work
|
||||||
with them. For details consult https://packaging.python.org and other
|
with them. For details consult https://packaging.python.org, or
|
||||||
sites.
|
https://py-pkgs.org, or other sites.
|
||||||
|
|
||||||
|
|
||||||
## Why packages?
|
## Why packages?
|
||||||
@ -193,6 +193,22 @@ python3 -m twine upload dist/*
|
|||||||
token
|
token
|
||||||
|
|
||||||
|
|
||||||
|
## Versioning
|
||||||
|
|
||||||
|
Your package needs a version number (for details se below). But how to
|
||||||
|
choose the right version number? A nice and brief overview is given at
|
||||||
|
the [Python Packaging User
|
||||||
|
Guide](https://packaging.python.org/en/latest/discussions/versioning/).
|
||||||
|
|
||||||
|
In short, for semantic versioning the version number is composed of
|
||||||
|
three integer numbers called `major`, `minor`, and `patch`, separated
|
||||||
|
by a dot. These numbers are incremented in the following way:
|
||||||
|
|
||||||
|
- `major`, when incompatible API changes have been introduced,
|
||||||
|
- `minor`, when functionality is added in a backwards-compatible manner, and
|
||||||
|
- `patch`, for backwards-compatible bug fixes.
|
||||||
|
|
||||||
|
|
||||||
## Package version
|
## Package version
|
||||||
|
|
||||||
For uploading your package to [PyPi](https://pypi.org/) you need to
|
For uploading your package to [PyPi](https://pypi.org/) you need to
|
||||||
@ -235,14 +251,15 @@ def about():
|
|||||||
|
|
||||||
But how do you get the very same version into the `pyproject.toml`
|
But how do you get the very same version into the `pyproject.toml`
|
||||||
file? It would be a very bad idea to write it there directly and
|
file? It would be a very bad idea to write it there directly and
|
||||||
update it whenever you change it in the `__init__.py` file.
|
update it whenever you change it in the `__init__.py` file. The
|
||||||
|
version number should be set only in one place.
|
||||||
For this you need to specify the `version` field as `dynamic` in the
|
|
||||||
`[project]` section. This tells the package tool that the version will
|
This is possible, of course. You need to specify the `version` field
|
||||||
be set dynamically by some code. There are several options to do
|
as `dynamic` in the `[project]` section. This tells the package tool
|
||||||
so. The simplest one is to add a `[tool.setuptools.dynamic]` section
|
that the version will be set dynamically by some code. There are
|
||||||
where the version is read as an attribute from the `numerix` package,
|
several options to do so. The simplest one is to add a
|
||||||
that is its `__init__.py`file:
|
`[tool.setuptools.dynamic]` section where the version is read as an
|
||||||
|
attribute from the `numerix` package, that is its `__init__.py`file:
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
...
|
...
|
||||||
|
Loading…
Reference in New Issue
Block a user