File: CONTRIBUTING.md

package info (click to toggle)
ipykernel 6.30.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,084 kB
  • sloc: python: 9,165; makefile: 165; sh: 8
file content (94 lines) | stat: -rw-r--r-- 2,858 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Contributing

Welcome!

For contributing tips, follow the [Jupyter Contributing Guide](https://jupyter.readthedocs.io/en/latest/contributing/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 .
```

## Code Styling

`ipykernel` has adopted automatic code formatting so you shouldn't
need to worry too much about your code style.
As long as your code is valid,
the pre-commit hook should take care of how it should look.
To install `pre-commit`, run the following::

```
pip install pre-commit
pre-commit install
```

You can invoke the pre-commit hook by hand at any time with::

```
pre-commit run
```

which should run any autoformatting on your code
and tell you about any errors it couldn't fix automatically.
You may also install [black integration](https://github.com/psf/black#editor-integration)
into your text editor to format code automatically.

If you have already committed files before setting up the pre-commit
hook with `pre-commit install`, you can fix everything up using
`pre-commit run --all-files`. You need to make the fixing commit
yourself after that.

Some of the hooks only run on CI by default, but you can invoke them by
running with the `--hook-stage manual` argument.

## 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. This
affects only the 4.x branch of ipykernel as the 5+ version is only compatible
Python 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 for the 4.x branch.
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
```