Skip to content

Commit 2e291a9

Browse files
authored
Merge pull request #66 from YuanYuYuan/PR-maturin
Use maturin for building zenoh-python. Propose to resolve #64.
2 parents 61eb269 + f5ee77d commit 2e291a9

File tree

8 files changed

+132
-178
lines changed

8 files changed

+132
-178
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
submodules: true
2626

2727
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v1
28+
uses: actions/setup-python@v2
2929
with:
3030
python-version: ${{ matrix.python-version }}
3131

@@ -36,7 +36,7 @@ jobs:
3636
components: rustfmt, clippy
3737

3838
- name: Build zenoh-python
39-
run: python3 ./setup.py develop
39+
uses: messense/maturin-action@v1
4040

4141
- name: Clippy
4242
uses: actions-rs/cargo@v1

.github/workflows/release.yml

Lines changed: 90 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -7,91 +7,108 @@ on:
77
- cron: "0 1 * * 1-5"
88
workflow_dispatch:
99

10+
env:
11+
PYTHON_VERSION: "3.7"
12+
1013
jobs:
11-
sdist:
12-
name: Build sdist
14+
macos:
15+
runs-on: macos-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ env.PYTHON_VERSION }}
21+
architecture: x64
22+
- name: Install Rust toolchain
23+
uses: actions-rs/toolchain@v1
24+
with:
25+
toolchain: stable
26+
profile: minimal
27+
default: true
28+
- name: Build wheels - x86_64
29+
uses: messense/maturin-action@v1
30+
with:
31+
target: x86_64
32+
args: --release --out dist
33+
- name: Build wheels - universal2
34+
uses: messense/maturin-action@v1
35+
with:
36+
args: --release --universal2 --out dist --no-sdist
37+
- name: Upload wheels
38+
uses: actions/upload-artifact@v2
39+
with:
40+
name: wheels
41+
path: dist
42+
43+
windows:
44+
runs-on: windows-latest
45+
strategy:
46+
matrix:
47+
target: [x64, x86]
48+
steps:
49+
- uses: actions/checkout@v2
50+
- uses: actions/setup-python@v2
51+
with:
52+
python-version: ${{ env.PYTHON_VERSION }}
53+
architecture: ${{ matrix.target }}
54+
- name: Install Rust toolchain
55+
uses: actions-rs/toolchain@v1
56+
with:
57+
toolchain: stable
58+
profile: minimal
59+
default: true
60+
- name: Build wheels
61+
uses: messense/maturin-action@v1
62+
with:
63+
target: ${{ matrix.target }}
64+
args: --release --out dist --no-sdist
65+
- name: Upload wheels
66+
uses: actions/upload-artifact@v2
67+
with:
68+
name: wheels
69+
path: dist
70+
71+
linux:
1372
runs-on: ubuntu-latest
73+
strategy:
74+
matrix:
75+
target: [x86_64, i686]
1476
steps:
1577
- uses: actions/checkout@v2
1678
- uses: actions/setup-python@v2
17-
name: Install Python
1879
with:
19-
python-version: "3.9"
20-
- name: Install deps
21-
run: pip install -U twine setuptools-rust
22-
- name: Build sdist
23-
run: python setup.py sdist
24-
- uses: actions/upload-artifact@v2
80+
python-version: ${{ env.PYTHON_VERSION }}
81+
architecture: x64
82+
- name: Build wheels
83+
uses: messense/maturin-action@v1
84+
with:
85+
target: ${{ matrix.target }}
86+
manylinux: auto
87+
args: --release --out dist --no-sdist
88+
- name: Upload wheels
89+
uses: actions/upload-artifact@v2
2590
with:
26-
name: Sources
27-
path: ./dist/*
91+
name: wheels
92+
path: dist
2893

29-
build_wheels:
30-
name: Build wheel for ${{ matrix.job.os }} ${{ matrix.job.arch }}
31-
runs-on: ${{ matrix.job.runner }}
94+
linux-cross:
95+
runs-on: ubuntu-latest
3296
strategy:
33-
fail-fast: false
3497
matrix:
35-
job:
36-
- {
37-
os: Linux,
38-
arch: x86_64,
39-
runner: ubuntu-latest,
40-
env: 'PATH="$PATH:$HOME/.cargo/bin"',
41-
}
42-
- {
43-
os: Linux,
44-
arch: i686,
45-
runner: ubuntu-latest,
46-
env: 'PATH="$PATH:$HOME/.cargo/bin"',
47-
}
48-
- {
49-
os: Linux,
50-
arch: aarch64,
51-
runner: ubuntu-latest,
52-
env: 'PATH="$PATH:$HOME/.cargo/bin"',
53-
}
54-
- { os: Windows, arch: AMD64, runner: windows-latest }
55-
- {
56-
os: MacOS,
57-
arch: x86_64,
58-
runner: macos-latest,
59-
env: MACOSX_DEPLOYMENT_TARGET=10.9,
60-
}
61-
- {
62-
os: MacOS,
63-
arch: arm64,
64-
runner: macos-latest,
65-
env: MACOSX_DEPLOYMENT_TARGET=10.9 CARGO_BUILD_TARGET="aarch64-apple-darwin" PYO3_CROSS_LIB_DIR="/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8",
66-
}
67-
- {
68-
os: MacOS,
69-
arch: universal2,
70-
runner: macos-latest,
71-
env: MACOSX_DEPLOYMENT_TARGET=10.9 CARGO_BUILD_TARGET="aarch64-apple-darwin" PYO3_CROSS_LIB_DIR="/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8",
72-
}
98+
target: [aarch64, armv7]
7399
steps:
74100
- uses: actions/checkout@v2
75-
- name: Set up QEMU
76-
if: matrix.job.os == 'Linux'
77-
uses: docker/setup-qemu-action@v1
101+
- uses: actions/setup-python@v2
78102
with:
79-
platforms: all
103+
python-version: ${{ env.PYTHON_VERSION }}
80104
- name: Build wheels
81-
uses: pypa/[email protected]
82-
env:
83-
CIBW_ARCHS: ${{ matrix.job.arch }}
84-
CIBW_BUILD: cp38-*
85-
CIBW_SKIP: "*win32"
86-
CIBW_ENVIRONMENT: ${{ matrix.job.env }}
87-
CIBW_BEFORE_ALL_LINUX: "yum install -y wget && wget https://sh.rustup.rs -O rustup-install.sh && sh rustup-install.sh -y"
88-
CIBW_BEFORE_ALL_MACOS: |
89-
case ${{ matrix.job.arch }} in
90-
arm64|universal2)
91-
rustup target add aarch64-apple-darwin ;;
92-
esac
93-
CIBW_BEFORE_BUILD: pip install -U setuptools-rust
94-
- uses: actions/upload-artifact@v2
105+
uses: messense/maturin-action@v1
106+
with:
107+
target: ${{ matrix.target }}
108+
manylinux: auto
109+
args: --release --out dist --no-sdist
110+
- name: Upload wheels
111+
uses: actions/upload-artifact@v2
95112
with:
96-
name: Wheels
97-
path: ./wheelhouse/*.whl
113+
name: wheels
114+
path: dist

Cargo.toml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,5 @@ uhlc = "0.4.0"
4646
futures = "0.3.12"
4747
log = "0.4"
4848
env_logger = "0.9.0"
49-
pyo3-asyncio = { version = "0.15", features = [
50-
"attributes",
51-
"async-std-runtime",
52-
] }
53-
54-
[dependencies.pyo3]
55-
version = "0.15"
56-
features = ["extension-module", "abi3-py36"]
49+
pyo3 = { version = "0.16", features = ["extension-module", "abi3-py37"] }
50+
pyo3-asyncio = { version = "0.16", features = ["attributes", "async-std-runtime"] }

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@
99

1010
# Eclipse zenoh Python API
1111

12-
[Eclipse zenoh](http://zenoh.io) is an extremely efficient and fault-tolerant [Named Data Networking](http://named-data.net) (NDN) protocol
12+
[Eclipse zenoh](http://zenoh.io) is an extremely efficient and fault-tolerant [Named Data Networking](http://named-data.net) (NDN) protocol
1313
that is able to scale down to extremely constrainded devices and networks.
1414

1515
Check the website [zenoh.io](http://zenoh.io) and the [roadmap](https://github.com/eclipse-zenoh/roadmap) for more detailed information.
1616

1717
-------------------------------
1818
## How to install it
1919

20-
The Eclipse zenoh-python library is available on [Pypi.org](https://pypi.org/project/eclipse-zenoh/).
20+
The Eclipse zenoh-python library is available on [Pypi.org](https://pypi.org/project/eclipse-zenoh/).
2121
Install the latest available version using `pip`:
2222
```
2323
pip install eclipse-zenoh
2424
```
2525

2626
:warning:WARNING:warning: zenoh-python is developped in Rust.
27-
On Pypi.org we provide binary wheels for the most common platforms (MacOS, Linux x86). But also a source distribution package for other platforms.
27+
On Pypi.org we provide binary wheels for the most common platforms (MacOS, Linux x86). But also a source distribution package for other platforms.
2828
However, for `pip` to be able to build this source distribution, there some prerequisites:
29-
- `pip` version 19.3.1 minimum (for full support of PEP 517).
29+
- `pip` version 19.3.1 minimum (for full support of PEP 517).
3030
(if necessary upgrade it with command: `'sudo pip install --upgrade pip'` )
3131
- Have a Rust toolchain installed (instructions at https://rustup.rs/)
3232

@@ -41,7 +41,7 @@ It relies on the [zenoh](https://github.com/eclipse-zenoh/zenoh/tree/master/zeno
4141
## How to build it
4242

4343
Requirements:
44-
* Python >= 3.6
44+
* Python >= 3.7
4545
* pip >= 19.3.1
4646
* [Rust and Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html).
4747

@@ -52,7 +52,7 @@ Steps:
5252
```
5353
* Build zenoh-python
5454
```bash
55-
python setup.py develop
55+
maturin build --release
5656
```
5757

5858
This will automatically build the zenoh Rust API, as well as the zenoh-python API and install it in your Python environement.

pyproject.toml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,34 @@
1515
#
1616

1717
[build-system]
18-
requires = ["setuptools", "wheel", "setuptools-rust"]
18+
requires = ["maturin>=0.12,<0.13"]
19+
build-backend = "maturin"
20+
21+
[project]
22+
name = "eclipse-zenoh"
23+
description = "The python API for Eclipse zenoh"
24+
requires-python = ">=3.7"
25+
author = "ZettaScale Zenoh team"
26+
author_email = "[email protected]"
27+
classifiers = [
28+
"Programming Language :: Python :: 3 :: Only",
29+
"Programming Language :: Python :: 3.7",
30+
"Programming Language :: Python :: 3.8",
31+
"Programming Language :: Python :: 3.9",
32+
"Programming Language :: Python :: 3.10",
33+
"Programming Language :: Rust",
34+
"Intended Audience :: Developers",
35+
"Development Status :: 4 - Beta",
36+
"Topic :: System :: Networking",
37+
"License :: OSI Approved :: Apache Software License",
38+
"License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)",
39+
"Operating System :: POSIX :: Linux",
40+
"Operating System :: MacOS :: MacOS X",
41+
"Operating System :: Microsoft :: Windows",
42+
]
43+
zip_safe = false
44+
45+
[project.urls]
46+
"Bug Tracker" = "https://github.com/eclipse-zenoh/zenoh-python/issues"
47+
"Source Code" = "https://github.com/eclipse-zenoh/zenoh-python"
48+
"Documentation" = "https://readthedocs.org/projects/zenoh-python/"

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
setuptools-rust>=0.10.2
1+
maturin>=0.12.18

setup.cfg

Lines changed: 0 additions & 17 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)