From 26a8e55de0ead963c67f5303992c7b864e372cd4 Mon Sep 17 00:00:00 2001 From: "Afshin T. Darian" Date: Mon, 16 Aug 2021 15:51:25 +0100 Subject: [PATCH] Update release helper plumbing --- .github/workflows/check-release.yml | 55 +++++++++++++++++++++++++++++ CHANGELOG.md | 4 +++ MANIFEST.in | 6 ++-- RELEASE.md | 20 +++++++---- ipykernel/_version.py | 26 +++++++------- pyproject.toml | 20 +++++++++++ setup.cfg | 2 ++ setup.py | 12 ------- 8 files changed, 111 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/check-release.yml diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml new file mode 100644 index 000000000..8e4f4f3c9 --- /dev/null +++ b/.github/workflows/check-release.yml @@ -0,0 +1,55 @@ +name: Check Release +on: + push: + branches: ["master"] + pull_request: + branches: ["*"] + +jobs: + check_release: + runs-on: ubuntu-latest + strategy: + matrix: + group: [check_release, link_check] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + architecture: "x64" + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + - name: Cache pip + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}-pip- + - name: Cache checked links + if: ${{ matrix.group == 'link_check' }} + uses: actions/cache@v2 + with: + path: ~/.cache/pytest-link-check + key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/*.md', '**/*.rst') }}-md-links + restore-keys: | + ${{ runner.os }}-linkcheck- + - name: Upgrade packaging dependencies + run: | + pip install --upgrade pip setuptools wheel --user + - name: Install Dependencies + run: | + pip install -e . + - name: Check Release + if: ${{ matrix.group == 'check_release' }} + uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Run Link Check + if: ${{ matrix.group == 'link_check' }} + uses: jupyter-server/jupyter_releaser/.github/actions/check-links@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c34b2389..bd6c9b769 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ ## 6.1.0 + + ### Enhancements made - Implemented `richInspectVariable` request handler [#734](https://github.com/ipython/ipykernel/pull/734) ([@JohanMabille](https://github.com/JohanMabille)) @@ -29,6 +31,8 @@ - Fix exception raised by `OutStream.write` [#726](https://github.com/ipython/ipykernel/pull/726) ([@SimonKrughoff](https://github.com/SimonKrughoff)) + + ## 6.0 ## 6.0.3 diff --git a/MANIFEST.in b/MANIFEST.in index 7bcad2d18..9f961f4ec 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,4 @@ -include COPYING.md -include CONTRIBUTING.md -include README.md +include *.md include pyproject.toml # Documentation @@ -23,3 +21,5 @@ global-exclude .git global-exclude .ipynb_checkpoints prune data_kernelspec +exclude .mailmap +exclude readthedocs.yml diff --git a/RELEASE.md b/RELEASE.md index aacb2ae2c..21c93a25d 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,19 +1,25 @@ # Release Guide -- Update `docs/changelog.rst` -- Update `ipykernel/_version.py` +## Using `jupyter_releaser` + +The recommended way to make a release is to use [`jupyter_releaser`](https://github.com/jupyter-server/jupyter_releaser#checklist-for-adoption). + +## Manual Release + +- Update `CHANGELOG` + - Run the following: ```bash -version=`python setup.py --version 2>/dev/null` -git commit -a -m "Release $version" -git tag $version; true; +export VERSION= +pip install jupyter_releaser +tbump --only-patch $VERSION +git commit -a -m "Release $VERSION" +git tag $VERSION; true; git push --all git push --tags rm -rf dist build -pip install build twine python -m build . -pip install twine twine check dist/* twine upload dist/* ``` diff --git a/ipykernel/_version.py b/ipykernel/_version.py index fc734ce43..eea34dcf8 100644 --- a/ipykernel/_version.py +++ b/ipykernel/_version.py @@ -1,16 +1,18 @@ -version_info = (6, 2, 0) -__version__ = ".".join(map(str, version_info[:3])) +""" +store the current version info of the server. +""" +import re -# pep440 is annoying, beta/alpha/rc should _not_ have dots or pip/setuptools -# confuses which one between the wheel and sdist is the most recent. -if len(version_info) == 4: - extra = version_info[3] - if extra.startswith(('a','b','rc')): - __version__ = __version__+extra - else: - __version__ = __version__+'.'+extra -if len(version_info) > 4: - raise NotImplementedError +# Version string must appear intact for tbump versioning +__version__ = '6.2.0' + +# Build up version_info tuple for backwards compatibility +pattern = r'(?P\d+).(?P\d+).(?P\d+)(?P.*)' +match = re.match(pattern, __version__) +parts = [int(match[part]) for part in ['major', 'minor', 'patch']] +if match['rest']: + parts.append(match['rest']) +version_info = tuple(parts) kernel_protocol_version_info = (5, 3) kernel_protocol_version = '%s.%s' % kernel_protocol_version_info diff --git a/pyproject.toml b/pyproject.toml index 36d4cabc7..baea27242 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,3 +7,23 @@ requires=[ "jupyter_core>=4.2", "jupyter_client", ] + +[tool.check-manifest] +ignore = [] + +[tool.jupyter-releaser] +skip = ["check-links"] + +[tool.tbump.version] +current = "6.2.0" +regex = ''' + (?P\d+)\.(?P\d+)\.(?P\d+) + ((?Pa|b|rc|.dev)(?P\d+))? +''' + +[tool.tbump.git] +message_template = "Bump to {new_version}" +tag_template = "v{new_version}" + +[[tool.tbump.file]] +src = "ipykernel/_version.py" diff --git a/setup.cfg b/setup.cfg index 1920192c8..7fd8e1ae1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,8 +1,10 @@ + [bdist_wheel] universal=0 [metadata] license_file = COPYING.md +version = attr: ipykernel._version.__version__ [nosetests] warningfilters= default |.* |DeprecationWarning |ipykernel.* diff --git a/setup.py b/setup.py index d3fea9cb6..8517cd99f 100644 --- a/setup.py +++ b/setup.py @@ -39,23 +39,11 @@ def run(self): 'ipykernel': ['resources/*.*'], } -version_ns = {} -with open(pjoin(here, name, '_version.py')) as f: - exec(f.read(), {}, version_ns) - -current_version = version_ns['__version__'] - -loose_pep440re = re.compile(r'^(\d+)\.(\d+)\.(\d+((a|b|rc)\d+)?)(\.post\d+)?(\.dev\d*)?$') -if not loose_pep440re.match(current_version): - raise ValueError("Version number '%s' is not valid (should match [N!]N(.N)*[{a|b|rc}N][.postN][.devN])" % current_version) - - with open(pjoin(here, 'README.md')) as fid: LONG_DESCRIPTION = fid.read() setup_args = dict( name=name, - version=current_version, cmdclass={ 'bdist_egg': bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled, },