Skip to content

Commit

Permalink
Minor fixes in packaging to make it compatible with maturin 1.4.0 (#39)
Browse files Browse the repository at this point in the history
* Build package with maturin 1.4.0

* Loosen maturin version requirement

* Remove pyo3 from install instructions in README

* Remove empty package.metadata.maturin section

* Fix the builds

* Update action versions

* Lock maturin to major version

* Bump version of python package to 1.2.1

* Add building src-dist in ubuntu build

* Update build.yml

Writing out the sha256 checksum for the sdist in `dist/`

* Update README.md

We should probably support 3.12 as well, since it's a final release. It *should* work, since we're specifically only targeting the broader python 3 abi with this. I should write some simple unit tests that run across the full matrix of python versions. That's a fix for me to do, though.

* Update pyproject.toml

3.12 support! We think!

---------

Co-authored-by: Dax Pryce <[email protected]>
  • Loading branch information
johandahlberg and daxpryce authored Jan 23, 2024
1 parent 3eba7c4 commit 4a06a86
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 30 deletions.
41 changes: 22 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ jobs:
codestyle-check:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Check format
run: |
cargo fmt -- --check
version:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Materialize build number
run: |
pip install -U pip
pip install toml
python .github/build/manifest_version.py packages/pyo3/Cargo.toml version.txt
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: cargo-toml
path: packages/pyo3/Cargo.toml
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: version-txt
path: version.txt
Expand All @@ -37,12 +37,12 @@ jobs:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.9
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: cargo-toml
path: materialized
Expand All @@ -58,31 +58,33 @@ jobs:
# the same steps except for the build, we conditionally do one of the builds depending on the os in question
# note that windows and mac don't do sdists, but ubuntu does; this is just because we don't need to repeat
# ourselves or overwrite the .tar.gz sdist.
- uses: messense/maturin-action@v1

- uses: PyO3/maturin-action@v1
if: ${{ matrix.os == 'windows-latest' }}
name: Maturin Build for Windows
with:
maturin-version: latest
maturin-version: 1.4.0
command: build
target: x64
args: -m packages/pyo3/Cargo.toml --release -i ${{env.pythonLocation}}\python.exe

- uses: messense/maturin-action@v1
- uses: PyO3/maturin-action@v1
if: ${{ matrix.os == 'macos-latest' }}
name: Maturin Build for MacOS
with:
maturin-version: latest
maturin-version: 1.4.0
command: build
args: -m packages/pyo3/Cargo.toml --release --universal2
target: universal2-apple-darwin
args: -m packages/pyo3/Cargo.toml --release

- uses: messense/maturin-action@v1
- uses: PyO3/maturin-action@v1
if: ${{ matrix.os == 'ubuntu-latest' }}
name: Maturin Build for Linux
with:
maturin-version: latest
maturin-version: 1.4.0
command: build
target: x64
args: -m packages/pyo3/Cargo.toml --release
args: -m packages/pyo3/Cargo.toml --release --sdist
manylinux: 2014

- name: Python Unittests
Expand All @@ -102,20 +104,21 @@ jobs:
needs: 'build'
if: github.ref=='refs/heads/main' || github.ref=='refs/heads/dev'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Generate SHA256 files for each wheel
run: |
sha256sum dist/*.whl > checksums.txt
sha256sum dist/*.tar.gz >> checksums.txt
cat checksums.txt
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: version-txt
path: version/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ git clone [email protected]:microsoft/graspologic-native.git
cd graspologic-native
python3.8 -m venv venv
pip install -U pip setuptools wheel
pip install pyo3 maturin
pip install maturin
cd packages/pyo3
maturin build --release -i python3.8 # this is where things break on windows. instead of `python3.8` here, you will need the full path to the correct python.exe on your windows machine, something like `-i "C:\python38\bin\python.exe"`
```
Expand Down
9 changes: 1 addition & 8 deletions packages/pyo3/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
[package]
name = "graspologic_native"
version = "1.2.0"
version = "1.2.1"
authors = ["[email protected]"]
edition = "2018"
license = "MIT"
description = "Python native companion module to the graspologic library"
readme = "README.md"

[package.metadata.maturin]
maintainer = "Dax Pryce"
maintainer-email = "[email protected]"
requires-python = ">=3.6,<3.12"
project-url = {"Github" = "https://github.com/microsoft/graspologic-native", "Graspologic"="https://github.com/microsoft/graspologic"}
classifier = ["Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering :: Mathematics"]

[lib]
name = "graspologic_native"
crate-type = ["rlib","cdylib"]
Expand Down
2 changes: 1 addition & 1 deletion packages/pyo3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ implementation provided at [https://github.com/CWTSLeiden/networkanalysis](https
was used as a starting point.

## Releases
Builds are provided for x86_64 architectures only, for Windows, macOS, and Linux, for Python versions 3.6->3.9.
Builds are provided for x86_64 architectures only, for Windows, macOS, and Linux, for Python versions 3.6->3.12.

## Build Tools
Rust nightly 1.37+ (we are currently using 1.40)
Expand Down
25 changes: 24 additions & 1 deletion packages/pyo3/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
[project]
name = "graspologic-native"
maintainer = "Dax Pryce"
maintainer-email = "[email protected]"
requires-python = ">=3.6,<3.13"
classifier = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Mathematics"]

[project.urls]
Github = "https://github.com/microsoft/graspologic-native"
Graspologic = "https://github.com/microsoft/graspologic"


[build-system]
requires = ["maturin>=0.12,<0.13"]
requires = ["maturin>=1.4,<2.0"]
build-backend = "maturin"

0 comments on commit 4a06a86

Please sign in to comment.