Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release process to CONTRIBUTING.md #339

Merged
merged 5 commits into from
Sep 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,60 @@
# Contributing

We follow the [IPython Contributing Guide](https://github.com/ipython/ipython/blob/master/CONTRIBUTING.md).
Welcome!

For contributing tips, follow the [Jupyter Contributing Guide](https://jupyter.readthedocs.io/en/latest/contributor/content-contributor.html).
Please make sure to follow the [Jupyter Code of Conduct](https://github.com/jupyter/governance/blob/master/conduct/code_of_conduct.md).

## Installing ipykernel for development

ipykernel is a pure Python package, so setting up for development is the same as most other Python projects:

```bash
# clone the repo
git clone https://github.com/ipython/ipykernel
cd ipykernel
# do a 'development' or 'editable' install with pip:
pip install -e .
```

## Releasing ipykernel

Releasing ipykernel is *almost* standard for a Python package:

- set version for release
- make and publish tag
- publish release to PyPI
- set version back to development

The one extra step for ipykernel is that we need to make separate wheels for Python 2 and 3
because the bundled kernelspec has different contents for Python 2 and 3.

The full release process is available below:

```bash
# make sure version is set in ipykernel/_version.py
VERSION="4.9.0"
# commit the version and make a release tag
git add ipykernel/_version.py
git commit -m "release $VERSION"
git tag -am "release $VERSION" $VERSION

# push the changes to the repo
git push
git push --tags

# publish the release to PyPI
# note the extra `python2 setup.py bdist_wheel` for creating
# the wheel for Python 2
pip install --upgrade twine
git clean -xfd
python3 setup.py sdist bdist_wheel
python2 setup.py bdist_wheel # the extra step!
twine upload dist/*

# set the version back to '.dev' in ipykernel/_version.py
# e.g. 4.10.0.dev if we just released 4.9.0
git add ipykernel/_version.py
git commit -m "back to dev"
git push
```
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include COPYING.md
include CONTRIBUTING.md
include README.md
include pyproject.toml

# Documentation
graft docs
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ init:
- cmd: set PATH=%python%;%python%\scripts;%PATH%
install:
- cmd: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade setuptools pip wheel
pip --version
- cmd: |
pip install --pre -e .
Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[build-system]
requires=[
"setuptools",
"wheel",
"ipython>=5",
"jupyter_core>=4.2",
"jupyter_client",
]
92 changes: 50 additions & 42 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,19 @@
import os
import shutil

from distutils.core import setup
from setuptools import setup
from setuptools.command.bdist_egg import bdist_egg


class bdist_egg_disabled(bdist_egg):
"""Disabled version of bdist_egg

Prevents setup.py install from performing setuptools' default easy_install,
which it should never ever do.
"""
def run(self):
sys.exit("Aborting implicit building of eggs. Use `pip install .` to install from source.")


pjoin = os.path.join
here = os.path.abspath(os.path.dirname(__file__))
Expand All @@ -52,20 +64,39 @@


setup_args = dict(
name = name,
version = version_ns['__version__'],
scripts = glob(pjoin('scripts', '*')),
packages = packages,
py_modules = ['ipykernel_launcher'],
package_data = package_data,
description = "IPython Kernel for Jupyter",
author = 'IPython Development Team',
author_email = 'ipython-dev@scipy.org',
url = 'http://ipython.org',
license = 'BSD',
platforms = "Linux, Mac OS X, Windows",
keywords = ['Interactive', 'Interpreter', 'Shell', 'Web'],
classifiers = [
name=name,
version=version_ns['__version__'],
cmdclass={
'bdist_egg': bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled,
},
scripts=glob(pjoin('scripts', '*')),
packages=packages,
py_modules=['ipykernel_launcher'],
package_data=package_data,
description="IPython Kernel for Jupyter",
author='IPython Development Team',
author_email='ipython-dev@scipy.org',
url='https://ipython.org',
license='BSD',
long_description="The IPython kernel for Jupyter",
platforms="Linux, Mac OS X, Windows",
keywords=['Interactive', 'Interpreter', 'Shell', 'Web'],
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
install_requires=[
'ipython>=4.0.0',
'traitlets>=4.1.0',
'jupyter_client',
'tornado>=4.0',
],
extras_require={
'test:python_version=="2.7"': ['mock'],
'test': [
'pytest',
'pytest-cov',
'nose', # nose because there are still a few nose.tools imports hanging around
],
},
classifiers=[
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Intended Audience :: Science/Research',
Expand All @@ -76,17 +107,6 @@
],
)

if 'develop' in sys.argv or any(a.startswith('bdist') for a in sys.argv):
import setuptools

setuptools_args = {}
install_requires = setuptools_args['install_requires'] = [
'ipython>=4.0.0',
'traitlets>=4.1.0',
'jupyter_client',
'tornado>=4.0',
]

if any(a.startswith(('bdist', 'build', 'install')) for a in sys.argv):
from ipykernel.kernelspec import write_kernel_spec, make_ipkernel_cmd, KERNEL_NAME

Expand All @@ -97,24 +117,12 @@
write_kernel_spec(dest, overrides={'argv': argv})

setup_args['data_files'] = [
(pjoin('share', 'jupyter', 'kernels', KERNEL_NAME),
glob(pjoin('data_kernelspec', '*'))),
(
pjoin('share', 'jupyter', 'kernels', KERNEL_NAME),
glob(pjoin('data_kernelspec', '*')),
)
]


setuptools_args['python_requires'] = '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'

extras_require = setuptools_args['extras_require'] = {
'test:python_version=="2.7"': ['mock'],
'test': [
'pytest',
'pytest-cov',
'nose', # nose because there are still a few nose.tools imports hanging around
],
}

if 'setuptools' in sys.modules:
setup_args.update(setuptools_args)

if __name__ == '__main__':
setup(**setup_args)