Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: j178/prek-action@4e14d07f9231acabce116ccfca13b13dd9755ece # v3.0.0
- uses: j178/prek-action@1382ad72dea72f9d53832f2bcb65b3e87a947204 # v3.0.1

docs:
name: Build docs and check links
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ jobs:
path: docs/_build/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
2 changes: 1 addition & 1 deletion .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ jobs:
persist-credentials: false

- name: Run zizmor
uses: zizmorcore/zizmor-action@70fb788f84895a7701f5643d103d587e460b5c99 # v0.6.3
uses: zizmorcore/zizmor-action@85b2b9fb8e3325e7a23d7d0a9d7ba5ae0f999e3e # v0.7.1
with:
persona: pedantic
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0
rev: v6.0.0 # v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -15,31 +15,31 @@ repos:
- id: check-added-large-files
args: ['--maxkb=1024']
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 3b42b9776870badc9eaffdef9a4a0834b764d87c # frozen: v2.29.3
rev: 50e0f3aee9dc5747a5f173f79a7417403c18dda6 # frozen: v2.30.3
hooks:
- id: pyproject-fmt
- repo: https://github.com/abravalheri/validate-pyproject
rev: 17e12779811926f000bdfa1795f9e3735dd71ac3 # frozen: 0.26
rev: 82d21874c3242e4dc27bb47641c996902ef64eef # frozen: v0.27
hooks:
- id: validate-pyproject
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: c883505f64b59c3c5c9375191e4ad9f98e727ccd # v1.0.2
rev: v1.0.2 # v1.0.2
hooks:
- id: sphinx-lint
types: [rst]
- repo: https://github.com/pycqa/isort
rev: 131f4adcd5582bfc53928ab0d740eceb8b506b6c # frozen: 9.0.1
rev: 5d9c96196def28a1819b6a755a669ec0a3add6aa # frozen: 10.0.0b2
hooks:
- id: isort
additional_dependencies: ["toml"]
entry: isort --profile=black
name: isort (python)
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 4160603246a6b365d4a2af661c6d71b0a0f50478 # 26.5.1
rev: a5439e9af2ff9371297bb1a76a01b8ad17989b88 # frozen: 26.10.1
hooks:
- id: black
- repo: https://github.com/adamchainz/blacken-docs
rev: fda77690955e9b63c6687d8806bafd56a526e45f # 1.20.0
rev: 1.20.0 # 1.20.0
hooks:
- id: blacken-docs
args: [--line-length=79]
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.14
3.15
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build:
- plantuml

tools:
python: "3.14"
python: latest

python:
# See https://docs.readthedocs.com/platform/stable/build-customization.html#install-dependencies-with-uv
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ emergencies when we need to start branches for older versions.
Added
~~~~~

* 📝 Add what’s new in Python 3.15

* Add lacy imports
* Add frozendict
* Add unpacking in comprehensions

* 📝 Add timezones
* 📝 Add pytest-leak-finder

Expand Down
16 changes: 8 additions & 8 deletions docs/appendix/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -682,20 +682,20 @@ Glossary

Various modules are available in Python:

:doc:`/test/unittest`
:doc:`/test/libs/unittest`
supports you in the automation of tests.
:doc:`/test/mock/index`
:doc:`/test/libs/mock/index`
allows you to create and use :term:`Mock` objects.
:doc:`../document/doctest`
allows you to test tests written in Python :term:`docstrings
<Docstring>`.
:doc:`/test/tox`
:doc:`/test/libs/tox`
allows you to test in different environments.

Blackbox test
is developed without knowledge of the source code. In addition to
:doc:`/test/unittest`, :doc:`/test/hypothesis` can also be used for such
tests in Python.
:doc:`/test/libs/unittest`, :doc:`/test/libs/hypothesis` can also be used
for such tests in Python.

``assert``
A keyword that stops code execution if its argument is false.
Expand Down Expand Up @@ -739,8 +739,8 @@ Glossary
correct methods were called.

The Python library for mocks is :doc:`unittest.mock
<../test/mock/index>`. It is also supported by
:doc:`../test/pytest/index`. Alternatively, however, you can also use
<../test/lib/mock/index>`. It is also supported by
:doc:`../test/lib/pytest/index`. Alternatively, however, you can also use
`pytest-mock <https://pypi.org/project/pytest-mock/>`_.

.. seealso::
Expand Down Expand Up @@ -782,7 +782,7 @@ Glossary
These three steps are often summarised as *‘Red – Green – Refactor’*.

.. seealso::
* :doc:`../test/tdd`
* :doc:`../test/methods/tdd`
* `Canon TDD <https://tidyfirst.substack.com/p/canon-tdd>`_ by Kent
Beck
* `Test-driven development by example
Expand Down
21 changes: 21 additions & 0 deletions docs/control-flow/loops.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,27 @@ Das allgemeine Format für Dict Comprehensions ist:

:samp:`{NEW_DICT} = \{{KEY}: {VALUE} for {MEMBER} in {ITERABLE}\}`

.. _unpacking_in_comprehensions:

Unpack
~~~~~~

.. versionadded:: 3.15

In line with :pep:`798`, :doc:`../types/sequences-sets/lists`,
:doc:`../types/sequences-sets/sets` and :doc:`../types/dicts` now support
comprehensions using ``*`` and ``**``:

.. code-block:: pycon

>>> nested_list = [[0, 1], [2, 3], [4, 5]]
>>> [*l for l in nested_list]
[0, 1, 2, 3, 4, 5]
>>>
>>> nested_dict = [{0: "a"}, {1: "b"}, {2: "c"}]
>>> {**d for d in nested_dict}
{0: 'a', 1: 'b', 2: 'c'}

Change a ``Collection``
~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
8 changes: 4 additions & 4 deletions docs/document/sphinx/test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Continuous integration

If necessary, you can also check automatically in your :term:`CI` pipeline
whether the documentation is being built and the links are valid. In
:doc:`../../test/tox`, the configuration can be added as follows:
:doc:`../../test/libs/tox`, the configuration can be added as follows:

.. code-block:: ini
:caption: tox.ini
Expand Down Expand Up @@ -160,7 +160,7 @@ configuration:
With :doc:`Sybil:index` you can not only check :doc:`rest`, but also
:doc:`Markdown <Sybil:markdown>` and :doc:`Myst <Sybil:myst>`, for example.
Sybil can also check code blocks in the documentation with either
:doc:`../../test/pytest/index` or :doc:`../../test/unittest`.
:doc:`../../test/pytest/libs/index` or :doc:`../../test/libs/unittest`.

.. _test_code:

Expand Down Expand Up @@ -369,8 +369,8 @@ example:

* `Configuration <https://interrogate.readthedocs.io/en/latest/index.html#configuration>`_

You can now insert ``interrogate`` into your :doc:`../../test/tox` file, for
example with
You can now insert ``interrogate`` into your :doc:`../../test/libs/tox` file,
for example with

.. code-block:: ini
:caption: tox.ini
Expand Down
20 changes: 10 additions & 10 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Installation

Installing Python can be easy. The first step is to download the latest version
from `www.python.org/downloads <https://www.python.org/downloads/>`_. The
tutorial is based on Python 3.14.0, but if you have Python 3.10 or newer
installed, this should not be a problem.
tutorial is based on Python 3.15.0, but if you have Python 3.11 or newer
installed, this usually isn’t a problem either.

.. tab:: Linux

Expand All @@ -19,9 +19,9 @@ installed, this should not be a problem.

.. code-block:: console

$ wget https://www.python.org/ftp/python/3.14.0/Python-3.14.0.tgz
$ tar xf Python-3.14.0.tgz
$ cd Python-3.14.0
$ wget https://www.python.org/ftp/python/3.15.0/Python-3.15.0.tgz
$ tar xf Python-3.15.0.tgz
$ cd Python-3.15.0
$ ./configure --enable-optimizations
$ sudo make altinstall

Expand Down Expand Up @@ -51,11 +51,11 @@ installed, this should not be a problem.

#. Download the latest Python Releases for Windows installer, for example
`Windows installer (64-bit)
<https://www.python.org/ftp/python/3.14.0/python-3.14.0-amd64.exe>`_.
<https://www.python.org/ftp/python/3.15.0/python-3.15.0-amd64.exe>`_.
#. Start the installation programme. If you have the necessary
authorisations, install Python with the option *Install launcher for all
users*. This should install Python in
:file:`C:\\Program Files\\Python314-64`. In addition, *Add Python 3.14 to
:file:`C:\\Program Files\\Python315-64`. In addition, *Add Python 3.15 to
PATH* should be activated so that this path to the Python installation is
also entered in the list of ``PATH`` environment variables.
#. Finally, you can now check the installation by entering the following in
Expand All @@ -64,7 +64,7 @@ installed, this should not be a problem.
.. code-block:: ps1con

C:\> python -V
Python 3.14.0
Python 3.15.0

.. warning::
One disadvantage is that you have to return to the website regularly to
Expand All @@ -75,8 +75,8 @@ installed, this should not be a problem.
If different Python versions are required, for example to test libraries with
:doc:`test/tox`, I use :term:`uv`. This allows not only older CPython versions
to be installed but also `PyPy <https://pypy.org>`_ or free-threaded Python
3.14 with ``uv python install pypy@3.14`` or ``uv python install
--python-preference only-managed 3.14t``.
3.14 with ``uv python install pypy@3.15`` or ``uv python install
--python-preference only-managed 3.15t``.

.. tip::
`direnv <https://direnv.net>`_ allows you to set environment variables
Expand Down
2 changes: 1 addition & 1 deletion docs/libs/batteries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Developing and debugging
+-----------------------------------+-------------------------------------------------------------------------------+
| :py:mod:`doctest` | Test examples from Python docstrings |
+-----------------------------------+-------------------------------------------------------------------------------+
| :py:mod:`unittest` | Framework for unittests, see also :doc:`/test/unittest` |
| :py:mod:`unittest` | Framework for unittests, see also :doc:`/test/libs/unittest` |
+-----------------------------------+-------------------------------------------------------------------------------+
| :py:mod:`test.support` | Utility functions for tests |
+-----------------------------------+-------------------------------------------------------------------------------+
Expand Down
38 changes: 38 additions & 0 deletions docs/modules/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,44 @@ provided via special modules that you can load as needed.
.. seealso::
* :ref:`python3:py-modindex`

.. _explicit-lazy-imports:

.. versionadded:: 3.15

Python 3.15 introduces explicit lazy imports via :pep:`810`: if an ``import``
statement is prefixed with the keyword ``lazy``, the module is not loaded
immediately; instead, a proxy object is created. The actual module is loaded
the first time it is used:

.. code-block:: pycon

>>> import sys
>>> lazy import json
>>> lazy from pathlib import Path
>>> "json" in sys.modules
False
>>> with Path.open("books.json") as f:
... data = json.load(f)
...
>>> "json" in sys.modules
True

If you cannot use ``lazy`` directly, for example in older versions of Python,
you can define a :attr:`~module.__lazy_modules__` module as a container whose
import statements are handled by ``lazy``:

.. code-block:: pycon

>>> __lazy_modules__ = {"json"}
>>> import json
>>> import sys

Python 3.14 and earlier ignore ``__lazy_modules__``, whilst 3.15 and later
use the ``lazy`` variant.

.. seealso::
* :ref:`lazy-imports`

Creating modules
----------------

Expand Down
4 changes: 2 additions & 2 deletions docs/packs/apps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ specific version.
security vulnerabilities needs to be replaced with a more recent version as
quickly as possible, the *dependency cooldowns* can be bypassed using

.. code-block:: console
.. code-block:: toml

$ uv sync --exclude-newer-package "{PACKAGE}=P0D"
exclude-newer-package = { PACKAGE = "P0D" }

.. tip::
You can also use :doc:`Python4DataScience:productive/git/advanced/hooks/prek`
Expand Down
4 changes: 2 additions & 2 deletions docs/packs/dataprep/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ readme = "README.rst"
authors = [
{ name = "Veit Schiele", email = "veit@cusy.io" },
]
requires-python = ">=3.10"
requires-python = ">=3.11"
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
]
dependencies = [
"cython",
Expand Down
1 change: 1 addition & 0 deletions docs/packs/myapp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
]
dependencies = []
scripts.myapp = "myapp:main"
1 change: 1 addition & 0 deletions docs/packs/mypack/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
]
dependencies = []
scripts.mypack = "mypack:main"
4 changes: 2 additions & 2 deletions docs/packs/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.cibuildwheel]
test-requires = "pytest"
test-command = "pytest {project}/tests"
build-verbosity = 1
test-command = "pytest {project}/tests"
test-requires = "pytest"
# support Universal2 for Apple Silicon:
macos.archs = [ "auto", "universal2" ]
macos.test-skip = [ "*universal2:arm64" ]
9 changes: 2 additions & 7 deletions docs/test/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,5 @@ Basically, a distinction is made between static and dynamic test procedures.
:titlesonly:
:hidden:

unittest
pytest/index
tox
mock/index
hypothesis
tdd
bdd
libs/index
methods/index
File renamed without changes
6 changes: 3 additions & 3 deletions docs/test/hypothesis.rst → docs/test/libs/hypothesis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ Example using ``strategies`` and ``given``
:lineno-start: 1

#. For our test, we will now use ``hypothesis.given`` as a :doc:`dekorator
<../functions/decorators>` to convert the test function into a parameterised
one, which is then executed with a wide range of suitable data:
<../../functions/decorators>` to convert the test function into a
parameterised one, which is then executed with a wide range of suitable data:

.. literalinclude:: test_hypothesis.py
:language: python
Expand Down Expand Up @@ -177,7 +177,7 @@ Example with regular expressions

#. In the following example, we attempt to extract the ``username`` and
``domain`` with a :doc:`regular expression
<../types/strings/built-in-modules/regex>` from an email address using:
<../../types/strings/built-in-modules/regex>` from an email address using:

.. literalinclude:: test_emails.py
:lines: 1, 5-9
Expand Down
Loading
Loading