Skip to content

Commit

Permalink
Support Python 3.13 (#1620)
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-alec authored Oct 15, 2024
1 parent 0ec32d2 commit b6e2f65
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ jobs:
if: github.event_name == 'schedule'
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Build pytket
run: |
cd pytket
Expand Down Expand Up @@ -399,7 +399,7 @@ jobs:
if: github.event_name == 'schedule'
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Build pytket
run: |
cd pytket
Expand Down Expand Up @@ -527,7 +527,7 @@ jobs:
if: github.event_name == 'schedule'
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Build pytket
run: |
cd pytket
Expand Down
27 changes: 11 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-24.04
strategy:
matrix:
python3-version: ['10', '11', '12']
python3-version: ['10', '11', '12', '13']
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -41,7 +41,7 @@ jobs:
runs-on: 'buildjet-8vcpu-ubuntu-2204-arm'
strategy:
matrix:
python3-version: ['10', '11', '12']
python3-version: ['10', '11', '12', '13']
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -67,7 +67,7 @@ jobs:
runs-on: macos-13
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
MACOSX_DEPLOYMENT_TARGET: '12.0'
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
runs-on: windows-2022
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
runs-on: ubuntu-24.04
strategy:
matrix:
python3-version: ['10', '11', '12']
python3-version: ['10', '11', '12', '13']
steps:
- name: Set up Python 3.${{ matrix.python3-version }}
uses: actions/setup-python@v5
Expand Down Expand Up @@ -223,18 +223,13 @@ jobs:
runs-on: 'buildjet-4vcpu-ubuntu-2204-arm'
strategy:
matrix:
python3-version: ['10', '11', '12']
python3-version: ['10', '11', '12', '13']
steps:
- uses: actions/checkout@v4
with:
path: tket
- name: Set up Python 3.${{ matrix.python3-version }}
# Use deadsnakes/action because Python for Linux/ARM is not available with
# actions/setup-python.
# Python 3.10 is the default python on Ubuntu 22.04, so this combination
# is not available from deadsnakes: use the default python in this case.
if: matrix.python3-version != '10'
uses: deadsnakes/[email protected]
uses: actions/setup-python@v5
with:
python-version: "3.${{ matrix.python3-version }}"
- name: Download wheel
Expand All @@ -260,7 +255,7 @@ jobs:
strategy:
matrix:
os: ['macos-13']
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -290,7 +285,7 @@ jobs:
strategy:
matrix:
os: ['macos-14', 'macos-15']
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -320,7 +315,7 @@ jobs:
runs-on: windows-2022
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ depend on the features they support. The compiler version can be controlled by
setting `CC` and `CXX` in your environment (e.g. `CC=gcc-11` and `CXX=g++-11`),
or on Debian-based Linux systems using `update-alternatives`.

You should also have Python (3.10, 3.11 or 3.12) and `pip` installed. We use
`cmake` and the package manager `conan` to build tket and pytket. The latter can
be installed with `pip`:
You should also have Python (3.10, 3.11, 3.12 or 3.13) and `pip` installed. We
use `cmake` and the package manager `conan` to build tket and pytket. The latter
can be installed with `pip`:

```shell
pip install conan
Expand Down
5 changes: 5 additions & 0 deletions pytket/docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

1.33.2 (Unreleased)
-------------------

* Support Python 3.13.

1.33.1 (October 2024)
---------------------

Expand Down
4 changes: 2 additions & 2 deletions pytket/docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ NISQ (noisy intermediate-scale quantum) devices. The pytket package provides an
API for interacting with tket and transpiling to and from other popular quantum
circuit specifications.

Pytket is compatible with 64-bit Python 3.10, 3.11 and 3.12, on Linux, MacOS
(12.0 or later) and Windows. Install pytket from PyPI using:
Pytket is compatible with 64-bit Python 3.10, 3.11, 3.12 and 3.13, on Linux,
MacOS (12.0 or later) and Windows. Install pytket from PyPI using:

::

Expand Down
4 changes: 2 additions & 2 deletions pytket/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ pytket
`numerous providers <https://docs.quantinuum.com/tket/api-docs/extensions>`_, allowing the
tket tools to be used in conjunction with projects on their platforms.

``pytket`` is available for Python 3.10, 3.11 and 3.12, on Linux, MacOS and
Windows. To install, run
``pytket`` is available for Python 3.10, 3.11, 3.12 and 3.13, on Linux, MacOS
and Windows. To install, run

::

Expand Down
2 changes: 1 addition & 1 deletion pytket/docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Installation FAQs
Is there a build of ``pytket`` for my system?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The core pytket package, as well as the separate extension modules are available on PyPI. Wheels are built to work on Linux, MacOS and Windows with Python versions 3.10, 3.11, or 3.12, and ``pip`` version 20.0.0+.
The core pytket package, as well as the separate extension modules are available on PyPI. Wheels are built to work on Linux, MacOS and Windows with Python versions 3.10, 3.11, 3.12 or 3.13, and ``pip`` version 20.0.0+.

.. note::
On M1-based Macs running in native (arm64) mode, this command may fail
Expand Down
2 changes: 1 addition & 1 deletion pytket/package.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The source code for the TKET compiler can be found in [this github repository](h

## Installation

Installation is supported for Linux, MacOS and Windows. Installation requires python 3.10, 3.11 or 3.12.
Installation is supported for Linux, MacOS and Windows. Installation requires python 3.10, 3.11, 3.12 or 3.13.

To install run the pip command:

Expand Down
2 changes: 1 addition & 1 deletion pytket/pytket/utils/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def as_counter(self) -> Counter[T0]:
@property
def total(self) -> int:
"""Return the total number of observations."""
return sum(self._C.values()) # Counter.total() new in 3.10
return self._C.total()

@property
def support(self) -> Set[T0]:
Expand Down
1 change: 1 addition & 0 deletions pytket/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def finalize_options(self):
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
Expand Down

0 comments on commit b6e2f65

Please sign in to comment.