Skip to content

Commit 26a8e55

Browse files
committed
Update release helper plumbing
1 parent c36de65 commit 26a8e55

File tree

8 files changed

+111
-34
lines changed

8 files changed

+111
-34
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Check Release
2+
on:
3+
push:
4+
branches: ["master"]
5+
pull_request:
6+
branches: ["*"]
7+
8+
jobs:
9+
check_release:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
group: [check_release, link_check]
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- name: Install Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: 3.9
21+
architecture: "x64"
22+
- name: Get pip cache dir
23+
id: pip-cache
24+
run: |
25+
echo "::set-output name=dir::$(pip cache dir)"
26+
- name: Cache pip
27+
uses: actions/cache@v2
28+
with:
29+
path: ${{ steps.pip-cache.outputs.dir }}
30+
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}
31+
restore-keys: |
32+
${{ runner.os }}-pip-
33+
${{ runner.os }}-pip-
34+
- name: Cache checked links
35+
if: ${{ matrix.group == 'link_check' }}
36+
uses: actions/cache@v2
37+
with:
38+
path: ~/.cache/pytest-link-check
39+
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/*.md', '**/*.rst') }}-md-links
40+
restore-keys: |
41+
${{ runner.os }}-linkcheck-
42+
- name: Upgrade packaging dependencies
43+
run: |
44+
pip install --upgrade pip setuptools wheel --user
45+
- name: Install Dependencies
46+
run: |
47+
pip install -e .
48+
- name: Check Release
49+
if: ${{ matrix.group == 'check_release' }}
50+
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1
51+
with:
52+
token: ${{ secrets.GITHUB_TOKEN }}
53+
- name: Run Link Check
54+
if: ${{ matrix.group == 'link_check' }}
55+
uses: jupyter-server/jupyter_releaser/.github/actions/check-links@v1

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
## 6.1.0
1919

20+
<!-- <START NEW CHANGELOG ENTRY> -->
21+
2022
### Enhancements made
2123

2224
- Implemented `richInspectVariable` request handler [#734](https://github.com/ipython/ipykernel/pull/734) ([@JohanMabille](https://github.com/JohanMabille))
@@ -29,6 +31,8 @@
2931

3032
- Fix exception raised by `OutStream.write` [#726](https://github.com/ipython/ipykernel/pull/726) ([@SimonKrughoff](https://github.com/SimonKrughoff))
3133

34+
<!-- <END NEW CHANGELOG ENTRY> -->
35+
3236
## 6.0
3337

3438
## 6.0.3

MANIFEST.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
include COPYING.md
2-
include CONTRIBUTING.md
3-
include README.md
1+
include *.md
42
include pyproject.toml
53

64
# Documentation
@@ -23,3 +21,5 @@ global-exclude .git
2321
global-exclude .ipynb_checkpoints
2422

2523
prune data_kernelspec
24+
exclude .mailmap
25+
exclude readthedocs.yml

RELEASE.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
# Release Guide
22

3-
- Update `docs/changelog.rst`
4-
- Update `ipykernel/_version.py`
3+
## Using `jupyter_releaser`
4+
5+
The recommended way to make a release is to use [`jupyter_releaser`](https://github.com/jupyter-server/jupyter_releaser#checklist-for-adoption).
6+
7+
## Manual Release
8+
9+
- Update `CHANGELOG`
10+
511
- Run the following:
612

713
```bash
8-
version=`python setup.py --version 2>/dev/null`
9-
git commit -a -m "Release $version"
10-
git tag $version; true;
14+
export VERSION=<version>
15+
pip install jupyter_releaser
16+
tbump --only-patch $VERSION
17+
git commit -a -m "Release $VERSION"
18+
git tag $VERSION; true;
1119
git push --all
1220
git push --tags
1321
rm -rf dist build
14-
pip install build twine
1522
python -m build .
16-
pip install twine
1723
twine check dist/*
1824
twine upload dist/*
1925
```

ipykernel/_version.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
version_info = (6, 2, 0)
2-
__version__ = ".".join(map(str, version_info[:3]))
1+
"""
2+
store the current version info of the server.
3+
"""
4+
import re
35

4-
# pep440 is annoying, beta/alpha/rc should _not_ have dots or pip/setuptools
5-
# confuses which one between the wheel and sdist is the most recent.
6-
if len(version_info) == 4:
7-
extra = version_info[3]
8-
if extra.startswith(('a','b','rc')):
9-
__version__ = __version__+extra
10-
else:
11-
__version__ = __version__+'.'+extra
12-
if len(version_info) > 4:
13-
raise NotImplementedError
6+
# Version string must appear intact for tbump versioning
7+
__version__ = '6.2.0'
8+
9+
# Build up version_info tuple for backwards compatibility
10+
pattern = r'(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)'
11+
match = re.match(pattern, __version__)
12+
parts = [int(match[part]) for part in ['major', 'minor', 'patch']]
13+
if match['rest']:
14+
parts.append(match['rest'])
15+
version_info = tuple(parts)
1416

1517
kernel_protocol_version_info = (5, 3)
1618
kernel_protocol_version = '%s.%s' % kernel_protocol_version_info

pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,23 @@ requires=[
77
"jupyter_core>=4.2",
88
"jupyter_client",
99
]
10+
11+
[tool.check-manifest]
12+
ignore = []
13+
14+
[tool.jupyter-releaser]
15+
skip = ["check-links"]
16+
17+
[tool.tbump.version]
18+
current = "6.2.0"
19+
regex = '''
20+
(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
21+
((?P<channel>a|b|rc|.dev)(?P<release>\d+))?
22+
'''
23+
24+
[tool.tbump.git]
25+
message_template = "Bump to {new_version}"
26+
tag_template = "v{new_version}"
27+
28+
[[tool.tbump.file]]
29+
src = "ipykernel/_version.py"

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
12
[bdist_wheel]
23
universal=0
34

45
[metadata]
56
license_file = COPYING.md
7+
version = attr: ipykernel._version.__version__
68

79
[nosetests]
810
warningfilters= default |.* |DeprecationWarning |ipykernel.*

setup.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,11 @@ def run(self):
3939
'ipykernel': ['resources/*.*'],
4040
}
4141

42-
version_ns = {}
43-
with open(pjoin(here, name, '_version.py')) as f:
44-
exec(f.read(), {}, version_ns)
45-
46-
current_version = version_ns['__version__']
47-
48-
loose_pep440re = re.compile(r'^(\d+)\.(\d+)\.(\d+((a|b|rc)\d+)?)(\.post\d+)?(\.dev\d*)?$')
49-
if not loose_pep440re.match(current_version):
50-
raise ValueError("Version number '%s' is not valid (should match [N!]N(.N)*[{a|b|rc}N][.postN][.devN])" % current_version)
51-
52-
5342
with open(pjoin(here, 'README.md')) as fid:
5443
LONG_DESCRIPTION = fid.read()
5544

5645
setup_args = dict(
5746
name=name,
58-
version=current_version,
5947
cmdclass={
6048
'bdist_egg': bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled,
6149
},

0 commit comments

Comments
 (0)