Show More
@@ -1,80 +1,83 | |||||
1 | name: Run tests |
|
1 | name: Run tests | |
2 |
|
2 | |||
3 | on: |
|
3 | on: | |
4 | push: |
|
4 | push: | |
5 | branches: |
|
5 | branches: | |
6 | - main |
|
6 | - main | |
7 | - '*.x' |
|
7 | - '*.x' | |
8 | pull_request: |
|
8 | pull_request: | |
9 | # Run weekly on Monday at 1:23 UTC |
|
9 | # Run weekly on Monday at 1:23 UTC | |
10 | schedule: |
|
10 | schedule: | |
11 | - cron: '23 1 * * 1' |
|
11 | - cron: '23 1 * * 1' | |
12 | workflow_dispatch: |
|
12 | workflow_dispatch: | |
13 |
|
13 | |||
14 |
|
14 | |||
15 | jobs: |
|
15 | jobs: | |
16 | test: |
|
16 | test: | |
17 | runs-on: ${{ matrix.os }} |
|
17 | runs-on: ${{ matrix.os }} | |
18 | strategy: |
|
18 | strategy: | |
19 | fail-fast: false |
|
19 | fail-fast: false | |
20 | matrix: |
|
20 | matrix: | |
21 | os: [ubuntu-latest, windows-latest] |
|
21 | os: [ubuntu-latest, windows-latest] | |
22 | python-version: ["3.8", "3.9", "3.10"] |
|
22 | python-version: ["3.8", "3.9", "3.10"] | |
23 | deps: [test_extra] |
|
23 | deps: [test_extra] | |
24 | # Test all on ubuntu, test ends on macos |
|
24 | # Test all on ubuntu, test ends on macos | |
25 | include: |
|
25 | include: | |
26 | - os: macos-latest |
|
26 | - os: macos-latest | |
27 | python-version: "3.8" |
|
27 | python-version: "3.8" | |
28 | deps: test_extra |
|
28 | deps: test_extra | |
29 | - os: macos-latest |
|
29 | - os: macos-latest | |
30 | python-version: "3.10" |
|
30 | python-version: "3.10" | |
31 | deps: test_extra |
|
31 | deps: test_extra | |
32 | # Tests minimal dependencies set |
|
32 | # Tests minimal dependencies set | |
33 | - os: ubuntu-latest |
|
33 | - os: ubuntu-latest | |
34 | python-version: "3.10" |
|
34 | python-version: "3.10" | |
35 | deps: test |
|
35 | deps: test | |
36 | # Tests latest development Python version |
|
36 | # Tests latest development Python version | |
37 | - os: ubuntu-latest |
|
37 | - os: ubuntu-latest | |
38 | python-version: "3.11-dev" |
|
38 | python-version: "3.11-dev" | |
39 | deps: test |
|
39 | deps: test | |
40 | # Installing optional dependencies stuff takes ages on PyPy |
|
40 | # Installing optional dependencies stuff takes ages on PyPy | |
41 | - os: ubuntu-latest |
|
41 | - os: ubuntu-latest | |
42 | python-version: "pypy-3.8" |
|
42 | python-version: "pypy-3.8" | |
43 | deps: test |
|
43 | deps: test | |
44 | - os: windows-latest |
|
44 | - os: windows-latest | |
45 | python-version: "pypy-3.8" |
|
45 | python-version: "pypy-3.8" | |
46 | deps: test |
|
46 | deps: test | |
47 | - os: macos-latest |
|
47 | - os: macos-latest | |
48 | python-version: "pypy-3.8" |
|
48 | python-version: "pypy-3.8" | |
49 | deps: test |
|
49 | deps: test | |
50 |
|
50 | |||
51 | steps: |
|
51 | steps: | |
52 | - uses: actions/checkout@v3 |
|
52 | - uses: actions/checkout@v3 | |
53 | - name: Set up Python ${{ matrix.python-version }} |
|
53 | - name: Set up Python ${{ matrix.python-version }} | |
54 | uses: actions/setup-python@v4 |
|
54 | uses: actions/setup-python@v4 | |
55 | with: |
|
55 | with: | |
56 | python-version: ${{ matrix.python-version }} |
|
56 | python-version: ${{ matrix.python-version }} | |
57 | cache: pip |
|
57 | cache: pip | |
58 | - name: Install latex |
|
58 | - name: Install latex | |
59 | if: runner.os == 'Linux' && matrix.deps == 'test_extra' |
|
59 | if: runner.os == 'Linux' && matrix.deps == 'test_extra' | |
60 | run: echo "disable latex for now, issues in mirros" #sudo apt-get -yq -o Acquire::Retries=3 --no-install-suggests --no-install-recommends install texlive dvipng |
|
60 | run: echo "disable latex for now, issues in mirros" #sudo apt-get -yq -o Acquire::Retries=3 --no-install-suggests --no-install-recommends install texlive dvipng | |
61 | - name: Install and update Python dependencies |
|
61 | - name: Install and update Python dependencies | |
62 | run: | |
|
62 | run: | | |
63 | python -m pip install --upgrade pip setuptools wheel build |
|
63 | python -m pip install --upgrade pip setuptools wheel build | |
64 | python -m pip install --upgrade -e .[${{ matrix.deps }}] |
|
64 | python -m pip install --upgrade -e .[${{ matrix.deps }}] | |
65 | python -m pip install --upgrade check-manifest pytest-cov |
|
65 | python -m pip install --upgrade check-manifest pytest-cov | |
66 | - name: Try building with Python build |
|
66 | - name: Try building with Python build | |
67 | if: runner.os != 'Windows' # setup.py does not support sdist on Windows |
|
67 | if: runner.os != 'Windows' # setup.py does not support sdist on Windows | |
68 | run: | |
|
68 | run: | | |
69 | python -m build |
|
69 | python -m build | |
70 | shasum -a 256 dist/* |
|
70 | shasum -a 256 dist/* | |
71 | - name: Check manifest |
|
71 | - name: Check manifest | |
72 | if: runner.os != 'Windows' # setup.py does not support sdist on Windows |
|
72 | if: runner.os != 'Windows' # setup.py does not support sdist on Windows | |
73 | run: check-manifest |
|
73 | run: check-manifest | |
74 | - name: pytest |
|
74 | - name: pytest | |
75 | env: |
|
75 | env: | |
76 | COLUMNS: 120 |
|
76 | COLUMNS: 120 | |
77 | run: | |
|
77 | run: | | |
78 | pytest --color=yes -raXxs ${{ startsWith(matrix.python-version, 'pypy') && ' ' || '--cov --cov-report=xml' }} |
|
78 | pytest --color=yes -raXxs ${{ startsWith(matrix.python-version, 'pypy') && ' ' || '--cov --cov-report=xml' }} | |
79 | - name: Upload coverage to Codecov |
|
79 | - name: Upload coverage to Codecov | |
80 |
uses: codecov/codecov-action@v |
|
80 | uses: codecov/codecov-action@v3 | |
|
81 | with: | |||
|
82 | name: Test | |||
|
83 | files: /home/runner/work/ipython/ipython/coverage.xml |
@@ -1,90 +1,118 | |||||
1 | ## Triaging Issues |
|
1 | ## Triaging Issues | |
2 |
|
2 | |||
3 | On the IPython repository, we strive to trust users and give them responsibility. |
|
3 | On the IPython repository, we strive to trust users and give them responsibility. | |
4 | By using one of our bots, any user can close issues or add/remove |
|
4 | By using one of our bots, any user can close issues or add/remove | |
5 | labels by mentioning the bot and asking it to do things on your behalf. |
|
5 | labels by mentioning the bot and asking it to do things on your behalf. | |
6 |
|
6 | |||
7 | To close an issue (or PR), even if you did not create it, use the following: |
|
7 | To close an issue (or PR), even if you did not create it, use the following: | |
8 |
|
8 | |||
9 | > @meeseeksdev close |
|
9 | > @meeseeksdev close | |
10 |
|
10 | |||
11 | This command can be in the middle of another comment, but must start on its |
|
11 | This command can be in the middle of another comment, but must start on its | |
12 | own line. |
|
12 | own line. | |
13 |
|
13 | |||
14 | To add labels to an issue, ask the bot to `tag` with a comma-separated list of |
|
14 | To add labels to an issue, ask the bot to `tag` with a comma-separated list of | |
15 | tags to add: |
|
15 | tags to add: | |
16 |
|
16 | |||
17 | > @meeseeksdev tag windows, documentation |
|
17 | > @meeseeksdev tag windows, documentation | |
18 |
|
18 | |||
19 | Only already pre-created tags can be added. So far, the list is limited to: |
|
19 | Only already pre-created tags can be added. So far, the list is limited to: | |
20 | `async/await`, `backported`, `help wanted`, `documentation`, `notebook`, |
|
20 | `async/await`, `backported`, `help wanted`, `documentation`, `notebook`, | |
21 | `tab-completion`, `windows` |
|
21 | `tab-completion`, `windows` | |
22 |
|
22 | |||
23 | To remove a label, use the `untag` command: |
|
23 | To remove a label, use the `untag` command: | |
24 |
|
24 | |||
25 | > @meeseeksdev untag windows, documentation |
|
25 | > @meeseeksdev untag windows, documentation | |
26 |
|
26 | |||
27 | We'll be adding additional capabilities for the bot and will share them here |
|
27 | We'll be adding additional capabilities for the bot and will share them here | |
28 | when they are ready to be used. |
|
28 | when they are ready to be used. | |
29 |
|
29 | |||
30 | ## Opening an Issue |
|
30 | ## Opening an Issue | |
31 |
|
31 | |||
32 | When opening a new Issue, please take the following steps: |
|
32 | When opening a new Issue, please take the following steps: | |
33 |
|
33 | |||
34 | 1. Search GitHub and/or Google for your issue to avoid duplicate reports. |
|
34 | 1. Search GitHub and/or Google for your issue to avoid duplicate reports. | |
35 | Keyword searches for your error messages are most helpful. |
|
35 | Keyword searches for your error messages are most helpful. | |
36 | 2. If possible, try updating to main and reproducing your issue, |
|
36 | 2. If possible, try updating to main and reproducing your issue, | |
37 | because we may have already fixed it. |
|
37 | because we may have already fixed it. | |
38 | 3. Try to include a minimal reproducible test case. |
|
38 | 3. Try to include a minimal reproducible test case. | |
39 | 4. Include relevant system information. Start with the output of: |
|
39 | 4. Include relevant system information. Start with the output of: | |
40 |
|
40 | |||
41 | python -c "import IPython; print(IPython.sys_info())" |
|
41 | python -c "import IPython; print(IPython.sys_info())" | |
42 |
|
42 | |||
43 | And include any relevant package versions, depending on the issue, such as |
|
43 | And include any relevant package versions, depending on the issue, such as | |
44 | matplotlib, numpy, Qt, Qt bindings (PyQt/PySide), tornado, web browser, etc. |
|
44 | matplotlib, numpy, Qt, Qt bindings (PyQt/PySide), tornado, web browser, etc. | |
45 |
|
45 | |||
46 | ## Pull Requests |
|
46 | ## Pull Requests | |
47 |
|
47 | |||
48 | Some guidelines on contributing to IPython: |
|
48 | Some guidelines on contributing to IPython: | |
49 |
|
49 | |||
50 | * All work is submitted via Pull Requests. |
|
50 | * All work is submitted via Pull Requests. | |
51 | * Pull Requests can be submitted as soon as there is code worth discussing. |
|
51 | * Pull Requests can be submitted as soon as there is code worth discussing. | |
52 | Pull Requests track the branch, so you can continue to work after the PR is submitted. |
|
52 | Pull Requests track the branch, so you can continue to work after the PR is submitted. | |
53 | Review and discussion can begin well before the work is complete, |
|
53 | Review and discussion can begin well before the work is complete, | |
54 | and the more discussion the better. |
|
54 | and the more discussion the better. | |
55 | The worst case is that the PR is closed. |
|
55 | The worst case is that the PR is closed. | |
56 | * Pull Requests should generally be made against main |
|
56 | * Pull Requests should generally be made against main | |
57 | * Pull Requests should be tested, if feasible: |
|
57 | * Pull Requests should be tested, if feasible: | |
58 | - bugfixes should include regression tests. |
|
58 | - bugfixes should include regression tests. | |
59 | - new behavior should at least get minimal exercise. |
|
59 | - new behavior should at least get minimal exercise. | |
60 | * New features and backwards-incompatible changes should be documented by adding |
|
60 | * New features and backwards-incompatible changes should be documented by adding | |
61 | a new file to the [pr](docs/source/whatsnew/pr) directory, see [the README.md |
|
61 | a new file to the [pr](docs/source/whatsnew/pr) directory, see [the README.md | |
62 | there](docs/source/whatsnew/pr/README.md) for details. |
|
62 | there](docs/source/whatsnew/pr/README.md) for details. | |
63 | * Don't make 'cleanup' pull requests just to change code style. |
|
63 | * Don't make 'cleanup' pull requests just to change code style. | |
64 | We don't follow any style guide strictly, and we consider formatting changes |
|
64 | We don't follow any style guide strictly, and we consider formatting changes | |
65 | unnecessary noise. |
|
65 | unnecessary noise. | |
66 | If you're making functional changes, you can clean up the specific pieces of |
|
66 | If you're making functional changes, you can clean up the specific pieces of | |
67 | code you're working on. |
|
67 | code you're working on. | |
68 |
|
68 | |||
69 | [Travis](http://travis-ci.org/#!/ipython/ipython) does a pretty good job testing |
|
69 | [GitHub Actions](https://github.com/ipython/ipython/actions/workflows/test.yml) does | |
70 | IPython and Pull Requests, but it may make sense to manually perform tests, |
|
70 | a pretty good job testing IPython and Pull Requests, | |
|
71 | but it may make sense to manually perform tests, | |||
71 | particularly for PRs that affect `IPython.parallel` or Windows. |
|
72 | particularly for PRs that affect `IPython.parallel` or Windows. | |
72 |
|
73 | |||
73 | For more detailed information, see our [GitHub Workflow](https://github.com/ipython/ipython/wiki/Dev:-GitHub-workflow). |
|
74 | For more detailed information, see our [GitHub Workflow](https://github.com/ipython/ipython/wiki/Dev:-GitHub-workflow). | |
74 |
|
75 | |||
75 | ## Running Tests |
|
76 | ## Running Tests | |
76 |
|
77 | |||
77 | All the tests can be run by using |
|
78 | All the tests can be run by using | |
78 | ```shell |
|
79 | ```shell | |
79 | pytest |
|
80 | pytest | |
80 | ``` |
|
81 | ``` | |
81 |
|
82 | |||
82 | All the tests for a single module (for example **test_alias**) can be run by using the fully qualified path to the module. |
|
83 | All the tests for a single module (for example **test_alias**) can be run by using the fully qualified path to the module. | |
83 | ```shell |
|
84 | ```shell | |
84 | pytest IPython/core/tests/test_alias.py |
|
85 | pytest IPython/core/tests/test_alias.py | |
85 | ``` |
|
86 | ``` | |
86 |
|
87 | |||
87 | Only a single test (for example **test_alias_lifecycle**) within a single file can be run by adding the specific test after a `::` at the end: |
|
88 | Only a single test (for example **test_alias_lifecycle**) within a single file can be run by adding the specific test after a `::` at the end: | |
88 | ```shell |
|
89 | ```shell | |
89 | pytest IPython/core/tests/test_alias.py::test_alias_lifecycle |
|
90 | pytest IPython/core/tests/test_alias.py::test_alias_lifecycle | |
90 | ``` |
|
91 | ``` | |
|
92 | ||||
|
93 | ## Code style | |||
|
94 | ||||
|
95 | * Before committing, run `darker -r 60625f241f298b5039cb2debc365db38aa7bb522 <file path>` to apply selective `black` formatting on modified regions using [darker](https://github.com/akaihola/darker). | |||
|
96 | * For newly added modules or refactors, please enable static typing analysis with `mypy` for the modified module by adding the file path in [`mypy.yml`](https://github.com/ipython/ipython/blob/main/.github/workflows/mypy.yml) workflow. | |||
|
97 | * As described in the pull requests section, please avoid excessive formatting changes; if a formatting-only commit is necessary, consider adding its hash to [`.git-blame-ignore-revs`](https://github.com/ipython/ipython/blob/main/.git-blame-ignore-revs) file. | |||
|
98 | ||||
|
99 | ## Documentation | |||
|
100 | ||||
|
101 | Sphinx documentation can be built locally using standard sphinx `make` commands. To build HTML documentation from the root of the project, execute: | |||
|
102 | ||||
|
103 | ```shell | |||
|
104 | pip install -r docs/requirements.txt # only needed once | |||
|
105 | make -C docs/ html SPHINXOPTS="-W" | |||
|
106 | ``` | |||
|
107 | ||||
|
108 | To force update of the API documentation, precede the `make` command with: | |||
|
109 | ||||
|
110 | ```shell | |||
|
111 | python3 docs/autogen_api.py | |||
|
112 | ``` | |||
|
113 | ||||
|
114 | Similarly, to force-update the configuration, run: | |||
|
115 | ||||
|
116 | ```shell | |||
|
117 | python3 docs/autogen_config.py | |||
|
118 | ``` |
@@ -1,174 +1,174 | |||||
1 | .. image:: https://codecov.io/github/ipython/ipython/coverage.svg?branch=main |
|
1 | .. image:: https://codecov.io/github/ipython/ipython/coverage.svg?branch=main | |
2 | :target: https://codecov.io/github/ipython/ipython?branch=main |
|
2 | :target: https://codecov.io/github/ipython/ipython?branch=main | |
3 |
|
3 | |||
4 | .. image:: https://img.shields.io/pypi/v/IPython.svg |
|
4 | .. image:: https://img.shields.io/pypi/v/IPython.svg | |
5 | :target: https://pypi.python.org/pypi/ipython |
|
5 | :target: https://pypi.python.org/pypi/ipython | |
6 |
|
6 | |||
7 | .. image:: https://github.com/ipython/ipython/actions/workflows/test.yml/badge.svg |
|
7 | .. image:: https://github.com/ipython/ipython/actions/workflows/test.yml/badge.svg | |
8 |
:target: https://github.com/ipython/ipython/actions/workflows/test.yml |
|
8 | :target: https://github.com/ipython/ipython/actions/workflows/test.yml | |
9 |
|
9 | |||
10 | .. image:: https://www.codetriage.com/ipython/ipython/badges/users.svg |
|
10 | .. image:: https://www.codetriage.com/ipython/ipython/badges/users.svg | |
11 | :target: https://www.codetriage.com/ipython/ipython/ |
|
11 | :target: https://www.codetriage.com/ipython/ipython/ | |
12 |
|
12 | |||
13 | .. image:: https://raster.shields.io/badge/Follows-NEP29-brightgreen.png |
|
13 | .. image:: https://raster.shields.io/badge/Follows-NEP29-brightgreen.png | |
14 | :target: https://numpy.org/neps/nep-0029-deprecation_policy.html |
|
14 | :target: https://numpy.org/neps/nep-0029-deprecation_policy.html | |
15 |
|
15 | |||
16 | .. image:: https://tidelift.com/badges/package/pypi/ipython?style=flat |
|
16 | .. image:: https://tidelift.com/badges/package/pypi/ipython?style=flat | |
17 | :target: https://tidelift.com/subscription/pkg/pypi-ipython |
|
17 | :target: https://tidelift.com/subscription/pkg/pypi-ipython | |
18 |
|
18 | |||
19 |
|
19 | |||
20 | =========================================== |
|
20 | =========================================== | |
21 | IPython: Productive Interactive Computing |
|
21 | IPython: Productive Interactive Computing | |
22 | =========================================== |
|
22 | =========================================== | |
23 |
|
23 | |||
24 | Overview |
|
24 | Overview | |
25 | ======== |
|
25 | ======== | |
26 |
|
26 | |||
27 | Welcome to IPython. Our full documentation is available on `ipython.readthedocs.io |
|
27 | Welcome to IPython. Our full documentation is available on `ipython.readthedocs.io | |
28 | <https://ipython.readthedocs.io/en/stable/>`_ and contains information on how to install, use, and |
|
28 | <https://ipython.readthedocs.io/en/stable/>`_ and contains information on how to install, use, and | |
29 | contribute to the project. |
|
29 | contribute to the project. | |
30 | IPython (Interactive Python) is a command shell for interactive computing in multiple programming languages, originally developed for the Python programming language, that offers introspection, rich media, shell syntax, tab completion, and history. |
|
30 | IPython (Interactive Python) is a command shell for interactive computing in multiple programming languages, originally developed for the Python programming language, that offers introspection, rich media, shell syntax, tab completion, and history. | |
31 |
|
31 | |||
32 | **IPython versions and Python Support** |
|
32 | **IPython versions and Python Support** | |
33 |
|
33 | |||
34 | Starting with IPython 7.10, IPython follows `NEP 29 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`_ |
|
34 | Starting with IPython 7.10, IPython follows `NEP 29 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`_ | |
35 |
|
35 | |||
36 | **IPython 7.17+** requires Python version 3.7 and above. |
|
36 | **IPython 7.17+** requires Python version 3.7 and above. | |
37 |
|
37 | |||
38 | **IPython 7.10+** requires Python version 3.6 and above. |
|
38 | **IPython 7.10+** requires Python version 3.6 and above. | |
39 |
|
39 | |||
40 | **IPython 7.0** requires Python version 3.5 and above. |
|
40 | **IPython 7.0** requires Python version 3.5 and above. | |
41 |
|
41 | |||
42 | **IPython 6.x** requires Python version 3.3 and above. |
|
42 | **IPython 6.x** requires Python version 3.3 and above. | |
43 |
|
43 | |||
44 | **IPython 5.x LTS** is the compatible release for Python 2.7. |
|
44 | **IPython 5.x LTS** is the compatible release for Python 2.7. | |
45 | If you require Python 2 support, you **must** use IPython 5.x LTS. Please |
|
45 | If you require Python 2 support, you **must** use IPython 5.x LTS. Please | |
46 | update your project configurations and requirements as necessary. |
|
46 | update your project configurations and requirements as necessary. | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | The Notebook, Qt console and a number of other pieces are now parts of *Jupyter*. |
|
49 | The Notebook, Qt console and a number of other pieces are now parts of *Jupyter*. | |
50 | See the `Jupyter installation docs <https://jupyter.readthedocs.io/en/latest/install.html>`__ |
|
50 | See the `Jupyter installation docs <https://jupyter.readthedocs.io/en/latest/install.html>`__ | |
51 | if you want to use these. |
|
51 | if you want to use these. | |
52 |
|
52 | |||
53 | Main features of IPython |
|
53 | Main features of IPython | |
54 | ======================== |
|
54 | ======================== | |
55 | Comprehensive object introspection. |
|
55 | Comprehensive object introspection. | |
56 |
|
56 | |||
57 | Input history, persistent across sessions. |
|
57 | Input history, persistent across sessions. | |
58 |
|
58 | |||
59 | Caching of output results during a session with automatically generated references. |
|
59 | Caching of output results during a session with automatically generated references. | |
60 |
|
60 | |||
61 | Extensible tab completion, with support by default for completion of python variables and keywords, filenames and function keywords. |
|
61 | Extensible tab completion, with support by default for completion of python variables and keywords, filenames and function keywords. | |
62 |
|
62 | |||
63 | Extensible system of βmagicβ commands for controlling the environment and performing many tasks related to IPython or the operating system. |
|
63 | Extensible system of βmagicβ commands for controlling the environment and performing many tasks related to IPython or the operating system. | |
64 |
|
64 | |||
65 | A rich configuration system with easy switching between different setups (simpler than changing $PYTHONSTARTUP environment variables every time). |
|
65 | A rich configuration system with easy switching between different setups (simpler than changing $PYTHONSTARTUP environment variables every time). | |
66 |
|
66 | |||
67 | Session logging and reloading. |
|
67 | Session logging and reloading. | |
68 |
|
68 | |||
69 | Extensible syntax processing for special purpose situations. |
|
69 | Extensible syntax processing for special purpose situations. | |
70 |
|
70 | |||
71 | Access to the system shell with user-extensible alias system. |
|
71 | Access to the system shell with user-extensible alias system. | |
72 |
|
72 | |||
73 | Easily embeddable in other Python programs and GUIs. |
|
73 | Easily embeddable in other Python programs and GUIs. | |
74 |
|
74 | |||
75 | Integrated access to the pdb debugger and the Python profiler. |
|
75 | Integrated access to the pdb debugger and the Python profiler. | |
76 |
|
76 | |||
77 |
|
77 | |||
78 | Development and Instant running |
|
78 | Development and Instant running | |
79 | =============================== |
|
79 | =============================== | |
80 |
|
80 | |||
81 | You can find the latest version of the development documentation on `readthedocs |
|
81 | You can find the latest version of the development documentation on `readthedocs | |
82 | <https://ipython.readthedocs.io/en/latest/>`_. |
|
82 | <https://ipython.readthedocs.io/en/latest/>`_. | |
83 |
|
83 | |||
84 | You can run IPython from this directory without even installing it system-wide |
|
84 | You can run IPython from this directory without even installing it system-wide | |
85 | by typing at the terminal:: |
|
85 | by typing at the terminal:: | |
86 |
|
86 | |||
87 | $ python -m IPython |
|
87 | $ python -m IPython | |
88 |
|
88 | |||
89 | Or see the `development installation docs |
|
89 | Or see the `development installation docs | |
90 | <https://ipython.readthedocs.io/en/latest/install/install.html#installing-the-development-version>`_ |
|
90 | <https://ipython.readthedocs.io/en/latest/install/install.html#installing-the-development-version>`_ | |
91 | for the latest revision on read the docs. |
|
91 | for the latest revision on read the docs. | |
92 |
|
92 | |||
93 | Documentation and installation instructions for older version of IPython can be |
|
93 | Documentation and installation instructions for older version of IPython can be | |
94 | found on the `IPython website <https://ipython.org/documentation.html>`_ |
|
94 | found on the `IPython website <https://ipython.org/documentation.html>`_ | |
95 |
|
95 | |||
96 |
|
96 | |||
97 |
|
97 | |||
98 | IPython requires Python version 3 or above |
|
98 | IPython requires Python version 3 or above | |
99 | ========================================== |
|
99 | ========================================== | |
100 |
|
100 | |||
101 | Starting with version 6.0, IPython does not support Python 2.7, 3.0, 3.1, or |
|
101 | Starting with version 6.0, IPython does not support Python 2.7, 3.0, 3.1, or | |
102 | 3.2. |
|
102 | 3.2. | |
103 |
|
103 | |||
104 | For a version compatible with Python 2.7, please install the 5.x LTS Long Term |
|
104 | For a version compatible with Python 2.7, please install the 5.x LTS Long Term | |
105 | Support version. |
|
105 | Support version. | |
106 |
|
106 | |||
107 | If you are encountering this error message you are likely trying to install or |
|
107 | If you are encountering this error message you are likely trying to install or | |
108 | use IPython from source. You need to checkout the remote 5.x branch. If you are |
|
108 | use IPython from source. You need to checkout the remote 5.x branch. If you are | |
109 | using git the following should work:: |
|
109 | using git the following should work:: | |
110 |
|
110 | |||
111 | $ git fetch origin |
|
111 | $ git fetch origin | |
112 | $ git checkout 5.x |
|
112 | $ git checkout 5.x | |
113 |
|
113 | |||
114 | If you encounter this error message with a regular install of IPython, then you |
|
114 | If you encounter this error message with a regular install of IPython, then you | |
115 | likely need to update your package manager, for example if you are using `pip` |
|
115 | likely need to update your package manager, for example if you are using `pip` | |
116 | check the version of pip with:: |
|
116 | check the version of pip with:: | |
117 |
|
117 | |||
118 | $ pip --version |
|
118 | $ pip --version | |
119 |
|
119 | |||
120 | You will need to update pip to the version 9.0.1 or greater. If you are not using |
|
120 | You will need to update pip to the version 9.0.1 or greater. If you are not using | |
121 | pip, please inquiry with the maintainers of the package for your package |
|
121 | pip, please inquiry with the maintainers of the package for your package | |
122 | manager. |
|
122 | manager. | |
123 |
|
123 | |||
124 | For more information see one of our blog posts: |
|
124 | For more information see one of our blog posts: | |
125 |
|
125 | |||
126 | https://blog.jupyter.org/release-of-ipython-5-0-8ce60b8d2e8e |
|
126 | https://blog.jupyter.org/release-of-ipython-5-0-8ce60b8d2e8e | |
127 |
|
127 | |||
128 | As well as the following Pull-Request for discussion: |
|
128 | As well as the following Pull-Request for discussion: | |
129 |
|
129 | |||
130 | https://github.com/ipython/ipython/pull/9900 |
|
130 | https://github.com/ipython/ipython/pull/9900 | |
131 |
|
131 | |||
132 | This error does also occur if you are invoking ``setup.py`` directly βΒ which you |
|
132 | This error does also occur if you are invoking ``setup.py`` directly βΒ which you | |
133 | should not βΒ or are using ``easy_install`` If this is the case, use ``pip |
|
133 | should not βΒ or are using ``easy_install`` If this is the case, use ``pip | |
134 | install .`` instead of ``setup.py install`` , and ``pip install -e .`` instead |
|
134 | install .`` instead of ``setup.py install`` , and ``pip install -e .`` instead | |
135 | of ``setup.py develop`` If you are depending on IPython as a dependency you may |
|
135 | of ``setup.py develop`` If you are depending on IPython as a dependency you may | |
136 | also want to have a conditional dependency on IPython depending on the Python |
|
136 | also want to have a conditional dependency on IPython depending on the Python | |
137 | version:: |
|
137 | version:: | |
138 |
|
138 | |||
139 | install_req = ['ipython'] |
|
139 | install_req = ['ipython'] | |
140 | if sys.version_info[0] < 3 and 'bdist_wheel' not in sys.argv: |
|
140 | if sys.version_info[0] < 3 and 'bdist_wheel' not in sys.argv: | |
141 | install_req.remove('ipython') |
|
141 | install_req.remove('ipython') | |
142 | install_req.append('ipython<6') |
|
142 | install_req.append('ipython<6') | |
143 |
|
143 | |||
144 | setup( |
|
144 | setup( | |
145 | ... |
|
145 | ... | |
146 | install_requires=install_req |
|
146 | install_requires=install_req | |
147 | ) |
|
147 | ) | |
148 |
|
148 | |||
149 | Alternatives to IPython |
|
149 | Alternatives to IPython | |
150 | ======================= |
|
150 | ======================= | |
151 |
|
151 | |||
152 | IPython may not be to your taste; if that's the case there might be similar |
|
152 | IPython may not be to your taste; if that's the case there might be similar | |
153 | project that you might want to use: |
|
153 | project that you might want to use: | |
154 |
|
154 | |||
155 | - The classic Python REPL. |
|
155 | - The classic Python REPL. | |
156 | - `bpython <https://bpython-interpreter.org/>`_ |
|
156 | - `bpython <https://bpython-interpreter.org/>`_ | |
157 | - `mypython <https://www.asmeurer.com/mypython/>`_ |
|
157 | - `mypython <https://www.asmeurer.com/mypython/>`_ | |
158 | - `ptpython and ptipython <https://pypi.org/project/ptpython/>`_ |
|
158 | - `ptpython and ptipython <https://pypi.org/project/ptpython/>`_ | |
159 | - `Xonsh <https://xon.sh/>`_ |
|
159 | - `Xonsh <https://xon.sh/>`_ | |
160 |
|
160 | |||
161 | Ignoring commits with git blame.ignoreRevsFile |
|
161 | Ignoring commits with git blame.ignoreRevsFile | |
162 | ============================================== |
|
162 | ============================================== | |
163 |
|
163 | |||
164 | As of git 2.23, it is possible to make formatting changes without breaking |
|
164 | As of git 2.23, it is possible to make formatting changes without breaking | |
165 | ``git blame``. See the `git documentation |
|
165 | ``git blame``. See the `git documentation | |
166 | <https://git-scm.com/docs/git-config#Documentation/git-config.txt-blameignoreRevsFile>`_ |
|
166 | <https://git-scm.com/docs/git-config#Documentation/git-config.txt-blameignoreRevsFile>`_ | |
167 | for more details. |
|
167 | for more details. | |
168 |
|
168 | |||
169 | To use this feature you must: |
|
169 | To use this feature you must: | |
170 |
|
170 | |||
171 | - Install git >= 2.23 |
|
171 | - Install git >= 2.23 | |
172 | - Configure your local git repo by running: |
|
172 | - Configure your local git repo by running: | |
173 | - POSIX: ``tools\configure-git-blame-ignore-revs.sh`` |
|
173 | - POSIX: ``tools\configure-git-blame-ignore-revs.sh`` | |
174 | - Windows: ``tools\configure-git-blame-ignore-revs.bat`` |
|
174 | - Windows: ``tools\configure-git-blame-ignore-revs.bat`` |
@@ -1,173 +1,172 | |||||
1 | .. _integrating: |
|
1 | .. _integrating: | |
2 |
|
2 | |||
3 | ===================================== |
|
3 | ===================================== | |
4 | Integrating your objects with IPython |
|
4 | Integrating your objects with IPython | |
5 | ===================================== |
|
5 | ===================================== | |
6 |
|
6 | |||
7 | Tab completion |
|
7 | Tab completion | |
8 | ============== |
|
8 | ============== | |
9 |
|
9 | |||
10 | To change the attributes displayed by tab-completing your object, define a |
|
10 | To change the attributes displayed by tab-completing your object, define a | |
11 | ``__dir__(self)`` method for it. For more details, see the documentation of the |
|
11 | ``__dir__(self)`` method for it. For more details, see the documentation of the | |
12 | built-in `dir() function <http://docs.python.org/library/functions.html#dir>`_. |
|
12 | built-in `dir() function <http://docs.python.org/library/functions.html#dir>`_. | |
13 |
|
13 | |||
14 | You can also customise key completions for your objects, e.g. pressing tab after |
|
14 | You can also customise key completions for your objects, e.g. pressing tab after | |
15 | ``obj["a``. To do so, define a method ``_ipython_key_completions_()``, which |
|
15 | ``obj["a``. To do so, define a method ``_ipython_key_completions_()``, which | |
16 | returns a list of objects which are possible keys in a subscript expression |
|
16 | returns a list of objects which are possible keys in a subscript expression | |
17 | ``obj[key]``. |
|
17 | ``obj[key]``. | |
18 |
|
18 | |||
19 | .. versionadded:: 5.0 |
|
19 | .. versionadded:: 5.0 | |
20 | Custom key completions |
|
20 | Custom key completions | |
21 |
|
21 | |||
22 | .. _integrating_rich_display: |
|
22 | .. _integrating_rich_display: | |
23 |
|
23 | |||
24 | Rich display |
|
24 | Rich display | |
25 | ============ |
|
25 | ============ | |
26 |
|
26 | |||
27 | Custom methods |
|
27 | Custom methods | |
28 | ---------------------- |
|
28 | ---------------------- | |
29 | IPython can display richer representations of objects. |
|
29 | IPython can display richer representations of objects. | |
30 | To do this, you can define ``_ipython_display_()``, or any of a number of |
|
30 | To do this, you can define ``_ipython_display_()``, or any of a number of | |
31 | ``_repr_*_()`` methods. |
|
31 | ``_repr_*_()`` methods. | |
32 | Note that these are surrounded by single, not double underscores. |
|
32 | Note that these are surrounded by single, not double underscores. | |
33 |
|
33 | |||
34 | .. list-table:: Supported ``_repr_*_`` methods |
|
34 | .. list-table:: Supported ``_repr_*_`` methods | |
35 | :widths: 20 15 15 15 |
|
35 | :widths: 20 15 15 15 | |
36 | :header-rows: 1 |
|
36 | :header-rows: 1 | |
37 |
|
37 | |||
38 | * - Format |
|
38 | * - Format | |
39 | - REPL |
|
39 | - REPL | |
40 | - Notebook |
|
40 | - Notebook | |
41 | - Qt Console |
|
41 | - Qt Console | |
42 | * - ``_repr_pretty_`` |
|
42 | * - ``_repr_pretty_`` | |
43 | - yes |
|
43 | - yes | |
44 | - yes |
|
44 | - yes | |
45 | - yes |
|
45 | - yes | |
46 | * - ``_repr_svg_`` |
|
46 | * - ``_repr_svg_`` | |
47 | - no |
|
47 | - no | |
48 | - yes |
|
48 | - yes | |
49 | - yes |
|
49 | - yes | |
50 | * - ``_repr_png_`` |
|
50 | * - ``_repr_png_`` | |
51 | - no |
|
51 | - no | |
52 | - yes |
|
52 | - yes | |
53 | - yes |
|
53 | - yes | |
54 | * - ``_repr_jpeg_`` |
|
54 | * - ``_repr_jpeg_`` | |
55 | - no |
|
55 | - no | |
56 | - yes |
|
56 | - yes | |
57 | - yes |
|
57 | - yes | |
58 | * - ``_repr_html_`` |
|
58 | * - ``_repr_html_`` | |
59 | - no |
|
59 | - no | |
60 | - yes |
|
60 | - yes | |
61 | - no |
|
61 | - no | |
62 | * - ``_repr_javascript_`` |
|
62 | * - ``_repr_javascript_`` | |
63 | - no |
|
63 | - no | |
64 | - yes |
|
64 | - yes | |
65 | - no |
|
65 | - no | |
66 | * - ``_repr_markdown_`` |
|
66 | * - ``_repr_markdown_`` | |
67 | - no |
|
67 | - no | |
68 | - yes |
|
68 | - yes | |
69 | - no |
|
69 | - no | |
70 | * - ``_repr_latex_`` |
|
70 | * - ``_repr_latex_`` | |
71 | - no |
|
71 | - no | |
72 | - yes |
|
72 | - yes | |
73 | - no |
|
73 | - no | |
74 | * - ``_repr_mimebundle_`` |
|
74 | * - ``_repr_mimebundle_`` | |
75 | - no |
|
75 | - no | |
76 | - ? |
|
76 | - ? | |
77 | - ? |
|
77 | - ? | |
78 |
|
78 | |||
79 | If the methods don't exist, or return ``None``, the standard ``repr()`` is used. |
|
79 | If the methods don't exist, or return ``None``, the standard ``repr()`` is used. | |
80 |
|
80 | |||
81 | For example:: |
|
81 | For example:: | |
82 |
|
82 | |||
83 | class Shout(object): |
|
83 | class Shout(object): | |
84 | def __init__(self, text): |
|
84 | def __init__(self, text): | |
85 | self.text = text |
|
85 | self.text = text | |
86 |
|
86 | |||
87 | def _repr_html_(self): |
|
87 | def _repr_html_(self): | |
88 | return "<h1>" + self.text + "</h1>" |
|
88 | return "<h1>" + self.text + "</h1>" | |
89 |
|
89 | |||
90 |
|
90 | |||
91 | Special methods |
|
91 | Special methods | |
92 | ^^^^^^^^^^^^^^^ |
|
92 | ^^^^^^^^^^^^^^^ | |
93 |
|
93 | |||
94 | Pretty printing |
|
94 | Pretty printing | |
95 | """"""""""""""" |
|
95 | """"""""""""""" | |
96 |
|
96 | |||
97 | To customize how your object is pretty-printed, add a ``_repr_pretty_`` method |
|
97 | To customize how your object is pretty-printed, add a ``_repr_pretty_`` method | |
98 | to the class. |
|
98 | to the class. | |
99 | The method should accept a pretty printer, and a boolean that indicates whether |
|
99 | The method should accept a pretty printer, and a boolean that indicates whether | |
100 | the printer detected a cycle. |
|
100 | the printer detected a cycle. | |
101 | The method should act on the printer to produce your customized pretty output. |
|
101 | The method should act on the printer to produce your customized pretty output. | |
102 | Here is an example:: |
|
102 | Here is an example:: | |
103 |
|
103 | |||
104 | class MyObject(object): |
|
104 | class MyObject(object): | |
105 |
|
105 | |||
106 | def _repr_pretty_(self, p, cycle): |
|
106 | def _repr_pretty_(self, p, cycle): | |
107 | if cycle: |
|
107 | if cycle: | |
108 | p.text('MyObject(...)') |
|
108 | p.text('MyObject(...)') | |
109 | else: |
|
109 | else: | |
110 | p.text('MyObject[...]') |
|
110 | p.text('MyObject[...]') | |
111 |
|
111 | |||
112 | For details on how to use the pretty printer, see :py:mod:`IPython.lib.pretty`. |
|
112 | For details on how to use the pretty printer, see :py:mod:`IPython.lib.pretty`. | |
113 |
|
113 | |||
114 | More powerful methods |
|
114 | More powerful methods | |
115 | """"""""""""""""""""" |
|
115 | """"""""""""""""""""" | |
116 |
|
116 | |||
117 | .. class:: MyObject |
|
117 | .. class:: MyObject | |
118 |
|
118 | |||
119 | .. method:: _repr_mimebundle_(include=None, exclude=None) |
|
119 | .. method:: _repr_mimebundle_(include=None, exclude=None) | |
120 |
|
120 | |||
121 | Should return a dictionary of multiple formats, keyed by mimetype, or a tuple |
|
121 | Should return a dictionary of multiple formats, keyed by mimetype, or a tuple | |
122 | of two dictionaries: *data, metadata* (see :ref:`Metadata`). |
|
122 | of two dictionaries: *data, metadata* (see :ref:`Metadata`). | |
123 | If this returns something, other ``_repr_*_`` methods are ignored. |
|
123 | If this returns something, other ``_repr_*_`` methods are ignored. | |
124 | The method should take keyword arguments ``include`` and ``exclude``, though |
|
124 | The method should take keyword arguments ``include`` and ``exclude``, though | |
125 | it is not required to respect them. |
|
125 | it is not required to respect them. | |
126 |
|
126 | |||
127 | .. method:: _ipython_display_() |
|
127 | .. method:: _ipython_display_() | |
128 |
|
128 | |||
129 | Displays the object as a side effect; the return value is ignored. If this |
|
129 | Displays the object as a side effect; the return value is ignored. If this | |
130 | is defined, all other display methods are ignored. |
|
130 | is defined, all other display methods are ignored. | |
131 | This method is ignored in the REPL. |
|
|||
132 |
|
131 | |||
133 |
|
132 | |||
134 | Metadata |
|
133 | Metadata | |
135 | ^^^^^^^^ |
|
134 | ^^^^^^^^ | |
136 |
|
135 | |||
137 | We often want to provide frontends with guidance on how to display the data. To |
|
136 | We often want to provide frontends with guidance on how to display the data. To | |
138 | support this, ``_repr_*_()`` methods (except ``_repr_pretty_``?) can also return a ``(data, metadata)`` |
|
137 | support this, ``_repr_*_()`` methods (except ``_repr_pretty_``?) can also return a ``(data, metadata)`` | |
139 | tuple where ``metadata`` is a dictionary containing arbitrary key-value pairs for |
|
138 | tuple where ``metadata`` is a dictionary containing arbitrary key-value pairs for | |
140 | the frontend to interpret. An example use case is ``_repr_jpeg_()``, which can |
|
139 | the frontend to interpret. An example use case is ``_repr_jpeg_()``, which can | |
141 | be set to return a jpeg image and a ``{'height': 400, 'width': 600}`` dictionary |
|
140 | be set to return a jpeg image and a ``{'height': 400, 'width': 600}`` dictionary | |
142 | to inform the frontend how to size the image. |
|
141 | to inform the frontend how to size the image. | |
143 |
|
142 | |||
144 |
|
143 | |||
145 |
|
144 | |||
146 | Formatters for third-party types |
|
145 | Formatters for third-party types | |
147 | -------------------------------- |
|
146 | -------------------------------- | |
148 |
|
147 | |||
149 | The user can also register formatters for types without modifying the class:: |
|
148 | The user can also register formatters for types without modifying the class:: | |
150 |
|
149 | |||
151 | from bar.baz import Foo |
|
150 | from bar.baz import Foo | |
152 |
|
151 | |||
153 | def foo_html(obj): |
|
152 | def foo_html(obj): | |
154 | return '<marquee>Foo object %s</marquee>' % obj.name |
|
153 | return '<marquee>Foo object %s</marquee>' % obj.name | |
155 |
|
154 | |||
156 | html_formatter = get_ipython().display_formatter.formatters['text/html'] |
|
155 | html_formatter = get_ipython().display_formatter.formatters['text/html'] | |
157 | html_formatter.for_type(Foo, foo_html) |
|
156 | html_formatter.for_type(Foo, foo_html) | |
158 |
|
157 | |||
159 | # Or register a type without importing it - this does the same as above: |
|
158 | # Or register a type without importing it - this does the same as above: | |
160 | html_formatter.for_type_by_name('bar.baz', 'Foo', foo_html) |
|
159 | html_formatter.for_type_by_name('bar.baz', 'Foo', foo_html) | |
161 |
|
160 | |||
162 | Custom exception tracebacks |
|
161 | Custom exception tracebacks | |
163 | =========================== |
|
162 | =========================== | |
164 |
|
163 | |||
165 | Rarely, you might want to display a custom traceback when reporting an |
|
164 | Rarely, you might want to display a custom traceback when reporting an | |
166 | exception. To do this, define the custom traceback using |
|
165 | exception. To do this, define the custom traceback using | |
167 | `_render_traceback_(self)` method which returns a list of strings, one string |
|
166 | `_render_traceback_(self)` method which returns a list of strings, one string | |
168 | for each line of the traceback. For example, the `ipyparallel |
|
167 | for each line of the traceback. For example, the `ipyparallel | |
169 | <https://ipyparallel.readthedocs.io/>`__ a parallel computing framework for |
|
168 | <https://ipyparallel.readthedocs.io/>`__ a parallel computing framework for | |
170 | IPython, does this to display errors from multiple engines. |
|
169 | IPython, does this to display errors from multiple engines. | |
171 |
|
170 | |||
172 | Please be conservative in using this feature; by replacing the default traceback |
|
171 | Please be conservative in using this feature; by replacing the default traceback | |
173 | you may hide important information from the user. |
|
172 | you may hide important information from the user. |
@@ -1,48 +1,40 | |||||
1 | [pytest] |
|
1 | [pytest] | |
2 | addopts = --durations=10 |
|
2 | addopts = --durations=10 | |
3 | -p IPython.testing.plugin.pytest_ipdoctest --ipdoctest-modules |
|
3 | -p IPython.testing.plugin.pytest_ipdoctest --ipdoctest-modules | |
4 | --ignore=docs |
|
4 | --ignore=docs | |
5 | --ignore=examples |
|
5 | --ignore=examples | |
6 | --ignore=htmlcov |
|
6 | --ignore=htmlcov | |
7 | --ignore=ipython_kernel |
|
7 | --ignore=ipython_kernel | |
8 | --ignore=ipython_parallel |
|
8 | --ignore=ipython_parallel | |
9 | --ignore=results |
|
9 | --ignore=results | |
10 | --ignore=tmp |
|
10 | --ignore=tmp | |
11 | --ignore=tools |
|
11 | --ignore=tools | |
12 | --ignore=traitlets |
|
12 | --ignore=traitlets | |
13 | --ignore=IPython/core/tests/daft_extension |
|
13 | --ignore=IPython/core/tests/daft_extension | |
14 | --ignore=IPython/sphinxext |
|
14 | --ignore=IPython/sphinxext | |
15 | --ignore=IPython/terminal/pt_inputhooks |
|
15 | --ignore=IPython/terminal/pt_inputhooks | |
16 | --ignore=IPython/__main__.py |
|
16 | --ignore=IPython/__main__.py | |
17 | --ignore=IPython/config.py |
|
|||
18 | --ignore=IPython/frontend.py |
|
|||
19 | --ignore=IPython/html.py |
|
|||
20 | --ignore=IPython/nbconvert.py |
|
|||
21 | --ignore=IPython/nbformat.py |
|
|||
22 | --ignore=IPython/parallel.py |
|
|||
23 | --ignore=IPython/qt.py |
|
|||
24 | --ignore=IPython/external/qt_for_kernel.py |
|
17 | --ignore=IPython/external/qt_for_kernel.py | |
25 | --ignore=IPython/html/widgets/widget_link.py |
|
18 | --ignore=IPython/html/widgets/widget_link.py | |
26 | --ignore=IPython/html/widgets/widget_output.py |
|
19 | --ignore=IPython/html/widgets/widget_output.py | |
27 | --ignore=IPython/terminal/console.py |
|
20 | --ignore=IPython/terminal/console.py | |
28 | --ignore=IPython/terminal/ptshell.py |
|
|||
29 | --ignore=IPython/utils/_process_cli.py |
|
21 | --ignore=IPython/utils/_process_cli.py | |
30 | --ignore=IPython/utils/_process_posix.py |
|
22 | --ignore=IPython/utils/_process_posix.py | |
31 | --ignore=IPython/utils/_process_win32.py |
|
23 | --ignore=IPython/utils/_process_win32.py | |
32 | --ignore=IPython/utils/_process_win32_controller.py |
|
24 | --ignore=IPython/utils/_process_win32_controller.py | |
33 | --ignore=IPython/utils/daemonize.py |
|
25 | --ignore=IPython/utils/daemonize.py | |
34 | --ignore=IPython/utils/eventful.py |
|
26 | --ignore=IPython/utils/eventful.py | |
35 |
|
27 | |||
36 | --ignore=IPython/kernel |
|
28 | --ignore=IPython/kernel | |
37 | --ignore=IPython/consoleapp.py |
|
29 | --ignore=IPython/consoleapp.py | |
38 | --ignore=IPython/core/inputsplitter.py |
|
30 | --ignore=IPython/core/inputsplitter.py | |
39 | --ignore=IPython/lib/kernel.py |
|
31 | --ignore=IPython/lib/kernel.py | |
40 | --ignore=IPython/utils/jsonutil.py |
|
32 | --ignore=IPython/utils/jsonutil.py | |
41 | --ignore=IPython/utils/localinterfaces.py |
|
33 | --ignore=IPython/utils/localinterfaces.py | |
42 | --ignore=IPython/utils/log.py |
|
34 | --ignore=IPython/utils/log.py | |
43 | --ignore=IPython/utils/signatures.py |
|
35 | --ignore=IPython/utils/signatures.py | |
44 | --ignore=IPython/utils/traitlets.py |
|
36 | --ignore=IPython/utils/traitlets.py | |
45 | --ignore=IPython/utils/version.py |
|
37 | --ignore=IPython/utils/version.py | |
46 | doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS |
|
38 | doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS | |
47 | ipdoctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS |
|
39 | ipdoctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS | |
48 | asyncio_mode = strict |
|
40 | asyncio_mode = strict |
@@ -1,251 +1,252 | |||||
1 | # Simple tool to help for release |
|
1 | # Simple tool to help for release | |
2 | # when releasing with bash, simple source it to get asked questions. |
|
2 | # when releasing with bash, simple source it to get asked questions. | |
3 |
|
3 | |||
4 | # misc check before starting |
|
4 | # misc check before starting | |
5 |
|
5 | |||
6 | python -c 'import keyring' |
|
6 | python -c 'import keyring' | |
7 | python -c 'import twine' |
|
7 | python -c 'import twine' | |
8 | python -c 'import sphinx' |
|
8 | python -c 'import sphinx' | |
9 | python -c 'import sphinx_rtd_theme' |
|
9 | python -c 'import sphinx_rtd_theme' | |
10 | python -c 'import pytest' |
|
10 | python -c 'import pytest' | |
|
11 | python -c 'import build' | |||
11 |
|
12 | |||
12 |
|
13 | |||
13 | BLACK=$(tput setaf 1) |
|
14 | BLACK=$(tput setaf 1) | |
14 | RED=$(tput setaf 1) |
|
15 | RED=$(tput setaf 1) | |
15 | GREEN=$(tput setaf 2) |
|
16 | GREEN=$(tput setaf 2) | |
16 | YELLOW=$(tput setaf 3) |
|
17 | YELLOW=$(tput setaf 3) | |
17 | BLUE=$(tput setaf 4) |
|
18 | BLUE=$(tput setaf 4) | |
18 | MAGENTA=$(tput setaf 5) |
|
19 | MAGENTA=$(tput setaf 5) | |
19 | CYAN=$(tput setaf 6) |
|
20 | CYAN=$(tput setaf 6) | |
20 | WHITE=$(tput setaf 7) |
|
21 | WHITE=$(tput setaf 7) | |
21 | NOR=$(tput sgr0) |
|
22 | NOR=$(tput sgr0) | |
22 |
|
23 | |||
23 |
|
24 | |||
24 | echo "Will use $BLUE'$EDITOR'$NOR to edit files when necessary" |
|
25 | echo "Will use $BLUE'$EDITOR'$NOR to edit files when necessary" | |
25 | echo -n "PREV_RELEASE (X.y.z) [$PREV_RELEASE]: " |
|
26 | echo -n "PREV_RELEASE (X.y.z) [$PREV_RELEASE]: " | |
26 | read input |
|
27 | read input | |
27 | PREV_RELEASE=${input:-$PREV_RELEASE} |
|
28 | PREV_RELEASE=${input:-$PREV_RELEASE} | |
28 | echo -n "MILESTONE (X.y) [$MILESTONE]: " |
|
29 | echo -n "MILESTONE (X.y) [$MILESTONE]: " | |
29 | read input |
|
30 | read input | |
30 | MILESTONE=${input:-$MILESTONE} |
|
31 | MILESTONE=${input:-$MILESTONE} | |
31 | echo -n "VERSION (X.y.z) [$VERSION]:" |
|
32 | echo -n "VERSION (X.y.z) [$VERSION]:" | |
32 | read input |
|
33 | read input | |
33 | VERSION=${input:-$VERSION} |
|
34 | VERSION=${input:-$VERSION} | |
34 | echo -n "BRANCH (main|X.y) [$BRANCH]:" |
|
35 | echo -n "BRANCH (main|X.y) [$BRANCH]:" | |
35 | read input |
|
36 | read input | |
36 | BRANCH=${input:-$BRANCH} |
|
37 | BRANCH=${input:-$BRANCH} | |
37 |
|
38 | |||
38 | ask_section(){ |
|
39 | ask_section(){ | |
39 | echo |
|
40 | echo | |
40 | echo $BLUE"$1"$NOR |
|
41 | echo $BLUE"$1"$NOR | |
41 | echo -n $GREEN"Press Enter to continue, S to skip: "$NOR |
|
42 | echo -n $GREEN"Press Enter to continue, S to skip: "$NOR | |
42 | if [ "$ZSH_NAME" = "zsh" ] ; then |
|
43 | if [ "$ZSH_NAME" = "zsh" ] ; then | |
43 | read -k1 value |
|
44 | read -k1 value | |
44 | value=${value%$'\n'} |
|
45 | value=${value%$'\n'} | |
45 | else |
|
46 | else | |
46 | read -n1 value |
|
47 | read -n1 value | |
47 | fi |
|
48 | fi | |
48 | if [ -z "$value" ] || [ $value = 'y' ]; then |
|
49 | if [ -z "$value" ] || [ $value = 'y' ]; then | |
49 | return 0 |
|
50 | return 0 | |
50 | fi |
|
51 | fi | |
51 | return 1 |
|
52 | return 1 | |
52 | } |
|
53 | } | |
53 |
|
54 | |||
54 |
|
55 | |||
55 | maybe_edit(){ |
|
56 | maybe_edit(){ | |
56 | echo |
|
57 | echo | |
57 | echo $BLUE"$1"$NOR |
|
58 | echo $BLUE"$1"$NOR | |
58 | echo -n $GREEN"Press ${BLUE}e$GREEN to Edit ${BLUE}$1$GREEN, any other keys to skip: "$NOR |
|
59 | echo -n $GREEN"Press ${BLUE}e$GREEN to Edit ${BLUE}$1$GREEN, any other keys to skip: "$NOR | |
59 | if [ "$ZSH_NAME" = "zsh" ] ; then |
|
60 | if [ "$ZSH_NAME" = "zsh" ] ; then | |
60 | read -k1 value |
|
61 | read -k1 value | |
61 | value=${value%$'\n'} |
|
62 | value=${value%$'\n'} | |
62 | else |
|
63 | else | |
63 | read -n1 value |
|
64 | read -n1 value | |
64 | fi |
|
65 | fi | |
65 |
|
66 | |||
66 | echo |
|
67 | echo | |
67 | if [ $value = 'e' ] ; then |
|
68 | if [ $value = 'e' ] ; then | |
68 | $=EDITOR $1 |
|
69 | $=EDITOR $1 | |
69 | fi |
|
70 | fi | |
70 | } |
|
71 | } | |
71 |
|
72 | |||
72 |
|
73 | |||
73 |
|
74 | |||
74 | echo |
|
75 | echo | |
75 | if ask_section "Updating what's new with information from docs/source/whatsnew/pr" |
|
76 | if ask_section "Updating what's new with information from docs/source/whatsnew/pr" | |
76 | then |
|
77 | then | |
77 | python tools/update_whatsnew.py |
|
78 | python tools/update_whatsnew.py | |
78 |
|
79 | |||
79 | echo |
|
80 | echo | |
80 | echo $BLUE"please move the contents of "docs/source/whatsnew/development.rst" to version-X.rst"$NOR |
|
81 | echo $BLUE"please move the contents of "docs/source/whatsnew/development.rst" to version-X.rst"$NOR | |
81 | echo $GREEN"Press enter to continue"$NOR |
|
82 | echo $GREEN"Press enter to continue"$NOR | |
82 | read |
|
83 | read | |
83 | fi |
|
84 | fi | |
84 |
|
85 | |||
85 | if ask_section "Gen Stats, and authors" |
|
86 | if ask_section "Gen Stats, and authors" | |
86 | then |
|
87 | then | |
87 |
|
88 | |||
88 | echo |
|
89 | echo | |
89 | echo $BLUE"here are all the authors that contributed to this release:"$NOR |
|
90 | echo $BLUE"here are all the authors that contributed to this release:"$NOR | |
90 | git log --format="%aN <%aE>" $PREV_RELEASE... | sort -u -f |
|
91 | git log --format="%aN <%aE>" $PREV_RELEASE... | sort -u -f | |
91 |
|
92 | |||
92 | echo |
|
93 | echo | |
93 | echo $BLUE"If you see any duplicates cancel (Ctrl-C), then edit .mailmap." |
|
94 | echo $BLUE"If you see any duplicates cancel (Ctrl-C), then edit .mailmap." | |
94 | echo $GREEN"Press enter to continue:"$NOR |
|
95 | echo $GREEN"Press enter to continue:"$NOR | |
95 | read |
|
96 | read | |
96 |
|
97 | |||
97 | echo $BLUE"generating stats"$NOR |
|
98 | echo $BLUE"generating stats"$NOR | |
98 | python tools/github_stats.py --milestone $MILESTONE > stats.rst |
|
99 | python tools/github_stats.py --milestone $MILESTONE > stats.rst | |
99 |
|
100 | |||
100 | echo $BLUE"stats.rst files generated."$NOR |
|
101 | echo $BLUE"stats.rst files generated."$NOR | |
101 | echo $GREEN"Please merge it with the right file (github-stats-X.rst) and commit."$NOR |
|
102 | echo $GREEN"Please merge it with the right file (github-stats-X.rst) and commit."$NOR | |
102 | echo $GREEN"press enter to continue."$NOR |
|
103 | echo $GREEN"press enter to continue."$NOR | |
103 | read |
|
104 | read | |
104 |
|
105 | |||
105 | fi |
|
106 | fi | |
106 |
|
107 | |||
107 | if ask_section "Generate API difference (using frapuccino)" |
|
108 | if ask_section "Generate API difference (using frapuccino)" | |
108 | then |
|
109 | then | |
109 | echo $BLUE"Checking out $PREV_RELEASE"$NOR |
|
110 | echo $BLUE"Checking out $PREV_RELEASE"$NOR | |
110 | git checkout $PREV_RELEASE |
|
111 | git checkout $PREV_RELEASE | |
111 | sleep 1 |
|
112 | sleep 1 | |
112 | echo $BLUE"Saving API to file $PREV_RELEASE"$NOR |
|
113 | echo $BLUE"Saving API to file $PREV_RELEASE"$NOR | |
113 | frappuccino IPython IPython.kernel IPython.lib IPython.qt IPython.lib.kernel IPython.html IPython.frontend IPython.external --save IPython-$PREV_RELEASE.json |
|
114 | frappuccino IPython IPython.kernel IPython.lib IPython.qt IPython.lib.kernel IPython.html IPython.frontend IPython.external --save IPython-$PREV_RELEASE.json | |
114 | echo $BLUE"coming back to $BRANCH"$NOR |
|
115 | echo $BLUE"coming back to $BRANCH"$NOR | |
115 | git checkout $BRANCH |
|
116 | git checkout $BRANCH | |
116 | sleep 1 |
|
117 | sleep 1 | |
117 | echo $BLUE"comparing ..."$NOR |
|
118 | echo $BLUE"comparing ..."$NOR | |
118 | frappuccino IPython IPython.kernel IPython.lib --compare IPython-$PREV_RELEASE.json |
|
119 | frappuccino IPython IPython.kernel IPython.lib --compare IPython-$PREV_RELEASE.json | |
119 | echo $GREEN"Use the above guideline to write an API changelog ..."$NOR |
|
120 | echo $GREEN"Use the above guideline to write an API changelog ..."$NOR | |
120 | echo $GREEN"Press any keys to continue"$NOR |
|
121 | echo $GREEN"Press any keys to continue"$NOR | |
121 | read |
|
122 | read | |
122 | fi |
|
123 | fi | |
123 |
|
124 | |||
124 | echo "Cleaning repository" |
|
125 | echo "Cleaning repository" | |
125 | git clean -xfdi |
|
126 | git clean -xfdi | |
126 |
|
127 | |||
127 | echo $GREEN"please update version number in ${RED}IPython/core/release.py${NOR} , Do not commit yet βΒ we'll do it later."$NOR |
|
128 | echo $GREEN"please update version number in ${RED}IPython/core/release.py${NOR} , Do not commit yet βΒ we'll do it later."$NOR | |
128 | echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py${NOR}" |
|
129 | echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py${NOR}" | |
129 | sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py |
|
130 | sed -i bkp -e '/Uncomment/s/^# //g' IPython/core/release.py | |
130 | rm IPython/core/release.pybkp |
|
131 | rm IPython/core/release.pybkp | |
131 | git diff | cat |
|
132 | git diff | cat | |
132 | maybe_edit IPython/core/release.py |
|
133 | maybe_edit IPython/core/release.py | |
133 |
|
134 | |||
134 | echo $GREEN"Press enter to continue"$NOR |
|
135 | echo $GREEN"Press enter to continue"$NOR | |
135 | read |
|
136 | read | |
136 |
|
137 | |||
137 | if ask_section "Build the documentation ?" |
|
138 | if ask_section "Build the documentation ?" | |
138 | then |
|
139 | then | |
139 | make html -C docs |
|
140 | make html -C docs | |
140 | echo |
|
141 | echo | |
141 | echo $GREEN"Check the docs, press enter to continue"$NOR |
|
142 | echo $GREEN"Check the docs, press enter to continue"$NOR | |
142 | read |
|
143 | read | |
143 |
|
144 | |||
144 | fi |
|
145 | fi | |
145 |
|
146 | |||
146 | if ask_section "Should we commit, tag, push... etc ? " |
|
147 | if ask_section "Should we commit, tag, push... etc ? " | |
147 | then |
|
148 | then | |
148 | echo |
|
149 | echo | |
149 | echo $BLUE"Let's commit : git commit -am \"release $VERSION\" -S" |
|
150 | echo $BLUE"Let's commit : git commit -am \"release $VERSION\" -S" | |
150 | echo $GREEN"Press enter to commit"$NOR |
|
151 | echo $GREEN"Press enter to commit"$NOR | |
151 | read |
|
152 | read | |
152 | git commit -am "release $VERSION" -S |
|
153 | git commit -am "release $VERSION" -S | |
153 |
|
154 | |||
154 | echo |
|
155 | echo | |
155 | echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR |
|
156 | echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR | |
156 | echo $GREEN"Make sure you can push"$NOR |
|
157 | echo $GREEN"Make sure you can push"$NOR | |
157 | echo $GREEN"Press enter to continue"$NOR |
|
158 | echo $GREEN"Press enter to continue"$NOR | |
158 | read |
|
159 | read | |
159 | git push origin $BRANCH |
|
160 | git push origin $BRANCH | |
160 |
|
161 | |||
161 | echo |
|
162 | echo | |
162 | echo "Let's tag : git tag -am \"release $VERSION\" \"$VERSION\" -s" |
|
163 | echo "Let's tag : git tag -am \"release $VERSION\" \"$VERSION\" -s" | |
163 | echo $GREEN"Press enter to tag commit"$NOR |
|
164 | echo $GREEN"Press enter to tag commit"$NOR | |
164 | read |
|
165 | read | |
165 | git tag -am "release $VERSION" "$VERSION" -s |
|
166 | git tag -am "release $VERSION" "$VERSION" -s | |
166 |
|
167 | |||
167 | echo |
|
168 | echo | |
168 | echo $BLUE"And push the tag: git push origin \$VERSION ?"$NOR |
|
169 | echo $BLUE"And push the tag: git push origin \$VERSION ?"$NOR | |
169 | echo $GREEN"Press enter to continue"$NOR |
|
170 | echo $GREEN"Press enter to continue"$NOR | |
170 | read |
|
171 | read | |
171 | git push origin $VERSION |
|
172 | git push origin $VERSION | |
172 |
|
173 | |||
173 |
|
174 | |||
174 | echo $GREEN"please update version number and back to .dev in ${RED}IPython/core/release.py" |
|
175 | echo $GREEN"please update version number and back to .dev in ${RED}IPython/core/release.py" | |
175 | echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py${NOR}" |
|
176 | echo $GREEN"I tried ${RED}sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py${NOR}" | |
176 | sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py |
|
177 | sed -i bkp -e '/Uncomment/s/^/# /g' IPython/core/release.py | |
177 | rm IPython/core/release.pybkp |
|
178 | rm IPython/core/release.pybkp | |
178 | git diff | cat |
|
179 | git diff | cat | |
179 | echo $GREEN"Please bump ${RED}the minor version number${NOR}" |
|
180 | echo $GREEN"Please bump ${RED}the minor version number${NOR}" | |
180 | maybe_edit IPython/core/release.py |
|
181 | maybe_edit IPython/core/release.py | |
181 | echo ${BLUE}"Do not commit yet βΒ we'll do it later."$NOR |
|
182 | echo ${BLUE}"Do not commit yet βΒ we'll do it later."$NOR | |
182 |
|
183 | |||
183 |
|
184 | |||
184 | echo $GREEN"Press enter to continue"$NOR |
|
185 | echo $GREEN"Press enter to continue"$NOR | |
185 | read |
|
186 | read | |
186 |
|
187 | |||
187 | echo |
|
188 | echo | |
188 | echo "Let's commit : "$BLUE"git commit -am \"back to dev\""$NOR |
|
189 | echo "Let's commit : "$BLUE"git commit -am \"back to dev\""$NOR | |
189 | echo $GREEN"Press enter to commit"$NOR |
|
190 | echo $GREEN"Press enter to commit"$NOR | |
190 | read |
|
191 | read | |
191 | git commit -am "back to dev" |
|
192 | git commit -am "back to dev" | |
192 |
|
193 | |||
193 | echo |
|
194 | echo | |
194 | echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR |
|
195 | echo $BLUE"git push origin \$BRANCH ($BRANCH)?"$NOR | |
195 | echo $GREEN"Press enter to continue"$NOR |
|
196 | echo $GREEN"Press enter to continue"$NOR | |
196 | read |
|
197 | read | |
197 | git push origin $BRANCH |
|
198 | git push origin $BRANCH | |
198 |
|
199 | |||
199 |
|
200 | |||
200 | echo |
|
201 | echo | |
201 | echo $BLUE"let's : git checkout $VERSION"$NOR |
|
202 | echo $BLUE"let's : git checkout $VERSION"$NOR | |
202 | echo $GREEN"Press enter to continue"$NOR |
|
203 | echo $GREEN"Press enter to continue"$NOR | |
203 | read |
|
204 | read | |
204 | git checkout $VERSION |
|
205 | git checkout $VERSION | |
205 | fi |
|
206 | fi | |
206 |
|
207 | |||
207 | if ask_section "Should we build and release ?" |
|
208 | if ask_section "Should we build and release ?" | |
208 | then |
|
209 | then | |
209 |
|
210 | |||
210 | echo $BLUE"going to set SOURCE_DATE_EPOCH"$NOR |
|
211 | echo $BLUE"going to set SOURCE_DATE_EPOCH"$NOR | |
211 | echo $BLUE'export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)'$NOR |
|
212 | echo $BLUE'export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD)'$NOR | |
212 | echo $GREEN"Press enter to continue"$NOR |
|
213 | echo $GREEN"Press enter to continue"$NOR | |
213 | read |
|
214 | read | |
214 |
|
215 | |||
215 | export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD) |
|
216 | export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD) | |
216 |
|
217 | |||
217 | echo $BLUE"SOURCE_DATE_EPOCH set to $SOURCE_DATE_EPOCH"$NOR |
|
218 | echo $BLUE"SOURCE_DATE_EPOCH set to $SOURCE_DATE_EPOCH"$NOR | |
218 | echo $GREEN"Press enter to continue"$NOR |
|
219 | echo $GREEN"Press enter to continue"$NOR | |
219 | read |
|
220 | read | |
220 |
|
221 | |||
221 |
|
222 | |||
222 |
|
223 | |||
223 | echo |
|
224 | echo | |
224 | echo $BLUE"Attempting to build package..."$NOR |
|
225 | echo $BLUE"Attempting to build package..."$NOR | |
225 |
|
226 | |||
226 | tools/release |
|
227 | tools/release | |
227 |
|
228 | |||
228 |
|
229 | |||
229 | echo $RED'$ shasum -a 256 dist/*' |
|
230 | echo $RED'$ shasum -a 256 dist/*' | |
230 | shasum -a 256 dist/* |
|
231 | shasum -a 256 dist/* | |
231 | echo $NOR |
|
232 | echo $NOR | |
232 |
|
233 | |||
233 | echo $BLUE"We are going to rebuild, node the hash above, and compare them to the rebuild"$NOR |
|
234 | echo $BLUE"We are going to rebuild, node the hash above, and compare them to the rebuild"$NOR | |
234 | echo $GREEN"Press enter to continue"$NOR |
|
235 | echo $GREEN"Press enter to continue"$NOR | |
235 | read |
|
236 | read | |
236 |
|
237 | |||
237 | echo |
|
238 | echo | |
238 | echo $BLUE"Attempting to build package..."$NOR |
|
239 | echo $BLUE"Attempting to build package..."$NOR | |
239 |
|
240 | |||
240 | tools/release |
|
241 | tools/release | |
241 |
|
242 | |||
242 | echo $RED"Check the shasum for SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" |
|
243 | echo $RED"Check the shasum for SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" | |
243 | echo $RED'$ shasum -a 256 dist/*' |
|
244 | echo $RED'$ shasum -a 256 dist/*' | |
244 | shasum -a 256 dist/* |
|
245 | shasum -a 256 dist/* | |
245 | echo $NOR |
|
246 | echo $NOR | |
246 |
|
247 | |||
247 | if ask_section "upload packages ?" |
|
248 | if ask_section "upload packages ?" | |
248 | then |
|
249 | then | |
249 | tools/release upload |
|
250 | tools/release upload | |
250 | fi |
|
251 | fi | |
251 | fi |
|
252 | fi |
General Comments 0
You need to be logged in to leave comments.
Login now