Skip to content

Commit 3d0305d

Browse files
committed
Promote uv usage
1 parent f7a8e3e commit 3d0305d

5 files changed

Lines changed: 404 additions & 28 deletions

File tree

.github/workflows/CI.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,20 @@ jobs:
239239
echo "ready=${ready}" >> "$GITHUB_OUTPUT"
240240
- uses: dtolnay/rust-toolchain@stable
241241
if: steps.ft_py.outputs.ready == 'true'
242-
- name: Install dependencies and build
242+
- uses: astral-sh/setup-uv@v5
243243
if: steps.ft_py.outputs.ready == 'true'
244-
run: |
245-
python -m venv .venv
246-
./.venv/bin/python -m pip install --upgrade pip
247-
./.venv/bin/python -m pip install maturin pytest
248-
./.venv/bin/python -m maturin develop --release
249-
- name: Run tests
244+
- name: Install dependencies (uv) and run tests
250245
if: steps.ft_py.outputs.ready == 'true'
251-
run: ./.venv/bin/python -m pytest tests/
246+
shell: bash
247+
run: |
248+
set -euo pipefail
249+
if [[ '${{ steps.py314t.outcome }}' == 'success' ]]; then
250+
export UV_PYTHON='${{ steps.py314t.outputs.python-path }}'
251+
else
252+
export UV_PYTHON='${{ steps.py313t.outputs.python-path }}'
253+
fi
254+
uv sync --extra dev --locked
255+
uv run pytest tests/
252256
- name: Free-threaded Python unavailable
253257
if: steps.ft_py.outputs.ready != 'true'
254258
run: |

CONTRIBUTING.rst

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,38 +57,43 @@ Get Started!
5757

5858
Ready to contribute? Here's how to set up `python-bidi` for local development.
5959

60-
1. Fork the `python-bidi` repo on GitHub.
60+
1. Fork the ``python-bidi`` repo on GitHub.
6161
2. Clone your fork locally::
6262

6363
$ git clone git@github.com:your_name_here/python-bidi.git
6464

65-
3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
65+
3. Install prerequisites:
66+
67+
* `Rust <https://www.rust-lang.org/tools/install>`_ (the extension is built with PyO3 / maturin).
68+
* `uv <https://docs.astral.sh/uv/installation/>`_ (Python envs, dependency lockfile, and nox’s ``venv_backend="uv"``).
69+
70+
4. In the repo, sync the dev environment and run tests::
6671

67-
$ mkvirtualenv python-bidi
6872
$ cd python-bidi/
69-
$ python setup.py develop
73+
$ uv sync --extra dev
74+
$ uv run pytest
7075

71-
4. Create a branch for local development::
76+
This uses ``uv.lock`` when present for reproducible installs. To match CI-style checks via nox (also using uv under the hood)::
7277

73-
$ git switch -c name-of-your-bugfix-or-feature
78+
$ uv run nox
7479

75-
Now you can make your changes locally.
80+
Alternatively, install nox globally (``uv tool install nox``, ``pipx install nox``, etc.) and run ``nox`` from the repo root.
7681

77-
5. When you're done making changes, check that your changes pass flake8 and the tests::
82+
5. Create a branch for local development::
7883

79-
$ flake8 python-bidi tests
80-
$ python setup.py test
81-
$ nox
84+
$ git switch -c name-of-your-bugfix-or-feature
85+
86+
Now you can make your changes locally.
8287

83-
To get ``flake8`` and ``nox``, just pip install them into your virtualenv.
88+
6. When you're ready, ensure tests still pass (see step 4).
8489

85-
6. Commit your changes and push your branch to GitHub::
90+
7. Commit your changes and push your branch to GitHub::
8691

8792
$ git add .
8893
$ git commit -m "Your detailed description of your changes."
8994
$ git push origin name-of-your-bugfix-or-feature
9095

91-
7. Submit a pull request through the GitHub website.
96+
8. Submit a pull request through the GitHub website.
9297

9398
Pull Request Guidelines
9499
-----------------------

README.rst

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,25 @@ Examples::
114114
Installation
115115
-------------
116116

117-
At the command line (assuming you're using some virtualenv)::
117+
From PyPI::
118118

119119
pip install python-bidi
120120

121+
Or with uv::
121122

122-
Running tests
123-
--------------
123+
uv pip install python-bidi
124124

125-
To run the tests::
126125

127-
pip install nox
126+
Development / running tests
127+
-----------------------------
128+
129+
You need Rust (for ``maturin``), `uv <https://docs.astral.sh/uv/>`_, and a ``nox`` session backend of ``uv`` (nox reads this from ``noxfile.py``).
130+
131+
From a clone, create the environment and run the test suite::
132+
133+
uv sync --extra dev
134+
uv run pytest
135+
136+
Or use nox (after ``uv sync --extra dev``, or install nox with ``uv tool install nox`` / ``pipx install nox``)::
137+
128138
nox

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ build-backend = "maturin"
55
[project]
66
name = "python-bidi"
77
version = "0.6.8"
8+
requires-python = ">=3.9"
89
readme = "README.rst"
910
keywords = ["bidi", "unicode", "layout"]
1011
description = "Python Bidi layout wrapping the Rust crate unicode-bidi"
@@ -35,4 +36,4 @@ Changelog = "https://github.com/MeirKriheli/python-bidi/blob/master/CHANGELOG.rs
3536
pybidi = "bidi:main"
3637

3738
[project.optional-dependencies]
38-
dev = ["pytest"]
39+
dev = ["nox", "pytest"]

0 commit comments

Comments
 (0)