Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up the CI & modernise some things #322

Merged
merged 5 commits into from
Jul 30, 2024
Merged
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
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}

Expand All @@ -50,15 +50,15 @@ 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:
py: /opt/python/${{ matrix.pyver }}/bin/python
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
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
python-version: '3.8'

- name: Build wheels
uses: joerick/[email protected].1
uses: joerick/[email protected]
env:
CIBW_SKIP: pp*
CIBW_ARCHS: ${{matrix.archs}}
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Installation

pip install pyinstrument

Pyinstrument supports Python 3.7+.
Pyinstrument supports Python 3.8+.

<!-- MARK installation end -->

Expand Down
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -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")
7 changes: 4 additions & 3 deletions pyinstrument/low_level/stat_profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ These timer functions are mostly stolen from timemodule.c

#if defined(MS_WINDOWS) && !defined(__BORLANDC__)
#include <windows.h>
#include <time.h> // for clock()

/* use QueryPerformanceCounter on Windows */

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 8 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,22 @@
"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": [
"click",
"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",
Expand All @@ -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=[
Expand Down
Loading