Skip to content

Commit

Permalink
Merge pull request #9 from jjfiv/pyo3
Browse files Browse the repository at this point in the history
Switch to Pyo3 for bindings to better support older pythons
  • Loading branch information
jjfiv authored May 31, 2022
2 parents b966a14 + 2fd8655 commit cb27a80
Show file tree
Hide file tree
Showing 23 changed files with 114 additions and 260 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/manylinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: maturin-build
run: |
rustup default 1.60.0
cd cffi && maturin build --release
cd python && maturin build --release
- uses: actions/upload-artifact@v1
name: upload-wheel
with:
Expand All @@ -29,5 +29,5 @@ jobs:
if: github.event_name == 'release'
env:
MATURIN_PASSWORD: ${{ secrets.QUIZDOWN_PYPI_TOKEN }}
run: cd cffi && maturin publish -b cffi --username __token__
run: cd python && maturin publish --username __token__

18 changes: 9 additions & 9 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,26 @@ jobs:
cargo test --release
- name: py-install
run: |
pip install -r cffi/requirements.txt
pip install --upgrade pip
pip install -U pip
pip install -r python/requirements.txt
pip install maturin bs4
- name: build-wheel
working-directory: ./cffi
working-directory: ./python
run: |
maturin build --release
pip install ../target/wheels/quizdown*.whl
- name: py-unittest
working-directory: ./cffi
run: |
python -I -m unittest discover -s tests -v
- uses: actions/upload-artifact@v1
name: upload-wheel
with:
name: ${{ matrix.platform }}-wheel
path: target/wheels/
- name: py-unittest
working-directory: ./python
run: |
python -I -m unittest discover -s tests -v
- name: '[on-create] pypi-publish'
if: github.event_name == 'release'
working-directory: ./cffi
working-directory: ./python
env:
MATURIN_PASSWORD: ${{ secrets.QUIZDOWN_PYPI_TOKEN }}
run: maturin publish -b cffi --username __token__
run: maturin publish --username __token__
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ venv
.mypy_cache
__pycache__
cffi/quizdown/quizdown
*.so
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
opt-level = 2

[workspace]
members = ["lib", "cli", "cffi", "wasm"]
members = ["lib", "cli", "wasm", "python"]
108 changes: 0 additions & 108 deletions cffi/quizdown/__init__.py

This file was deleted.

131 changes: 0 additions & 131 deletions cffi/src/lib.rs

This file was deleted.

File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions cffi/Cargo.toml → python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "quizdown"
version = "0.3.1"
version = "0.3.2"
authors = ["John Foley <johnf@middlebury.edu>"]
readme = "../README.md"
description = "A markdown subset for quickly making multiple-choice questions."
Expand All @@ -13,14 +13,15 @@ name = "quizdown"
crate-type = ["cdylib"]

[dependencies]
libc = "0.2"
serde = "1"
serde_json = "1"
serde_derive = "1"
quizdown_lib = {path = "../lib"}
pyo3 = {version="0.13", features=["extension-module", "abi3-py36"]}


[package.metadata.maturin]
requires-dist = ["cffi", "attrs", "jinja2"]
requires-dist = ["attrs", "jinja2"]
classifier = [
"Programming Language :: Python :: 3.6",
"Operating System :: OS Independent",
Expand Down
4 changes: 2 additions & 2 deletions cffi/build.sh → python/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eu
rm -rf quizdown/quizdown
source venv/bin/activate
pip install -q -r dev-requirements.txt
maturin build -b cffi
maturin develop -b cffi
maturin build
maturin develop
python -m unittest discover -s tests
python -m quizdown --help
4 changes: 2 additions & 2 deletions cffi/dev-requirements.txt → python/dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cffi
maturin
black
mypy
mypy
bs4
4 changes: 2 additions & 2 deletions cffi/package.sh → python/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ rm -rf quizdown/quizdown
source venv/bin/activate
pip install -q -r requirements.txt
pip install -q -r dev-requirements.txt
maturin build -b cffi --release
maturin develop -b cffi --release
maturin build --release
maturin develop --release
python -m quizdown --help
Loading

0 comments on commit cb27a80

Please sign in to comment.