Skip to content

Commit

Permalink
Build: replace milksnake with maturin (#2393)
Browse files Browse the repository at this point in the history
While investigating why the [Python 3.11] PR failed in conda-forge I
found out that there is an error in [milksnake]. Main issue is that
milksnake seems to be abandoned, without recent releases, so submitting
a PR to fix there might be unfruitful.

[Python 3.11]:
conda-forge/sourmash-minimal-feedstock#36
[milksnake]: https://github.com/getsentry/milksnake

[maturin] is a PEP517-compatible backend for building packages and aimed
at Rust packages (pure or mixed with more Python code, like sourmash).
It is actively maintained, and supports the `cffi` bindings case that we
use too.

[maturin]: https://maturin.rs

This PR is based on pyocd/cmsis-pack-manager#195
Closes #1564 (previous try
with `setuptools-rust`)
  • Loading branch information
luizirber authored Dec 28, 2022
1 parent c79e1ad commit 2f2c692
Show file tree
Hide file tree
Showing 16 changed files with 184 additions and 285 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- build: macos-arm64
os: macos-latest
arch: arm64
macos_target: 'MACOSX_DEPLOYMENT_TARGET=11 CARGO_BUILD_TARGET=aarch64-apple-darwin'
macos_target: 'MACOSX_DEPLOYMENT_TARGET=11.0 CARGO_BUILD_TARGET=aarch64-apple-darwin'
fail-fast: false

steps:
Expand Down
21 changes: 5 additions & 16 deletions .github/workflows/dev_envs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,14 @@ jobs:
with:
fetch-depth: 0

- name: Cache nix store
id: cache-nix
uses: actions/cache@v3
- uses: cachix/install-nix-action@v18
with:
path: |
~/.nix-portable/store
~/bin/nix-portable
key: nix-${{ hashFiles('shell.nix') }}-${{ hashFiles('nix/**') }}-v009

- name: Install nix-portable
if: steps.cache-nix.outputs.cache-hit != 'true'
run: |
mkdir ~/bin
wget -qO ~/bin/nix-portable https://github.com/DavHau/nix-portable/releases/download/v009/nix-portable
chmod +x ~/bin/nix-portable
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- run: ~/bin/nix-portable nix-shell --command "tox -e py39"
- run: nix run .# -- --version

- run: ~/bin/nix-portable nix run . -- --version
- run: nix-shell --command "tox -e py39"

mamba:
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# note: to invalidate caches, adjust the pip-v? and tox-v? numbers below.
# note: to invalidate caches, adjust the pip-v? number below.
name: Python tests

on:
Expand All @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04, macos-latest]
py: ["3.10", "3.9", "3.8"]
py: ["3.11", "3.10", "3.9", "3.8"]
fail-fast: false

steps:
Expand All @@ -36,7 +36,7 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-v4-${{ hashFiles('**/setup.cfg') }}
key: ${{ runner.os }}-pip-v4-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-v4-
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
uses: actions/cache@v3
with:
path: .tox/
key: ${{ runner.os }}-tox-v4-${{ hashFiles('**/setup.cfg') }}
key: ${{ runner.os }}-tox-v4-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-tox-v4-
Expand Down
15 changes: 3 additions & 12 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,26 +268,17 @@ jobs:

- uses: actions-rs/toolchain@v1
with:
toolchain: 1.48.0
toolchain: 1.56.1
override: true

- name: check if README matches MSRV defined here
run: grep '1.48.0' src/core/README.md

- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .
run: grep '1.56.1' src/core/README.md

- name: Check if it builds properly
uses: actions-rs/cargo@v1
with:
command: build
args: --all-features

check_cbindgen:
name: "Check if cbindgen runs cleanly for generating the C headers"
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ src/sourmash/_lowlevel*.py
Pipfile
Pipfile.lock
target/
Cargo.lock
.eggs
.asv
pkg/
Expand Down
3 changes: 1 addition & 2 deletions asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"html_dir": ".asv/html",
"build_cache_size": 8,
"build_command": [
"python -m pip install 'setuptools_scm[toml]>=4,<6' milksnake",
"python setup.py build",
"python -m pip install 'setuptools_scm[toml]>=4,<6' milksnake maturin",
"PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}"
]
}
120 changes: 12 additions & 108 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2f2c692

Please sign in to comment.