Skip to content

Commit f3c2a0a

Browse files
author
Feras A Saad
committed
Simplify versioning scheme by removing VERSION.
1 parent 189822a commit f3c2a0a

File tree

4 files changed

+31
-55
lines changed

4 files changed

+31
-55
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -125,45 +125,20 @@ Our version scheme, compatible with [PEP 440](https://www.python.org/dev/peps/pe
125125
We do not currently make any semantic API compatibility guarantees about the
126126
meaning of `<major>`, `<minor>`, and `<teeny>`.
127127

128-
In the source tree, the [VERSION](./VERSION) file contains either the
129-
current release version number, or the most recent tagged version
130-
number followed by a plus sign `+`. In that case, a suffix will be
131-
added to the most recent version number, derived from `git describe`,
132-
of the form:
128+
To create a new release (only creating tagged releases from `master` branch):
133129

134-
.post<N>+g<commitid>[.<dirty>]
130+
1. Check-out the master branch with a clean working directory.
135131

136-
The Git tag for a tagged version is named with a `v` prefix. Note
137-
that the content of VERSION for any tagged version MUST NOT include a
138-
`+` suffix, so that `cat VERSION` is sufficient to find the version
139-
number, and `git describe` is not necessary.
132+
2. Create an annotated tag using one of the three forms compatible with PEP
133+
440 shown above. For example: `git tag -a -m v0.2.42 v0.2.42`
140134

141-
To tag a new version:
135+
3. Run `python setup.py build`.
142136

143-
1. Set `VERSION` to the new version, say `0.2.42`:
137+
4. Run `cat src/version.py` and confirm that the version matches the tag. If
138+
the version contains `dirty`, `post`, or a commit id then you have done
139+
something wrong, so please ask for help.
144140

145-
```
146-
$ echo 0.2.42 > VERSION
147-
$ git commit -m 'Bump version to 0.2.42.' VERSION
148-
```
149-
150-
2. Tag it with an annotated tag:
151-
152-
```
153-
$ git tag -a -m v0.2.42 v0.2.42
154-
```
155-
156-
If you want, you can include release notes in the annotated tag
157-
message.
158-
159-
3. Append `+` to the version in VERSION:
160-
161-
```
162-
$ echo 0.2.42+ > VERSION
163-
$ git commit -m 'Bump version to 0.2.42+.' VERSION
164-
```
165-
166-
Make sure when you push that you pass `--tags` to `git push`.
141+
5. Run `git push origin master --tags`.
167142

168143
[1]: https://github.com/probcomp/bayeslite/blob/9555f5fd614e7dd960dcf8b54ae8edc5b69d7d1a/src/backends/cgpm_backend.py#L835-L836
169144
[2]: https://github.com/probcomp/bayeslite/blob/9555f5fd614e7dd960dcf8b54ae8edc5b69d7d1a/src/bqlfn.py#L95-L96

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
include LICENSE.txt
22
include README.md
3-
include VERSION
43
include check.sh
54
include external/README
65
include external/lemonade/COPYING

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,31 @@ def set_undefined_options(self, opt, val):
3838
Command.set_undefined_options(self, opt, val)
3939

4040
def get_version():
41-
with open('VERSION', 'rb') as f:
42-
version = f.read().strip()
43-
44-
# Append the Git commit id if this is a development version.
45-
if version.endswith('+'):
46-
import re
47-
import subprocess
48-
version = version[:-1]
49-
tag = 'v' + version
50-
desc = subprocess.check_output([
51-
'git', 'describe', '--dirty', '--long', '--match', tag,
52-
])
53-
match = re.match(r'^v([^-]*)-([0-9]+)-(.*)$', desc)
54-
assert match is not None
55-
verpart, revpart, localpart = match.groups()
56-
assert verpart == version
57-
# Local part may be g0123abcd or g0123abcd-dirty. Hyphens are
58-
# not kosher here, so replace by dots.
41+
import re
42+
import subprocess
43+
# git describe a commit using the most recent tag reachable from it.
44+
# Release tags start with v* (XXX what about other tags starting with v?)
45+
# and are of the form `v1.1.2`.
46+
#
47+
# The output `desc` will be of the form v1.1.2-2-gb92bef6[-dirty]:
48+
# - verpart v1.1.2
49+
# - revpart 2
50+
# - localpart gb92bef6[-dirty]
51+
desc = subprocess.check_output([
52+
'git', 'describe', '--dirty', '--long', '--match', 'v*',
53+
])
54+
match = re.match(r'^v([^-]*)-([0-9]+)-(.*)$', desc)
55+
assert match is not None
56+
verpart, revpart, localpart = match.groups()
57+
# Create a post version.
58+
if revpart > '0' or 'dirty' in localpart:
59+
# Local part may be g0123abcd or g0123abcd-dirty.
60+
# Hyphens not kosher here, so replace by dots.
5961
localpart = localpart.replace('-', '.')
6062
full_version = '%s.post%s+%s' % (verpart, revpart, localpart)
63+
# Create a release version.
6164
else:
62-
full_version = version
65+
full_version = verpart
6366

6467
# Strip the local part if there is one, to appease pkg_resources,
6568
# which handles only PEP 386, not PEP 440.

0 commit comments

Comments
 (0)