@@ -10,12 +10,13 @@ Single-sourcing the Project Version
10
10
One of the challenges in building packages is that the version string can be required in multiple places.
11
11
12
12
* It needs to be specified when building the package (e.g. in :file: `pyproject.toml `)
13
- - That will assure that it is properly assigned in the distribution file name, and in teh installed package.
13
+ - That will assure that it is properly assigned in the distribution file name, and in the installed package.
14
14
15
15
* Some projects require that there be a version string available as an attribute in the importable module, e.g::
16
16
17
17
import a_package
18
18
print(a_package.__version__)
19
+
19
20
* In the metadata of the artifacts for each of the packaging ecosystems
20
21
21
22
While different projects have different needs, it's important to make sure that there is a single source of truth for the version number.
@@ -36,17 +37,15 @@ If the version string is not in the source, it can be extracted at runtime with
36
37
37
38
Consult your build system documentation for how to implement your preferred method.
38
39
39
- Put links in to build system docs?
40
- -- I have no idea which are currently robust and maintained -- do we want to get into seeming endorsing particular tools in this doc?
41
-
40
+ Here are the common ones:
42
41
43
- * setuptools:
42
+ * ` Hatch < https://hatch.pypa.io/1.9/version/ >`_
44
43
45
- * hatch:
44
+ * ` Setuptools < https://setuptools.pypa.io/en/latest/userguide/distribution.html#specifying-your-project-s-version >`_
46
45
47
- * poetry:
46
+ - ` setuptools_scm < https://setuptools-scm.readthedocs.io/en/latest/ >`_
48
47
49
- * PyBuilder:
48
+ * ` Flit < https://flit.pypa.io/en/stable/ >`_
50
49
51
- * Others?
50
+ * ` PDM < https://pdm-project.org/en/latest/reference/pep621/#__tabbed_1_2 >`_
52
51
0 commit comments