-
Notifications
You must be signed in to change notification settings - Fork 77
Replace pip with uv in payjoin-ffi/python
#1073
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,22 +27,26 @@ jobs: | |
| - name: "Install Rust 1.85.0" | ||
| uses: dtolnay/rust-toolchain@1.85.0 | ||
|
|
||
| - name: "Install Python" | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.12 | ||
|
|
||
| - name: "Use cache" | ||
| uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: Install a specific version of uv | ||
| uses: astral-sh/setup-uv@v6 | ||
| with: | ||
| version: "0.8.2" | ||
| enable-cache: true | ||
|
|
||
| - name: "uv sync" | ||
| run: uv sync --all-extras | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This command includes all "optional" (i.e. dev) dependencies and is the replacement for |
||
|
|
||
| - name: "Generate payjoin-ffi.py and binaries" | ||
| run: bash ./scripts/generate_bindings.sh | ||
|
|
||
| - name: "Build wheel" | ||
| run: python -m build --wheel | ||
| run: uv build --wheel | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running just |
||
|
|
||
| - name: "Install wheel" | ||
| run: pip install ./dist/*.whl | ||
| run: uv run pip install ./dist/*.whl | ||
|
|
||
| - name: "Run tests" | ||
| run: python -m unittest -v | ||
| run: uv run python -m unittest --verbose | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ __pycache__/ | |
| *.swp | ||
| *.whl | ||
| build/ | ||
| venv | ||
| .venv | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| # Auto-generated shared libraries | ||
| *.dylib | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,46 +8,51 @@ Grab the latest release with a simple: | |
|
|
||
| ```shell | ||
| pip install payjoin | ||
|
|
||
| # Or, for uv: | ||
| uv add payjoin | ||
| ``` | ||
|
|
||
| ## Running Tests | ||
|
|
||
| Follow these steps to clone the repository and run the tests. | ||
|
|
||
|
|
||
| ```shell | ||
| git clone https://github.com/payjoin/rust-payjoin.git | ||
| cd rust-payjoin/payjoin-ffi/python | ||
|
Comment on lines
-19
to
-20
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seemed redundant |
||
| # Ensure you have uv installed: | ||
| # https://docs.astral.sh/uv/getting-started/installation/ | ||
|
Comment on lines
+21
to
+22
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are, of course, other deps required (
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in a separate followup PR it'd make sense to add python and these toolchain bits to the devshell not sure it should be gcc though, since rustc uses llvm clang might be the more appropriate option |
||
|
|
||
| # Setup a python virtual environment | ||
| python -m venv venv | ||
| source venv/bin/activate | ||
| # Setup virtual environment/install all packages (including developer packages) | ||
| uv sync --all-extras | ||
|
|
||
| PYBIN="./venv/bin/" bash ./scripts/generate_bindings.sh | ||
| bash ./scripts/generate_bindings.sh | ||
|
|
||
| # Build the wheel | ||
| python -m build --wheel | ||
| uv build --wheel | ||
|
|
||
| # Force reinstall payjoin | ||
| pip install ./dist/payjoin-<version>.whl --force-reinstall | ||
| # Force reinstall payjoin with <version> | ||
| uv pip install ./dist/payjoin-*.whl --force-reinstall | ||
|
|
||
| # Run all tests | ||
| python -m unittest --verbose | ||
| uv run python -m unittest --verbose | ||
| ``` | ||
|
|
||
| Note that you'll need Docker to run the integration tests. If you get a "Failed to start container" error, ensure the Docker engine is running on your machine. | ||
| You can [filter which tests](https://docs.python.org/3/library/unittest.html#command-line-interface) to run by passing a file or test name as argument. | ||
|
|
||
| ## Building the Package | ||
|
|
||
| ```shell | ||
| # Setup a python virtual environment | ||
| python -m venv venv | ||
| source venv/bin/activate | ||
| # Setup virtual environment/install packages for release | ||
| uv sync --all-extras | ||
|
|
||
| PYBIN="./venv/bin/" bash ./scripts/generate_bindings.sh | ||
| bash ./scripts/generate_bindings.sh | ||
|
|
||
| # Build the wheel | ||
| python -m build --wheel | ||
| uv build --wheel | ||
|
|
||
| # Force reinstall payjoin with <version> | ||
| uv pip install ./dist/payjoin-*.whl --force-reinstall | ||
|
|
||
| # Example: | ||
| # uv pip install ./dist/payjoin-0.24.0-cp313-cp313-linux_x86_64.whl | ||
|
|
||
| # Run all tests | ||
| uv run python -m unittest --verbose | ||
| ``` | ||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is simply the current version of
uv, I figured we shouldn't just arbitrarily pull latest?