diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 11f1cf38..e6b139df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: # Checkout pull request HEAD commit instead of merge commit ref: ${{ github.event.pull_request.head.sha }} @@ -26,14 +26,14 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13-dev"] fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -50,7 +50,7 @@ jobs: name: "test (aarch64, ${{ matrix.pyver }})" strategy: matrix: - pyver: [cp37-cp37m, cp38-cp38, cp39-cp39, cp310-cp310] + pyver: [cp312-cp312] fail-fast: false runs-on: ubuntu-latest env: @@ -58,7 +58,7 @@ jobs: img: quay.io/pypa/manylinux2014_aarch64 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up QEMU id: qemu uses: docker/setup-qemu-action@v3 diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 276e8dcc..80739a0d 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -41,7 +41,7 @@ jobs: python-version: '3.8' - name: Build wheels - uses: joerick/cibuildwheel@v2.19.1 + uses: joerick/cibuildwheel@v2.19 env: CIBW_SKIP: pp* CIBW_ARCHS: ${{matrix.archs}} @@ -77,14 +77,17 @@ jobs: runs-on: ubuntu-latest # upload to PyPI on every tag starting with 'v' if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') + environment: + name: pypi + url: https://pypi.org/p/pyinstrument + permissions: + id-token: write + attestations: write + steps: - uses: actions/download-artifact@v2 with: name: artifact path: dist - - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.pypi_password }} - # To test: repository_url: https://test.pypi.org/legacy/ + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/README.md b/README.md index 0ad0b9a7..539d8030 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Installation pip install pyinstrument -Pyinstrument supports Python 3.7+. +Pyinstrument supports Python 3.8+. diff --git a/noxfile.py b/noxfile.py index 69f74f7b..d8abd320 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,7 +1,7 @@ import nox -@nox.session(python=["3.7", "3.8", "3.9"]) +@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]) def test(session): - session.install("-r", "requirements-dev.txt") + session.install("-e", ".[test]") session.run("pytest") diff --git a/pyinstrument/low_level/stat_profile.c b/pyinstrument/low_level/stat_profile.c index 0036d50c..b5dd43d1 100644 --- a/pyinstrument/low_level/stat_profile.c +++ b/pyinstrument/low_level/stat_profile.c @@ -30,6 +30,7 @@ These timer functions are mostly stolen from timemodule.c #if defined(MS_WINDOWS) && !defined(__BORLANDC__) #include +#include // for clock() /* use QueryPerformanceCounter on Windows */ @@ -333,19 +334,19 @@ _get_class_name_of_frame(PyFrameObject *frame, PyCodeObject *code) { PyObject *locals = PyFrame_GetLocals(frame); - if (!PyDict_Check(locals)) { + if (!PyMapping_Check(locals)) { Py_DECREF(locals); return NULL; } if (has_self) { - PyObject *self = PyDict_GetItem(locals, SELF_STRING); + PyObject *self = PyObject_GetItem(locals, SELF_STRING); if (self) { result = _PyType_Name(self->ob_type); } } else if (has_cls) { - PyObject *cls = PyDict_GetItem(locals, CLS_STRING); + PyObject *cls = PyObject_GetItem(locals, CLS_STRING); if (cls) { if (PyType_Check(cls)) { PyTypeObject *type = (PyTypeObject *)cls; diff --git a/pyproject.toml b/pyproject.toml index eab21fc8..bbbc40b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ line-length = 100 [tool.pyright] include = ["pyinstrument", "test"] ignore = ["pyinstrument/vendor"] -pythonVersion = "3.7" +pythonVersion = "3.8" [tool.isort] profile = "black" diff --git a/setup.py b/setup.py index 6012be3a..01269f16 100644 --- a/setup.py +++ b/setup.py @@ -29,9 +29,10 @@ "pytest", "flaky", "trio", - "greenlet>=3.0.0a1", + "cffi >= v1.17.0rc1 ; python_version >= '3.13'", # trio dep, pinned to a version that works with py3.13 + "greenlet>=3.0.0a1 ; python_version < '3.13'", + "greenlet @ https://github.com/vstinner/greenlet/archive/refs/heads/py313.zip ; python_version >= '3.13'", "pytest-asyncio==0.12.0", # pinned to an older version due to an incompatibility with flaky - "sphinx-autobuild==2021.3.14", "ipython", ], "bin": [ @@ -39,10 +40,11 @@ "nox", ], "docs": [ - "sphinx==4.2.0", - "myst-parser==0.15.1", - "furo==2021.6.18b36", + "sphinx==7.4.7", + "myst-parser==3.0.1", + "furo==2024.7.18", "sphinxcontrib-programoutput==0.17", + "sphinx-autobuild==2024.4.16", ], "examples": [ "numpy", @@ -53,7 +55,7 @@ ], }, include_package_data=True, - python_requires=">=3.7", + python_requires=">=3.8", entry_points={"console_scripts": ["pyinstrument = pyinstrument.__main__:main"]}, zip_safe=False, classifiers=[