Debian Codegraph @

docs/tutorials/dev_releases.md

raw
1 # Dev Releases
2
3 ## About
4
5 To make use of a `.dev` suffix, as per
6 [PEP440](https://peps.python.org/pep-0440/#developmental-releases).
7
8 If multiple active branches attempt to create a tag relative to the main branch, there is a possibility that they will attempt to create the _same_ tag, resulting in a collision.
9
10 Developmental releases aim to avoid this by including a `.dev` segment which
11 includes a non-negative integer unique to that workflow:
12
13 ```txt
14 X.Y.devN
15 ```
16
17 !!! note
18 As noted in
19 [PEP440](https://peps.python.org/pep-0440/#developmental-releases),
20 while developmental releases help avoid the situation described above, they can be _"difficult to parse for human readers"_ depending on the value passed as the developmental release.
21
22 ## How to
23
24 ### Example 1: CircleCI
25
26 For example, CircleCI [provides](https://circleci.com/docs/variables/)
27 `CIRCLE_BUILD_NUM`, a unique number for each job which will increment with each
28 run:
29
30 ```sh
31 --devrelease ${CIRCLE_BUILD_NUM}
32 ```
33
34 This will result in a unique developmental release of, for example:
35
36 ```sh
37 1.3.2.dev2478
38 ```
39
40 ### Example 2: GitHub
41
42 GitHub also
43 [provides](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables)
44 `GITHUB_RUN_ID`, a _"unique number for each workflow run"_ which will also
45 provide a unique number for each workflow:
46
47 ```sh
48 --devrelease ${GITHUB_RUN_ID}
49 ```
50
51 This will result in a unique developmental release of, for example:
52
53 ```sh
54 1.3.2.dev6048584598
55 ```
56
57 ### Example 3: Unix time
58
59 Equally, as the developmental release needs only a non-negative integer, it is
60 possible to use the Unix time (i.e. the number of seconds since 1st January
61 1970 UTC).
62
63 This approach could potentially create a collision if two builds occur at precisely the same second, but it may be sufficient for many use cases:
64
65 ```sh
66 --devrelease $(date +%s)
67 ```
68
69 This will result in a unique developmental release of, for example:
70
71 ```sh
72 1.3.2.dev1696238452
73 ```