Skip to content

Commit

Permalink
uprev pyo3 and minimum rust version (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin authored May 6, 2024
1 parent dd04802 commit b4a6822
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 50 deletions.
54 changes: 28 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
rust-version: [stable, '1.56.0']
rust-version: [stable, '1.63.0']
python-version:
- '3.8'
- '3.9'
Expand All @@ -26,9 +26,9 @@ jobs:
- 'pypy3.9'
- 'pypy3.10'
exclude:
- rust-version: '1.56.0'
- rust-version: '1.63.0'
os: macos
- rust-version: '1.56.0'
- rust-version: '1.63.0'
os: windows

runs-on: ${{ matrix.os }}-latest
Expand All @@ -39,10 +39,10 @@ jobs:
OS: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -83,9 +83,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand All @@ -111,10 +111,10 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand All @@ -125,7 +125,7 @@ jobs:
run: mkdocs build

- name: store docs site
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: docs
path: site
Expand Down Expand Up @@ -186,12 +186,12 @@ jobs:
runs-on: ${{ matrix.os }}-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'
architecture: ${{ matrix.python-architecture || 'x64' }}

- name: set package version
Expand All @@ -204,44 +204,45 @@ jobs:

- name: build sdist
if: ${{ matrix.os == 'ubuntu' && matrix.target == 'x86_64' && matrix.manylinux == 'auto' }}
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist

- name: build wheels
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux || 'auto' }}
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12' }}

- name: build pypy wheels
if: ${{ matrix.pypy }}
uses: messense/maturin-action@v1
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux || 'auto' }}
args: --release --out dist --interpreter pypy3.8 pypy3.9 pypy3.10

- run: ${{ matrix.ls || 'ls -lh' }} dist/

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: pypi_files
name: pypi_files_${{ matrix.os }}_${{ matrix.target }}_${{ matrix.interpreter || 'all' }}_${{ matrix.manylinux }}
path: dist

list-pypi-files:
needs: [build]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: get dist artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: pypi_files
pattern: pypi_files_*
merge-multiple: true
path: dist

- name: list dist files
Expand Down Expand Up @@ -281,23 +282,24 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: set up python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

- run: pip install twine

- name: get dist artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: pypi_files
pattern: pypi_files_*
merge-multiple: true
path: dist

- name: get docs
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: docs
path: site
Expand Down
32 changes: 14 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ include = [
"!tests/.pytest_cache",
"!*.so",
]
rust-version = "1.63"

[dependencies]
crossbeam-channel = "0.5.4"
crossbeam-channel = "0.5.12"
notify = "5.0.0"
pyo3 = {version = "=0.20", features = ["extension-module", "generate-import-lib"]}
pyo3 = {version = "0.21.2", features = ["extension-module", "generate-import-lib"]}

[lib]
name = "_rust_notify"
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl RustNotify {
}

pub fn watch(
slf: &PyCell<Self>,
slf: &Bound<Self>,
py: Python,
debounce_ms: u64,
step_ms: u64,
Expand Down Expand Up @@ -289,7 +289,7 @@ impl RustNotify {
}

if let Some(is_set) = stop_event_is_set {
if is_set.call0()?.is_true()? {
if is_set.call0()?.is_truthy()? {
if slf.borrow().debug {
eprintln!("stop event set, stopping...");
}
Expand Down Expand Up @@ -350,7 +350,7 @@ impl RustNotify {
}

#[pymodule]
fn _rust_notify(py: Python, m: &PyModule) -> PyResult<()> {
fn _rust_notify(py: Python, m: &Bound<PyModule>) -> PyResult<()> {
let mut version = env!("CARGO_PKG_VERSION").to_string();
// cargo uses "1.0-alpha1" etc. while python uses "1.0.0a1", this is not full compatibility,
// but it's good enough for now
Expand All @@ -361,7 +361,7 @@ fn _rust_notify(py: Python, m: &PyModule) -> PyResult<()> {
m.add("__version__", version)?;
m.add(
"WatchfilesRustInternalError",
py.get_type::<WatchfilesRustInternalError>(),
py.get_type_bound::<WatchfilesRustInternalError>(),
)?;
m.add_class::<RustNotify>()?;
Ok(())
Expand Down

0 comments on commit b4a6822

Please sign in to comment.