Skip to content

Commit

Permalink
Updated pyo3 and maturin to support python 3.11. Switched to using mw…
Browse files Browse the repository at this point in the history
…atelescope maturin docker image for pypi deployment and CI
  • Loading branch information
gsleap committed Nov 24, 2023
1 parent 3ccaabc commit 3b9dd14
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 56 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ rustup default 1.63
pip3 install --upgrade pip

# Setup maturin
pip3 install maturin==1.2.3
pip3 install maturin==1.3.2

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Build a release for each x86_64 microarchitecture level. v4 can't be
Expand All @@ -41,7 +41,7 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
export RUSTFLAGS="-C target-cpu=${level}"

# Build python first
MWALIB_LINK_STATIC_CFITSIO=1 maturin build --release --features python --strip -i 3.7 3.8 3.9 3.10 3.11
MWALIB_LINK_STATIC_CFITSIO=1 maturin build --release --features python --strip -i 3.8 3.9 3.10 3.11

# Build C objects
MWALIB_LINK_STATIC_CFITSIO=1 cargo build --release --features examples
Expand All @@ -59,7 +59,7 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install automake

# Build python first
MWALIB_LINK_STATIC_CFITSIO=1 maturin build --release --features python --strip -i 3.7 3.8 3.9 3.10 3.11
MWALIB_LINK_STATIC_CFITSIO=1 maturin build --release --features python --strip -i 3.8 3.9 3.10 3.11

# Build C objects
MWALIB_LINK_STATIC_CFITSIO=1 cargo build --release --features examples
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ jobs:
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov

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

- name: Generate test lcov coverage into coverage/ dir
run: |
pip3 install --upgrade pip
python3 -m venv env
source env/bin/activate
pip3 install maturin==1.2.3 pytest pytest-cov
pip3 install maturin==1.3.2 pytest pytest-cov
mkdir -p coverage
cargo llvm-cov clean --workspace
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v3

- name: Build mwalib
uses: docker://chjordan/maturin:latest
uses: docker://mwatelescope/maturin:latest
with:
entrypoint: /bin/bash
args: .github/workflows/build.sh
Expand All @@ -47,13 +47,7 @@ jobs:
with:
profile: minimal
toolchain: stable
override: true

- name: Add Python 3.7
uses: actions/setup-python@v2
with:
python-version: "3.7"
architecture: "x64"
override: true

- name: Add Python 3.8
uses: actions/setup-python@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run_python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11"]
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
python3 -m venv env
source env/bin/activate
pip3 install maturin==1.2.3
pip3 install maturin==1.3.2
if [[ "$OSTYPE" == "darwin"* ]]; then
brew install automake
fi
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Changes in each release are listed below.

## 1.2.1 24-Nov-2023

* Added pypi release for Python 3.11.
* Removed release wheels and pypi deployment for Python 3.7.

## 1.2.0 24-Nov-2023

* Added support and release for Python 3.11.
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mwalib"
version = "1.2.0"
version = "1.2.1"
homepage = "https://github.com/MWATelescope/mwalib"
repository = "https://github.com/MWATelescope/mwalib"
readme = "README.md"
Expand Down Expand Up @@ -41,8 +41,8 @@ regex = "~1.3.0"
thiserror = "1.0.3"

# "python" feature.
pyo3 = { version = "0.19.2", features = ["chrono", "extension-module"], optional = true }
numpy = { version = "0.19.0", optional = true }
pyo3 = { version = "0.20.0", features = ["chrono", "extension-module"], optional = true }
numpy = { version = "0.20.0", optional = true }
ndarray = { version = "0.15.6", optional = true }

# "examples" feature.
Expand Down
12 changes: 7 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ fn main() {
match env::var("DOCS_RS").as_deref() {
Ok("1") => (),
_ => {
let config: cbindgen::Config = cbindgen::Config {
cpp_compat: true,
pragma_once: true,
..Default::default()
};

cbindgen::Builder::new()
.with_config(cbindgen::Config {
cpp_compat: true,
pragma_once: true,
..Default::default()
})
.with_config(config)
.with_crate(env::var("CARGO_MANIFEST_DIR").unwrap())
.with_language(cbindgen::Language::C)
.generate()
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "mwalib"
description = "A library to work with raw data and metadata from the Murchison Widefield Array (MWA)"
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.8"
license = {file = "LICENSE"}
keywords = ["MWA", "radioastronomy"]
authors = [
Expand All @@ -18,10 +18,10 @@ classifiers = [
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Astronomy",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"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 :: Only"
]
dependencies = ["numpy"]
Expand Down
30 changes: 0 additions & 30 deletions tools/pypi_deploy/Dockerfile

This file was deleted.

0 comments on commit 3b9dd14

Please sign in to comment.