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

build freethreading wheels #2491

Closed
wants to merge 5 commits into from
Closed
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
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ jobs:
uses: pypa/[email protected]
env:
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_ENABLE: "cpython-prerelease"
CIBW_TEST_EXTRAS: test
CIBW_TEST_COMMAND:
make -C {project} PYTHON="env python" PSUTIL_SCRIPTS_DIR="{project}/scripts" install-sysdeps install-pydeps-test install print-sysinfo test test-memleaks
CIBW_ENABLE: "${{ startsWith(github.ref, 'refs/tags/') && '' || 'cpython-prerelease' }}"

- name: Upload wheels
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ syntax: glob
build/
dist/
wheelhouse/
.tests/
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ XXXX-XX-XX

**Enhancements**

- 2476_: Build Python 3.13t (free-threading) wheels
- 2480_: Python 2.7 is no longer supported. Latest version supporting Python
2.7 is psutil 6.1.X. Install it with: ``pip2 install psutil==6.1.*``.
- 2490_: removed long deprecated ``Process.memory_info_ex()`` method. It was
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ test-coverage: ## Run test coverage.
$(PYTHON) -m coverage html
$(PYTHON) -m webbrowser -t htmlcov/index.html

test-ci: install-sysdeps
mkdir -p .tests
cd .tests/ && $(PYTHON) -c "from psutil.tests import print_sysinfo; print_sysinfo()"
cd .tests/ && $(PYTHON_ENV_VARS) PYTEST_ADDOPTS="-k 'not test_memleaks.py'" $(PYTHON) -m pytest $(PYTEST_ARGS) --pyargs psutil.tests
cd .tests/ && $(PYTHON_ENV_VARS) PYTEST_ADDOPTS="-k 'test_memleaks.py'" $(PYTHON) -m pytest $(PYTEST_ARGS) --pyargs psutil.tests

# ===================================================================
# Linters
# ===================================================================
Expand Down
8 changes: 7 additions & 1 deletion psutil/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,13 @@ def test_long_cmdline(self):
def test_name(self):
p = self.spawn_psproc()
name = p.name().lower()
pyexe = os.path.basename(os.path.realpath(sys.executable)).lower()
pypath = os.path.realpath(sys.executable)
if pypath.startswith("/Library/Frameworks/PythonT.framework/"):
# macOS Framework installations of Python can have their process
# replaced by PythonT using execve / posix_spawn
assert name == "pythont"
pypath = psutil.Process().cmdline()[0]
pyexe = os.path.basename(pypath).lower()
assert pyexe.startswith(name), (pyexe, name)

@pytest.mark.skipif(PYPY or QEMU_USER, reason="unreliable on PYPY")
Expand Down
9 changes: 6 additions & 3 deletions psutil/tests/test_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,12 @@ def test_proc_net_connections(self):
name = self.get_testfn(suffix=self.funky_suffix)
sock = bind_unix_socket(name)
with closing(sock):
conn = psutil.Process().net_connections('unix')[0]
assert isinstance(conn.laddr, str)
assert conn.laddr == name
conns = psutil.Process().net_connections('unix')
for conn in conns:
assert isinstance(conn.laddr, str)
if conn.laddr == name:
return
raise ValueError("connection not found")

@pytest.mark.skipif(not POSIX, reason="POSIX only")
@pytest.mark.skipif(
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,13 @@ trailing_comma_inline_array = true
[tool.cibuildwheel]
skip = [
"*-musllinux*",
"cp313-win*", # pywin32 is not available on cp313 yet
"cp3{7,8,9,10,11,12}-*linux_{aarch64,ppc64le,s390x}", # Only test cp36/cp313 on qemu tested architectures
"pp*",
]
enable = ["cpython-freethreading"]
test-extras = ["test"]
test-command = "make -C {project} PYTHON=python PSUTIL_SCRIPTS_DIR=\"{project}/scripts\" test-ci"
test-skip = ["cp3*t-win*"] # pywin32 is not available for free-threaded python yet, https://github.com/mhammond/pywin32/issues/2303

[tool.cibuildwheel.macos]
archs = ["arm64", "x86_64"]
Expand Down
5 changes: 5 additions & 0 deletions scripts/internal/install-sysdeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ case "$UNAME_S" in
OpenBSD)
OPENBSD=true
;;
Darwin)
DARWIN=true
;;
esac

# Check if running as root
Expand All @@ -54,6 +57,8 @@ main() {
$SUDO pkgin -y install python311-* gcc12-*
elif [ $OPENBSD ]; then
$SUDO pkg_add gcc python3
elif [ $DARWIN ]; then
:
else
echo "Unsupported platform: $UNAME_S"
fi
Expand Down
Loading