Skip to content

Commit 60c7b61

Browse files
authored
Merge pull request #2 from TheCacophonyProject/pypi
Pypi
2 parents e2e1f54 + 2bb63fb commit 60c7b61

File tree

5 files changed

+65
-2
lines changed

5 files changed

+65
-2
lines changed

.travis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
dist: focal
2+
arch:
3+
- amd64
4+
- arm64
5+
language: python
6+
services:
7+
- docker
8+
python:
9+
- '3.10'
10+
- '3.11'
11+
12+
install:
13+
- python -m pip install --upgrade pip
14+
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile=minimal -y
15+
- export PATH=${TRAVIS_HOME}/.cargo/bin:$PATH
16+
- rustup update
17+
- python -m pip install --upgrade pip
18+
- cd python-bindings
19+
- pip install -r requirements.txt
20+
script:
21+
- ./build.sh
22+
before_deploy:
23+
- python3 -m pip install --upgrade build
24+
- pip install maturin
25+
- echo $'[pypi]\nusername = __token__\npassword = '$PYPI_TOKEN > ~/.pypirc
26+
deploy:
27+
- provider: script
28+
script: maturin publish
29+
on:
30+
repo: TheCacophonyProject/cptv-tools
31+
tags: true
32+
skip_cleanup: 'true'

python-bindings/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
To build the module run `./build.sh`, which will put a native module called `ctpv_rs_python_bindings.so` into
66
the `./examples` folder.
77
Then in a python virtual environment with `numpy` installed, you can run `python python-cptv-decoder.py` from inside
8-
the `examples` folder.
8+
the `examples` folder.
9+
10+
## Release to pypi
11+
12+
Update `pyproject.toml` version identifier then create a release on github this will upload a new version to https://pypi.org/project/python-cptv

python-bindings/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
cargo build --release
22
# Put the native lib in the examples folder.
3-
mv ../target/release/libcptv_rs_python_bindings.dylib ./examples/cptv_rs_python_bindings.so
3+
mv ../target/release/libcptv_rs_python_bindings.so ./examples/cptv_rs_python_bindings.so

python-bindings/pyproject.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[build-system]
2+
requires = ["maturin>=1.0,<2.0"]
3+
build-backend = "maturin"
4+
5+
[tool.maturin]
6+
# "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so)
7+
features = ["pyo3/extension-module"]
8+
9+
[project]
10+
name = "python-cptv"
11+
version = "0.0.4"
12+
authors = [
13+
{ name="Jon Hardie", email="Jon@cacophony.org.nz" },
14+
{ name = "Giampaolo Feraro", email = "Giampaolo@Cacophony.org.nz"}
15+
]
16+
description = "This is Python package provides for quick parsing Cacophony Project Thermal Video (CPTV) files. "
17+
readme = "README.md"
18+
requires-python = ">=3.8"
19+
classifiers = [
20+
"Programming Language :: Python :: 3",
21+
"License :: OSI Approved :: MIT License",
22+
"Operating System :: OS Independent",
23+
]
24+
dependencies = [
25+
"numpy"
26+
]

python-bindings/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
numpy

0 commit comments

Comments
 (0)