Skip to content

Commit 085e3c6

Browse files
authored
Merge pull request #346 from MSeifert04/python-3.13-removed-pyarg-parsestack
Version 0.13: Python 3.13 compatibility and minor updates
2 parents d3df1a7 + fb458c1 commit 085e3c6

File tree

17 files changed

+48
-42
lines changed

17 files changed

+48
-42
lines changed

.github/workflows/cpython-benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ jobs:
4545
uses: actions/upload-artifact@v4
4646
with:
4747
name: py3.12-benchmarks
48-
path: ./.benchmark_results/
48+
path: ./benchmark_results/

.github/workflows/cpython.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,45 +37,45 @@ jobs:
3737
run: |
3838
python -m pytest tests/
3939
40-
build-python-with-debug:
40+
build-python3-13-with-debug:
4141
runs-on: ubuntu-latest
4242
timeout-minutes: 10
4343
steps:
4444
- name: Check out source
4545
uses: actions/checkout@v4
4646
with:
4747
fetch-depth: 1
48-
- name: Download Python 3.12
48+
- name: Download Python
4949
run: |
50-
wget https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tgz -q
51-
python3 ci/verify_checksum.py Python-3.12.2.tgz 4e64a004f8ad9af1a75607cfd0d5a8c8
52-
- name: Install Python 3.12
50+
wget https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz -q
51+
python3 ci/verify_checksum.py Python-3.13.0.tgz c29f37220520ec6075fc37d4c62e178b
52+
- name: Install Python
5353
run: |
54-
tar xzf Python-3.12.2.tgz
55-
cd Python-3.12.2
54+
tar xzf Python-3.13.0.tgz
55+
cd Python-3.13.0
5656
./configure --with-pydebug
5757
sudo make altinstall -s -j2
5858
- name: Remove download
5959
run: |
60-
sudo python3.12 -c "import os; os.remove('./Python-3.12.2.tgz'); import shutil; shutil.rmtree('./Python-3.12.2/')"
60+
sudo python3.13 -c "import os; os.remove('./Python-3.13.0.tgz'); import shutil; shutil.rmtree('./Python-3.13.0/')"
6161
- name: Install dependencies
6262
run: |
63-
python3.12 -m pip install pip setuptools wheel --upgrade --user --no-warn-script-location
63+
python3.13 -m pip install pip setuptools wheel --upgrade --user --no-warn-script-location
6464
- name: Create wheel
6565
run: |
66-
python3.12 -m pip wheel . --no-deps --wheel-dir=./wheelhouse/ -vv
66+
python3.13 -m pip wheel . --no-deps --wheel-dir=./wheelhouse/ -vv
6767
- name: Install package
6868
run: |
69-
python3.12 -m pip install iteration_utilities --no-index --find-links=./wheelhouse/ --user -vv
69+
python3.13 -m pip install iteration_utilities --no-index --find-links=./wheelhouse/ --user -vv
7070
- name: Import package
7171
run: |
72-
python3.12 -c "import iteration_utilities"
72+
python3.13 -c "import iteration_utilities"
7373
- name: Install test dependencies
7474
run: |
75-
python3.12 -m pip install pytest --user --no-warn-script-location
75+
python3.13 -m pip install pytest --user --no-warn-script-location
7676
- name: Run tests
7777
run: |
78-
python3.12 -m pytest tests/
78+
python3.13 -m pytest tests/
7979
8080
build-sdist:
8181
runs-on: ubuntu-latest
@@ -100,7 +100,7 @@ jobs:
100100
rm ./dist/*.whl
101101
- name: Install package
102102
run: |
103-
python -m pip install ./dist/iteration_utilities-0.12.1.tar.gz -vv
103+
python -m pip install ./dist/iteration_utilities-0.13.0.tar.gz -vv
104104
- name: Import package
105105
run: |
106106
python -c "import iteration_utilities"
@@ -132,7 +132,7 @@ jobs:
132132
python-version: '3.12'
133133

134134
- name: Install cibuildwheel
135-
run: python -m pip install cibuildwheel==2.16.5
135+
run: python -m pip install cibuildwheel==2.21.2
136136

137137
- name: Build wheels
138138
run: python -m cibuildwheel --output-dir wheelhouse

.github/workflows/pypy.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ jobs:
2121
with:
2222
fetch-depth: 1
2323
- name: Test installation (Ubuntu)
24-
if: matrix.os == 'ubuntu-20.04'
2524
run: |
26-
python3 -c "import urllib.request; urllib.request.urlretrieve ('hhttps://downloads.python.org/pypy/pypy3.10-v7.3.15-linux64.tar.bz2', './pypy.tar.bz2')"
25+
python3 -c "import urllib.request; urllib.request.urlretrieve ('https://downloads.python.org/pypy/pypy3.10-v7.3.17-linux64.tar.bz2', './pypy.tar.bz2')"
2726
python3 -c "import tarfile; tar = tarfile.open('./pypy.tar.bz2', 'r:bz2');tar.extractall('.'); tar.close()"
28-
./pypy3.10-v7.3.15-linux64/bin/pypy3 -m ensurepip
29-
./pypy3.10-v7.3.15-linux64/bin/pypy3 -m pip install pip setuptools --upgrade
30-
./pypy3.10-v7.3.15-linux64/bin/pypy3 -m pip install . --no-deps -vv
31-
./pypy3.10-v7.3.15-linux64/bin/pypy3 -c "import iteration_utilities"
32-
./pypy3.10-v7.3.15-linux64/bin/pypy3 -m pip install pytest
33-
./pypy3.10-v7.3.15-linux64/bin/pypy3 -m pytest tests
27+
./pypy3.10-v7.3.17-linux64/bin/pypy3 -m ensurepip
28+
./pypy3.10-v7.3.17-linux64/bin/pypy3 -m pip install pip setuptools --upgrade
29+
./pypy3.10-v7.3.17-linux64/bin/pypy3 -m pip install . --no-deps -vv
30+
./pypy3.10-v7.3.17-linux64/bin/pypy3 -c "import iteration_utilities"
31+
./pypy3.10-v7.3.17-linux64/bin/pypy3 -m pip install pytest
32+
./pypy3.10-v7.3.17-linux64/bin/pypy3 -m pytest tests

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version: 2
88
build:
99
os: ubuntu-22.04
1010
tools:
11-
python: "3.11"
11+
python: "3.12"
1212

1313
# Build documentation in the "docs/" directory with Sphinx
1414
sphinx:

ci/collect_benchmarks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
if __name__ == '__main__':
88
benchmark_directory = pathlib.Path('./benchmarks/')
9-
result_folder = pathlib.Path('./.benchmark_results/')
9+
result_folder = pathlib.Path('./benchmark_results/')
1010

1111
# Create result folder and remove all png files there
1212
result_folder.mkdir(exist_ok=True)

docs/CHANGES.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Changelog for "iteration_utilities"
22
-----------------------------------
33

4+
Version 0.13.0 (2024-10-08)
5+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
- Python 3.13 compatibility: A few optimizations are not possible anymore in Python 3.13.
8+
This means the performance of some functions (most notably ``groupedby``) will be slightly
9+
slower.
10+
11+
412
Version 0.12.1 (2024-03-03)
513
^^^^^^^^^^^^^^^^^^^^^^^^^^^
614

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@
323323
# sphinx.ext.intersphinx
324324
# #############################################################################
325325

326-
intersphinx_mapping = {'python': ('https://docs.python.org/3.8/', # target
326+
intersphinx_mapping = {'python': ('https://docs.python.org/3.13/', # target
327327
None), # inventory
328328
}
329329
# intersphinx_cache_limit

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "iteration_utilities"
7-
version = "0.12.1"
7+
version = "0.13.0"
88
description = "Utilities based on Pythons iterators and generators."
99
readme = "README.rst"
1010
requires-python = ">=3.7"
@@ -22,6 +22,7 @@ classifiers = [
2222
"Programming Language :: Python :: 3.10",
2323
"Programming Language :: Python :: 3.11",
2424
"Programming Language :: Python :: 3.12",
25+
"Programming Language :: Python :: 3.13",
2526
"Operating System :: MacOS :: MacOS X",
2627
"Operating System :: Microsoft :: Windows",
2728
"Operating System :: POSIX :: Linux",

src/iteration_utilities/_classes.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ class Iterable(_Base):
11061106
:py:meth:`~.Iterable.get_fsum` See :py:func:`math.fsum`.
11071107
:py:meth:`~.Iterable.get_geometric_mean` See :py:func:`statistics.geometric_mean`. (Python >= 3.8)
11081108
:py:meth:`~.Iterable.get_groupedby` See :py:func:`~iteration_utilities.groupedby`.
1109-
:py:meth:`~.Iterable.get_harmonic_mean` See :py:func:`statistics.harmonic_mean`. (Python >= 3.6)
1109+
:py:meth:`~.Iterable.get_harmonic_mean` See :py:func:`statistics.harmonic_mean`.
11101110
:py:meth:`~.Iterable.get_last` See :py:func:`~iteration_utilities.nth`.
11111111
:py:meth:`~.Iterable.get_max` See :py:func:`python:max`.
11121112
:py:meth:`~.Iterable.get_mean` See :py:func:`statistics.mean`.
@@ -1915,9 +1915,6 @@ def get_variance(self, mu=_default):
19151915
def get_harmonic_mean(self):
19161916
"""See :py:func:`statistics.harmonic_mean`.
19171917
1918-
.. note::
1919-
Python >= 3.6 is required for this function.
1920-
19211918
Examples
19221919
--------
19231920
>>> from iteration_utilities import Iterable

src/iteration_utilities/_iteration_utilities/_iteration_utilities.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static PyMethodDef PyIU_methods[] = {
156156
/* Helper */
157157
{
158158
"_parse_args", /* ml_name */
159-
#if PyIU_USE_VECTORCALL
159+
#if PyIU_USE_ARG_PARSE_STACK
160160
(PyCFunction)(void (*)(void))PyIU_TupleToList_and_InsertItemAtIndex, /* ml_meth */
161161
METH_FASTCALL, /* ml_flags */
162162
#else
@@ -167,7 +167,7 @@ static PyMethodDef PyIU_methods[] = {
167167
},
168168
{
169169
"_parse_kwargs", /* ml_name */
170-
#if PyIU_USE_VECTORCALL
170+
#if PyIU_USE_ARG_PARSE_STACK
171171
(PyCFunction)(void (*)(void))PyIU_RemoveFromDictWhereValueIs, /* ml_meth */
172172
METH_FASTCALL, /* ml_flags */
173173
#else

src/iteration_utilities/_iteration_utilities/docsfunctions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ PyDoc_STRVAR(
11451145
" The first value.\n"
11461146
"\n"
11471147
"Raises\n"
1148-
"-------\n"
1148+
"------\n"
11491149
"ValueError :\n"
11501150
" If the `iterable` contains no items or more than one item.\n"
11511151
"\n"

src/iteration_utilities/_iteration_utilities/exported_helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ PyIU_parse_kwargs(PyObject *dct, PyObject *remvalue) {
101101
Py_RETURN_NONE;
102102
}
103103

104-
#if PyIU_USE_VECTORCALL
104+
#if PyIU_USE_ARG_PARSE_STACK
105105
PyObject *
106106
PyIU_TupleToList_and_InsertItemAtIndex(PyObject *Py_UNUSED(m), PyObject *const *args, size_t nargs) {
107107
PyObject *tup;

src/iteration_utilities/_iteration_utilities/exported_helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern "C" {
99
#include <Python.h>
1010
#include "helpercompat.h"
1111

12-
#if PyIU_USE_VECTORCALL
12+
#if PyIU_USE_ARG_PARSE_STACK
1313
PyObject * PyIU_TupleToList_and_InsertItemAtIndex(PyObject *Py_UNUSED(m), PyObject *const *args, size_t nargs);
1414
PyObject * PyIU_RemoveFromDictWhereValueIs(PyObject *Py_UNUSED(m), PyObject *const *args, size_t nargs);
1515
#else

src/iteration_utilities/_iteration_utilities/groupedby.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#include "groupedby.h"
66
#include "helper.h"
77

8-
#define PyIU_USE_DICT_INTERNALS PYIU_CPYTHON
9-
108
PyObject *
119
PyIU_Groupby(PyObject *Py_UNUSED(m), PyObject *args, PyObject *kwargs) {
1210
static char *kwlist[] = {"iterable", "key", "keep", "reduce", "reducestart", NULL};

src/iteration_utilities/_iteration_utilities/helpercompat.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ extern "C" {
4141
#define PyIU_USE_FASTCALL (PYIU_CPYTHON && PY_MAJOR_VERSION == 3 && (PY_MINOR_VERSION == 6 || PY_MINOR_VERSION == 7))
4242
#define PyIU_USE_UNDERSCORE_VECTORCALL (PYIU_CPYTHON && PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 8)
4343
#define PyIU_USE_VECTORCALL (PYIU_CPYTHON && ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8) || PY_MAJOR_VERSION >= 4))
44+
#define PyIU_USE_ARG_PARSE_STACK (PYIU_CPYTHON && (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8 && PY_MINOR_VERSION < 13)) // https://github.com/python/cpython/issues/110964
4445
#define PyIU_USE_BUILTIN_MODULE_ADDTYPE ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 9) || PY_MAJOR_VERSION >= 4)
4546

47+
#define PyIU_USE_DICT_INTERNALS (PYIU_CPYTHON && (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 13)) // https://github.com/python/cpython/pull/108449 and https://github.com/python/cpython/pull/112115
48+
4649
#ifdef Py_IS_TYPE
4750
#define PyIU_USE_BUILTIN_IS_TYPE 1
4851
#else

src/iteration_utilities/_iteration_utilities/nth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ PyDoc_STRVAR(
6666
" If there is no such value then `default` is returned.\n"
6767
"\n"
6868
"Raises\n"
69-
"-------\n"
69+
"------\n"
7070
"TypeError :\n"
7171
" If there is no nth element and no `default` is given.\n"
7272
"\n"

src/iteration_utilities/_iteration_utilities/split.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ PyDoc_STRVAR(
9292
" Generator containing the splitted `iterable` (lists).\n"
9393
"\n"
9494
"Raises\n"
95-
"-------\n"
95+
"------\n"
9696
"TypeError\n"
9797
" If ``maxsplit`` is smaller than ``-2``. If more than one of the ``keep``\n"
9898
" arguments is ``True``.\n"

0 commit comments

Comments
 (0)