Skip to content

Commit 2c70896

Browse files
committed
split CI build / publish jobs
1 parent 253b75e commit 2c70896

File tree

3 files changed

+41
-17
lines changed

3 files changed

+41
-17
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,35 @@ jobs:
1010
windows:
1111
runs-on: windows-latest
1212
steps:
13-
- uses: actions/checkout@v3
14-
- uses: PyO3/maturin-action@v1
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
- name: Build wheels
16+
uses: PyO3/maturin-action@v1
1517
with:
1618
command: build
1719
args: -m zbl_py/Cargo.toml --release -o dist --find-interpreter
20+
- name: Upload artifacts
21+
uses: actions/upload-artifact@v3
22+
with:
23+
name: dist
24+
path: dist
25+
publish:
26+
needs:
27+
- windows
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Get artifacts
31+
uses: actions/download-artifact@v2
32+
with:
33+
name: dist
34+
path: dist
1835
- name: Release
1936
uses: softprops/action-gh-release@v1
2037
if: startsWith(github.ref, 'refs/tags/')
2138
with:
2239
files: dist/*
2340
- name: Publish package to PyPI
24-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
41+
if: startsWith(github.ref, 'refs/tags')
2542
uses: pypa/gh-action-pypi-publish@release/v1
2643
with:
2744
password: ${{ secrets.PYPI_API_TOKEN }}

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
11
# zbl
22

3-
`zbl` is a Rust and Python library which provides a very simple interface for Microsoft's `Windows.Graphics.Capture` API
4-
and makes it easy to integrate CV libraries (such as OpenCV) with desktop apps.
3+
`zbl` is a Rust and Python library which aims to make it easy to integrate CV libraries (such as OpenCV) with
4+
Windows Desktop apps for real-time processing. It does so by providing a simplified interface to
5+
`Windows.Graphics.Capture`.
56

67
**This library is not well-tested against corner cases, and was only verified to work for a 'happy path' scenarios, so beware of bugs!**
78

8-
## Installation
9+
## Python
910

10-
Download and install suitable wheel from [releases page](https://github.com/modelflat/zbl/releases).
11+
### Installation
1112

12-
## Usage
13+
`pip install zbl`
1314

14-
### Python
15+
Alternatively, you can install suitable wheel from [releases page](https://github.com/modelflat/zbl/releases).
16+
17+
### Usage
1518

1619
```python
1720
from zbl import Capture
1821

19-
with Capture('<window name>') as cap:
22+
with Capture('visual studio code') as cap:
2023
frame = next(cap.frames())
2124
print(frame.shape)
2225
```
2326

27+
The snippet above will capture a window which title contains the string `visual studio code`, take one frame (which is represented as a `numpy` array) and print its shape.
28+
2429
To run an example using OpenCV's `highgui`:
2530

2631
1. Install `opencv-python`
2732
2. Run `python -m zbl '<full or partial window name, case insensitive>'`
2833

29-
### Rust
34+
## Rust
3035

3136
See [examples](https://github.com/modelflat/zbl/tree/master/zbl/examples).
3237
Note: if you are getting OpenCV build errors when building the example, check out [how to build OpenCV rust bindings](https://github.com/twistedfall/opencv-rust#rust-opencv-bindings).

zbl_py/pyproject.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
[build-system]
2-
requires = ["maturin>=0.13,<0.14"]
3-
build-backend = "maturin"
4-
51
[project]
62
name = "zbl"
7-
version = "0.0.1"
8-
license = { file = "../LICENSE.txt" }
3+
version = "0.0.3"
4+
readme = "../README.md"
95
requires-python = ">=3.7"
6+
license = { file = "../LICENSE.txt" }
7+
keywords = ["windows", "d3d11", "window-capture", "graphics-capture", "cv"]
108
dependencies = ["numpy"]
119
classifiers = [
1210
"Development Status :: 3 - Alpha",
@@ -18,3 +16,7 @@ classifiers = [
1816
example = [
1917
"opencv-python~=4.6.0"
2018
]
19+
20+
[build-system]
21+
requires = ["maturin>=0.13,<0.14"]
22+
build-backend = "maturin"

0 commit comments

Comments
 (0)