Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
GideonBear committed Feb 28, 2024
2 parents cd4edd0 + 7c22387 commit f6c94a1
Show file tree
Hide file tree
Showing 175 changed files with 10,873 additions and 3,117 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.9"]
python-version: ["3.10"]
include:
- os: macos-latest
python-version: "3.9"
python-version: "3.10"

steps:
- uses: actions/checkout@v3
Expand All @@ -43,10 +43,27 @@ jobs:
python -m pip install --upgrade -e file://$PWD#egg=ipython[test]
# we must install IPython after ipykernel to get the right versions.
python -m pip install --upgrade --upgrade-strategy eager flaky ipyparallel
python -m pip install --upgrade 'pytest<7'
- name: pytest
python -m pip install --upgrade 'pytest<7' 'pytest_asyncio<0.21'
- name: pytest ipykernel
env:
COLUMNS: 120
run: |
cd ../ipykernel
pytest
- name: Install sagemath-repl
run: |
cd ..
git clone --depth 1 https://github.com/sagemath/sage
cd sage
# We cloned it for the tests, but for simplicity we install the
# wheels from PyPI.
# (Avoid 10.3b6 because of https://github.com/sagemath/sage/pull/37178)
pip install --pre "sagemath-repl<10.3b6" "sagemath-environment<10.3b6"
# Install optionals that make more tests pass
pip install sagemath-categories pillow
cd ..
- name: Test sagemath-repl
run: |
cd ../sage/
# From https://github.com/sagemath/sage/blob/develop/pkgs/sagemath-repl/tox.ini
sage-runtests -p --environment=sage.all__sagemath_repl --baseline-stats-path=pkgs/sagemath-repl/known-test-failures.json --initial --optional=sage src/sage/repl src/sage/doctest src/sage/misc/sage_input.py src/sage/misc/sage_eval.py
9 changes: 5 additions & 4 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: ["3.x"]

steps:
- uses: actions/checkout@v3
Expand All @@ -26,12 +26,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mypy pyflakes flake8
pip install mypy pyflakes flake8 types-decorator
- name: Lint with mypy
run: |
mypy -p IPython.terminal
mypy -p IPython.core.magics
set -e
mypy IPython
- name: Lint with pyflakes
run: |
set -e
flake8 IPython/core/magics/script.py
flake8 IPython/core/magics/packaging.py
34 changes: 34 additions & 0 deletions .github/workflows/nightly-wheel-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Nightly Wheel builder
on:
workflow_dispatch:
schedule:
# this cron is ran every Sunday at midnight UTC
- cron: '0 0 * * 0'

jobs:
upload_anaconda:
name: Upload to Anaconda
runs-on: ubuntu-latest
# The artifacts cannot be uploaded on PRs
if: github.event_name != 'pull_request'

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: |
pyproject.toml
- name: Try building with Python build
if: runner.os != 'Windows' # setup.py does not support sdist on Windows
run: |
python -m pip install build
python -m build
- name: Upload wheel
uses: scientific-python/upload-nightly-action@main
with:
artifacts_path: dist
anaconda_nightly_upload_token: ${{secrets.UPLOAD_TOKEN}}
3 changes: 2 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install darker black==21.12b0
# when changing the versions please update CONTRIBUTING.md too
pip install --only-binary ':all:' darker==1.5.1 black==22.10.0
- name: Lint with darker
run: |
darker -r 60625f241f298b5039cb2debc365db38aa7bb522 --check --diff . || (
Expand Down
46 changes: 32 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,33 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.10", "3.11", "3.12"]
deps: [test_extra]
# Test all on ubuntu, test ends on macos
include:
- os: macos-latest
python-version: "3.8"
python-version: "3.10"
deps: test_extra
- os: macos-latest
python-version: "3.10"
python-version: "3.11"
deps: test_extra
# Tests minimal dependencies set
- os: ubuntu-latest
python-version: "3.10"
python-version: "3.11"
deps: test
# Tests latest development Python version
- os: ubuntu-latest
python-version: "3.11-dev"
python-version: "3.13-dev"
deps: test
# Installing optional dependencies stuff takes ages on PyPy
- os: ubuntu-latest
python-version: "pypy-3.8"
python-version: "pypy-3.10"
deps: test
- os: windows-latest
python-version: "pypy-3.8"
python-version: "pypy-3.10"
deps: test
- os: macos-latest
python-version: "pypy-3.8"
python-version: "pypy-3.10"
deps: test

steps:
Expand All @@ -55,14 +55,23 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
pyproject.toml
- name: Install latex
if: runner.os == 'Linux' && matrix.deps == 'test_extra'
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
- name: Install and update Python dependencies
- name: Install and update Python dependencies (binary only)
if: ${{ ! contains( matrix.python-version, 'dev' ) }}
run: |
python -m pip install --only-binary ':all:' --upgrade pip setuptools wheel build
python -m pip install --only-binary ':all:' --no-binary curio --upgrade -e .[${{ matrix.deps }}]
python -m pip install --only-binary ':all:' --upgrade check-manifest pytest-cov pytest-json-report 'pytest<8'
- name: Install and update Python dependencies (dev?)
if: ${{ contains( matrix.python-version, 'dev' ) }}
run: |
python -m pip install --upgrade pip setuptools wheel build
python -m pip install --upgrade -e .[${{ matrix.deps }}]
python -m pip install --upgrade check-manifest pytest-cov
python -m pip install --pre --upgrade pip setuptools wheel build
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --no-binary curio --upgrade -e .[${{ matrix.deps }}]
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple --upgrade check-manifest pytest-cov pytest-json-report
- name: Try building with Python build
if: runner.os != 'Windows' # setup.py does not support sdist on Windows
run: |
Expand All @@ -75,6 +84,15 @@ jobs:
env:
COLUMNS: 120
run: |
pytest --color=yes -raXxs ${{ startsWith(matrix.python-version, 'pypy') && ' ' || '--cov --cov-report=xml' }}
pytest --color=yes -raXxs ${{ startsWith(matrix.python-version, 'pypy') && ' ' || '--cov --cov-report=xml' }} --json-report --json-report-file=./report-${{ matrix.python-version }}-${{runner.os}}.json --maxfail=15
- uses: actions/upload-artifact@v3
with:
name: upload pytest timing reports as json
path: |
./report-*.json
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
name: Test
files: /home/runner/work/ipython/ipython/coverage.xml
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ docs/man/*.gz
docs/source/api/generated
docs/source/config/options
docs/source/config/shortcuts/*.csv
docs/source/config/shortcuts/table.tsv
docs/source/savefig
docs/source/interactive/magics-generated.txt
docs/gh-pages
Expand All @@ -24,9 +25,9 @@ __pycache__
.cache
.coverage
*.swp
.vscode
.pytest_cache
.python-version
.venv*/
venv*/
.mypy_cache/

Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/akaihola/darker
rev: 1.3.1
rev: 1.7.2
hooks:
- id: darker

additional_dependencies: [isort, mypy, flake8]
18 changes: 18 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"
apt_packages:
- graphviz

sphinx:
configuration: docs/source/conf.py

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
31 changes: 29 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ Some guidelines on contributing to IPython:
If you're making functional changes, you can clean up the specific pieces of
code you're working on.

[Travis](http://travis-ci.org/#!/ipython/ipython) does a pretty good job testing
IPython and Pull Requests, but it may make sense to manually perform tests,
[GitHub Actions](https://github.com/ipython/ipython/actions/workflows/test.yml) does
a pretty good job testing IPython and Pull Requests,
but it may make sense to manually perform tests,
particularly for PRs that affect `IPython.parallel` or Windows.

For more detailed information, see our [GitHub Workflow](https://github.com/ipython/ipython/wiki/Dev:-GitHub-workflow).
Expand All @@ -88,3 +89,29 @@ Only a single test (for example **test_alias_lifecycle**) within a single file c
```shell
pytest IPython/core/tests/test_alias.py::test_alias_lifecycle
```

## Code style

* Before committing, run `darker -r 60625f241f298b5039cb2debc365db38aa7bb522 <file path>` to apply selective `black` formatting on modified regions using [darker](https://github.com/akaihola/darker)==1.5.1 and black==22.10.0
* 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.

## Documentation

Sphinx documentation can be built locally using standard sphinx `make` commands. To build HTML documentation from the root of the project, execute:

```shell
pip install -r docs/requirements.txt # only needed once
make -C docs/ html SPHINXOPTS="-W"
```

To force update of the API documentation, precede the `make` command with:

```shell
python3 docs/autogen_api.py
```

Similarly, to force-update the configuration, run:

```shell
python3 docs/autogen_config.py
```
22 changes: 15 additions & 7 deletions IPython/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# PYTHON_ARGCOMPLETE_OK
"""
IPython: tools for interactive and parallel computing in Python.
Expand Down Expand Up @@ -25,10 +26,12 @@
#-----------------------------------------------------------------------------

# Don't forget to also update setup.py when this changes!
if sys.version_info < (3, 8):
if sys.version_info < (3, 10):
raise ImportError(
"""
IPython 8+ supports Python 3.8 and above, following NEP 29.
IPython 8.19+ supports Python 3.10 and above, following SPEC0.
IPython 8.13+ supports Python 3.9 and above, following NEP 29.
IPython 8.0-8.12 supports Python 3.8 and above, following NEP 29.
When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
Python 3.3 and 3.4 were supported up to IPython 6.x.
Python 3.5 was supported with IPython 7.0 to 7.9.
Expand All @@ -55,14 +58,16 @@
from .utils.sysinfo import sys_info
from .utils.frame import extract_module_locals

__all__ = ["start_ipython", "embed", "start_kernel", "embed_kernel"]

# Release data
__author__ = '%s <%s>' % (release.author, release.author_email)
__license__ = release.license
__version__ = release.version
version_info = release.version_info
# list of CVEs that should have been patched in this release.
# this is informational and should not be relied upon.
__patched_cves__ = {"CVE-2022-21699"}
__patched_cves__ = {"CVE-2022-21699", "CVE-2023-24816"}


def embed_kernel(module=None, local_ns=None, **kwargs):
Expand All @@ -81,7 +86,8 @@ def embed_kernel(module=None, local_ns=None, **kwargs):
The namespace to load into IPython user namespace (default: caller)
**kwargs : various, optional
Further keyword args are relayed to the IPKernelApp constructor,
allowing configuration of the Kernel. Will only have an effect
such as `config`, a traitlets :class:`Config` object (see :ref:`configure_start_ipython`),
allowing configuration of the kernel (see :ref:`kernel_options`). Will only have an effect
on the first embed_kernel call for a given process.
"""

Expand Down Expand Up @@ -117,7 +123,8 @@ def start_ipython(argv=None, **kwargs):
specify this dictionary to initialize the IPython user namespace with particular values.
**kwargs : various, optional
Any other kwargs will be passed to the Application constructor,
such as `config`.
such as `config`, a traitlets :class:`Config` object (see :ref:`configure_start_ipython`),
allowing configuration of the instance (see :ref:`terminal_options`).
"""
from IPython.terminal.ipapp import launch_new_instance
return launch_new_instance(argv=argv, **kwargs)
Expand All @@ -131,7 +138,7 @@ def start_kernel(argv=None, **kwargs):
`start_kernel()` does full, regular IPython initialization,
including loading startup files, configuration, etc.
much of which is skipped by `embed()`.
much of which is skipped by `embed_kernel()`.
Parameters
----------
Expand All @@ -142,7 +149,8 @@ def start_kernel(argv=None, **kwargs):
specify this dictionary to initialize the IPython user namespace with particular values.
**kwargs : various, optional
Any other kwargs will be passed to the Application constructor,
such as `config`.
such as `config`, a traitlets :class:`Config` object (see :ref:`configure_start_ipython`),
allowing configuration of the kernel (see :ref:`kernel_options`).
"""
import warnings

Expand Down
5 changes: 3 additions & 2 deletions IPython/__main__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# PYTHON_ARGCOMPLETE_OK
# encoding: utf-8
"""Terminal-based IPython entry point.
"""
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Copyright (c) 2012, IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------

from IPython import start_ipython

Expand Down
Loading

0 comments on commit f6c94a1

Please sign in to comment.