Skip to content

Commit 404bef2

Browse files
committed
Enable support for free-threading
This PR: 1. marks the `libcst.native` module as free-threading-compatible 2. replaces the use of ProcessPoolExecutor with ThreadPoolExecutor if free-threaded CPython is detected at runtime This depends on #1294 and #1289.
1 parent 52acdf4 commit 404bef2

File tree

6 files changed

+16355
-87
lines changed

6 files changed

+16355
-87
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [macos-latest, ubuntu-latest, windows-latest]
16-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
16+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t"]
1717
steps:
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.10"
21+
- name: Install hatch
22+
run: pip install -U hatch
1823
- uses: actions/checkout@v4
1924
with:
2025
fetch-depth: 0
@@ -24,9 +29,6 @@ jobs:
2429
cache: pip
2530
cache-dependency-path: "pyproject.toml"
2631
python-version: ${{ matrix.python-version }}
27-
- name: Install hatch
28-
run: |
29-
pip install -U hatch
3032
- uses: actions-rs/toolchain@v1
3133
with:
3234
toolchain: stable
@@ -44,50 +46,6 @@ jobs:
4446
hatch run coverage combine .coverage.pure
4547
hatch run coverage report
4648
47-
# TODO:
48-
# merge into regular CI once hatch has support for creating environments on
49-
# the free-threaded build: https://github.com/pypa/hatch/issues/1931
50-
free-threaded-tests:
51-
name: "test (${{ matrix.os }}, 3.13t)"
52-
runs-on: ${{ matrix.os }}
53-
strategy:
54-
fail-fast: false
55-
matrix:
56-
os: [macos-latest, ubuntu-latest, windows-latest]
57-
steps:
58-
- uses: actions/checkout@v4
59-
with:
60-
fetch-depth: 0
61-
persist-credentials: false
62-
- uses: actions/setup-python@v5
63-
with:
64-
cache: pip
65-
cache-dependency-path: "pyproject.toml"
66-
python-version: '3.13t'
67-
- name: Build LibCST
68-
run: |
69-
# Install build-system.requires dependencies
70-
pip install setuptools setuptools-scm setuptools-rust wheel
71-
# Jupyter is annoying to install on free-threaded Python
72-
pip install -e .[dev-without-jupyter]
73-
- name: Native Parser Tests
74-
# TODO: remove when native modules declare free-threaded support
75-
env:
76-
PYTHON_GIL: '0'
77-
run: |
78-
python -m coverage run -m libcst.tests
79-
- name: Pure Parser Tests
80-
env:
81-
COVERAGE_FILE: .coverage.pure
82-
LIBCST_PARSER_TYPE: pure
83-
run: |
84-
python -m coverage run -m libcst.tests
85-
- name: Coverage
86-
run: |
87-
python -m coverage combine .coverage.pure
88-
python -m coverage report
89-
90-
9149
# Run linters
9250
lint:
9351
runs-on: ubuntu-latest
@@ -139,7 +97,7 @@ jobs:
13997
- name: Install hatch
14098
run: pip install -U hatch
14199
- uses: ts-graphviz/setup-graphviz@v2
142-
- run: hatch run docs
100+
- run: hatch run docs:docs
143101
- name: Archive Docs
144102
uses: actions/upload-artifact@v4
145103
with:

0 commit comments

Comments
 (0)