diff --git a/.github/workflows/release-to-pypi.yml b/.github/workflows/release-to-pypi.yml index fdf3af13c..df657b36c 100644 --- a/.github/workflows/release-to-pypi.yml +++ b/.github/workflows/release-to-pypi.yml @@ -16,10 +16,10 @@ jobs: steps: - name: Check out the release commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 with: platforms: arm64 if: runner.os == 'Linux' @@ -27,24 +27,18 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.10' - name: Install Python packages needed for wheel build and upload - run: | - python -m pip install --upgrade pip setuptools - python -m pip install twine wheel + run: python -m pip install twine - name: Build wheels - uses: pypa/cibuildwheel@v2.14.1 - env: - CIBW_SKIP: 'pp*' - CIBW_ARCHS_LINUX: "auto aarch64" - CIBW_ARCHS_MACOS: "auto universal2" + uses: pypa/cibuildwheel@v2.16.2 - name: Check and upload wheels env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | python -m twine check --strict wheelhouse/*.whl python -m twine upload wheelhouse/*.whl @@ -55,26 +49,23 @@ jobs: steps: - name: Check out the release commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.10' - name: Install Python packages needed for sdist build and upload - run: | - python -m pip install --upgrade pip setuptools - python -m pip install twine + run: python -m pip install build twine - name: Build sdist - run: | - python setup.py sdist + run: python -m build --sdist - name: Publish sdist to PyPI env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python -m twine check --strict dist/*.tar.gz - python -m twine upload dist/*.tar.gz + python -m twine check --strict dist/* + python -m twine upload dist/* diff --git a/.github/workflows/run-core-traits-tests.yml b/.github/workflows/run-core-traits-tests.yml index 26c65f650..85b2b3a24 100644 --- a/.github/workflows/run-core-traits-tests.yml +++ b/.github/workflows/run-core-traits-tests.yml @@ -11,19 +11,19 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install local package run: | - python -m pip install --upgrade pip # Uninstall setuptools so that the tests will catch any accidental # dependence of the Traits source on setuptools. Note that in future # setuptools may not exist in a newly-created venv diff --git a/.github/workflows/run-style-checks.yml b/.github/workflows/run-style-checks.yml index 82d10f3c7..c20e5973d 100644 --- a/.github/workflows/run-style-checks.yml +++ b/.github/workflows/run-style-checks.yml @@ -5,22 +5,16 @@ on: jobs: style: - strategy: - matrix: - os: [ubuntu-latest] - python-version: ['3.8'] - - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - uses: actions/checkout@v4 + - name: Set up Python 3.10 uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: '3.10' - name: Install dependencies and local packages run: | - python -m pip install --upgrade pip python -m pip install flake8 python -m pip install flake8-ets - name: Run style checks diff --git a/.github/workflows/run-traits-tests.yml b/.github/workflows/run-traits-tests.yml index ed61ff5bd..27b4e6267 100644 --- a/.github/workflows/run-traits-tests.yml +++ b/.github/workflows/run-traits-tests.yml @@ -5,7 +5,7 @@ on: - workflow_dispatch env: - # Temporary workaround prior to release of Traits 8.0 + # Temporary workaround prior to release of TraitsUI 8.0 # xref: enthought/traits#1742 ETS_QT4_IMPORTS: 1 @@ -14,12 +14,12 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Linux packages for Qt support run: | sudo apt-get update @@ -37,9 +37,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install dependencies and local packages run: | - python -m pip install --upgrade pip python -m pip install .[test] python -m pip install traits-stubs/[test] - name: Create clean test directory diff --git a/.github/workflows/test-documentation-build.yml b/.github/workflows/test-documentation-build.yml index c2d122b68..50906edc8 100644 --- a/.github/workflows/test-documentation-build.yml +++ b/.github/workflows/test-documentation-build.yml @@ -5,23 +5,16 @@ on: jobs: docs: - strategy: - matrix: - os: [ubuntu-latest] - python-version: ['3.8'] - - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - uses: actions/checkout@v4 + - name: Set up Python 3.10 uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: '3.10' - name: Install dependencies and local packages - run: | - python -m pip install --upgrade pip - python -m pip install ".[docs]" + run: python -m pip install .[docs] - name: Build HTML documentation with Sphinx run: | cd docs diff --git a/.github/workflows/test-from-pypi.yml b/.github/workflows/test-from-pypi.yml index d89e315d0..5850587f9 100644 --- a/.github/workflows/test-from-pypi.yml +++ b/.github/workflows/test-from-pypi.yml @@ -6,12 +6,17 @@ on: # Run at 03:27 UTC on the 8th and 22nd of every month - cron: '27 3 8,22 * *' +env: + # Temporary workaround prior to release of Traits 8.0 + # xref: enthought/traits#1742 + ETS_QT4_IMPORTS: 1 + jobs: test-pypi-sdist: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] python-architecture: [x86, x64] exclude: - os: macos-latest @@ -40,12 +45,15 @@ jobs: with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.python-architecture }} - - name: Install prerequisites + allow-prereleases: true + - name: Install test dependencies and Traits from PyPI sdist (no PySide6) run: | - python -m pip install --upgrade pip setuptools wheel - - name: Install Traits and test dependencies from PyPI sdist + python -m pip install --no-binary traits Cython numpy Sphinx traits traitsui + if: matrix.python-version == '3.12' || matrix.python-architecture == 'x86' + - name: Install test dependencies and Traits from PyPI sdist (PySide6) run: | - python -m pip install --no-binary traits traits[test] + python -m pip install --no-binary traits Cython numpy PySide6 Sphinx traits traitsui + if: matrix.python-version != '3.12' && matrix.python-architecture != 'x86' - name: Create clean test directory run: | mkdir testdir @@ -60,7 +68,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] python-architecture: [x86, x64] exclude: - os: macos-latest @@ -89,12 +97,15 @@ jobs: with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.python-architecture }} - - name: Install prerequisites + allow-prereleases: true + - name: Install test dependencies and Traits from PyPI wheel (no PySide6) run: | - python -m pip install --upgrade pip setuptools wheel - - name: Install Traits and test dependencies from PyPI wheel + python -m pip install --only-binary traits Cython numpy Sphinx traits traitsui + if: matrix.python-version == '3.12' || matrix.python-architecture == 'x86' + - name: Install test dependencies and Traits from PyPI wheel (PySide6) run: | - python -m pip install --only-binary traits traits[test] + python -m pip install --only-binary traits Cython numpy PySide6 Sphinx traits traitsui + if: matrix.python-version != '3.12' && matrix.python-architecture != 'x86' - name: Create clean test directory run: | mkdir testdir diff --git a/CHANGES.rst b/CHANGES.rst index 2908138e8..0144482fe 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,22 @@ Traits CHANGELOG ================ +Release 6.4.3 +------------- + +Released: 2023-10-09 + +This is a bugfix release that fixes test failures with Sphinx 7.2 and later, +and adds support for Python 3.12. + +Fixes +~~~~~ +* Use ``pathlib.Path`` instead of ``sphinx.testing.path.path`` for Sphinx + 7.2 and later. (#1755) +* Fix uses of the deprecated ``datetime.utcnow`` method. (#1758) +* Update CI and workflows for Python 3.12 support. (#1757) + + Release 6.4.2 ------------- diff --git a/pyproject.toml b/pyproject.toml index 96043e943..ea061849c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,5 +11,14 @@ profile = 'black' line_length = 79 order_by_type = 'False' +[tool.cibuildwheel] +skip = 'pp*' + +[tool.cibuildwheel.macos] +archs = ['auto', 'universal2'] + +[tool.cibuildwheel.linux] +archs = ['auto', 'aarch64'] + [tool.pytest.ini_options] addopts = '--ignore=traits-stubs' diff --git a/setup.py b/setup.py index 81d91e591..9686bb39a 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ # into the package source. MAJOR = 6 MINOR = 4 -MICRO = 2 +MICRO = 3 PRERELEASE = "" IS_RELEASED = True @@ -281,6 +281,7 @@ def get_long_description(): Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering Topic :: Software Development @@ -313,7 +314,9 @@ def get_long_description(): "flake8", "flake8-ets", "mypy", - "numpy", + # NumPy is not yet available for Python 3.12, but that should be + # fixed soon: https://github.com/numpy/numpy/issues/23808 + "numpy; python_version < '3.12'", "pyface", # Doc builds are hanging with pygments 2.15.0 and 2.15.1. # Maybe related: https://github.com/pygments/pygments/issues/2427 diff --git a/traits/util/event_tracer.py b/traits/util/event_tracer.py index 0769f315f..acb226c70 100644 --- a/traits/util/event_tracer.py +++ b/traits/util/event_tracer.py @@ -15,7 +15,7 @@ import os import threading from contextlib import contextmanager -from datetime import datetime +from datetime import datetime, timezone from traits import trait_notifiers @@ -228,7 +228,7 @@ def pre_tracer(self, obj, name, old, new, handler): """ indent = self.indent - time = datetime.utcnow().isoformat(" ") + time = datetime.now(timezone.utc).isoformat(" ") container = self.container container.record( ChangeMessageRecord( @@ -255,7 +255,7 @@ def post_tracer(self, obj, name, old, new, handler, exception=None): """ Record a string representation of the trait change return """ - time = datetime.utcnow().isoformat(" ") + time = datetime.now(timezone.utc).isoformat(" ") self.indent -= 1 indent = self.indent if exception: diff --git a/traits/util/tests/test_trait_documenter.py b/traits/util/tests/test_trait_documenter.py index d06d36d46..b51430719 100644 --- a/traits/util/tests/test_trait_documenter.py +++ b/traits/util/tests/test_trait_documenter.py @@ -27,7 +27,6 @@ if sphinx is not None: from sphinx.ext.autodoc import ClassDocumenter, INSTANCEATTR, Options from sphinx.ext.autodoc.directive import DocumenterBridge - from sphinx.testing.path import path from sphinx.testing.util import SphinxTestApp from sphinx.util.docutils import LoggingReporter @@ -37,6 +36,11 @@ TraitDocumenter, ) + if sphinx.version_info < (7, 2): + from sphinx.testing.path import path as Path + else: + from pathlib import Path + # Configuration file content for testing. CONF_PY = """\ @@ -223,7 +227,7 @@ def create_directive(self): with open(conf_file, "w", encoding="utf-8") as f: f.write(CONF_PY) - app = SphinxTestApp(srcdir=path(tmpdir)) + app = SphinxTestApp(srcdir=Path(tmpdir)) app.builder.env.app = app app.builder.env.temp_data["docname"] = "dummy"