Skip to content

Commit

Permalink
Merge pull request #3288 from PyO3/release-0.19.1
Browse files Browse the repository at this point in the history
release: 0.19.1
  • Loading branch information
davidhewitt committed Jul 3, 2023
2 parents 2500e22 + dfe04e9 commit 489144a
Show file tree
Hide file tree
Showing 114 changed files with 1,363 additions and 950 deletions.
3 changes: 0 additions & 3 deletions .cargo/config
@@ -1,6 +1,3 @@
[alias]
xtask = "run --package xtask --"

[target.'cfg(feature = "cargo-clippy")']
rustflags = [
# TODO: remove these allows once msrv increased from 1.48
Expand Down
7 changes: 0 additions & 7 deletions .github/bors.toml

This file was deleted.

10 changes: 7 additions & 3 deletions .github/pull_request_template.md
@@ -1,10 +1,14 @@
Thank you for contributing to pyo3!
Thank you for contributing to PyO3!

By submitting these contributions you agree for them to be licensed under PyO3's [Apache-2.0 license](https://github.com/PyO3/pyo3#license).

PyO3 is currently undergoing a relicensing process to match Rust's dual-license under `Apache-2.0` and `MIT` licenses. While that process is ongoing, if you are a first-time contributor please add your agreement as a comment in [#3108](https://github.com/PyO3/pyo3/pull/3108).

Please consider adding the following to your pull request:
- an entry for this PR in newsfragments - see [https://pyo3.rs/main/contributing.html#documenting-changes]
- docs to all new functions and / or detail in the guide
- tests for all new or changed functions

PyO3's CI pipeline will check your pull request. To run its tests
locally, you can run ```cargo xtask ci```. See its documentation
[here](https://github.com/PyO3/pyo3/tree/main/xtask#readme).
locally, you can run ```nox```. See ```nox --list-sessions```
for a list of supported actions.
11 changes: 7 additions & 4 deletions .github/workflows/build.yml
Expand Up @@ -25,6 +25,7 @@ on:

jobs:
build:
continue-on-error: ${{ contains(fromJSON('["3.7", "3.12-dev", "pypy3.7", "pypy3.10"]'), inputs.python-version) }}
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -122,9 +123,11 @@ jobs:

- uses: dorny/paths-filter@v2
# pypy 3.7 and 3.8 are not PEP 3123 compliant so fail checks here
if: ${{ inputs.rust == 'stable' && inputs.python-version != 'pypy-3.7' && inputs.python-version != 'pypy-3.8' }}
if: ${{ inputs.rust == 'stable' && inputs.python-version != 'pypy3.7' && inputs.python-version != 'pypy3.8' }}
id: ffi-changes
with:
base: ${{ github.event.pull_request.base.ref || github.event.merge_group.base_ref }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
filters: |
changed:
- 'pyo3-ffi/**'
Expand All @@ -133,10 +136,10 @@ jobs:
- '.github/workflows/build.yml'
- name: Run pyo3-ffi-check
# pypy 3.7 and 3.8 are not PEP 3123 compliant so fail checks here, nor
# is pypy 3.9 on windows
if: ${{ steps.ffi-changes.outputs.changed == 'true' && inputs.rust == 'stable' && inputs.python-version != 'pypy3.7' && inputs.python-version != 'pypy3.8' && !(inputs.python-version == 'pypy3.9' && contains(inputs.os, 'windows')) }}
run: nox -s ffi-check
# Allow failure on PyPy for now
continue-on-error: ${{ startsWith(inputs.python-version, 'pypy') }}
if: ${{ steps.ffi-changes.outputs.changed == 'true' && inputs.rust == 'stable' && inputs.python-version != 'pypy-3.7' && inputs.python-version != 'pypy-3.8' }}


- name: Test cross compilation
Expand Down
58 changes: 36 additions & 22 deletions .github/workflows/ci.yml
Expand Up @@ -4,11 +4,9 @@ on:
push:
branches:
- main
# for bors r+
- staging
# for bors try
- trying
pull_request:
merge_group:
types: [checks_requested]
workflow_dispatch:

concurrency:
Expand All @@ -34,6 +32,32 @@ jobs:
- name: Check rust formatting (rustfmt)
run: nox -s fmt-rust

check-msrv:
needs: [fmt]
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.48.0
targets: x86_64-unknown-linux-gnu
components: clippy,rust-src
- uses: actions/setup-python@v4
with:
architecture: "x64"
- uses: Swatinem/rust-cache@v2
with:
key: check-msrv-1.48.0
continue-on-error: true
- run: python -m pip install --upgrade pip && pip install nox
- name: Prepare minimal package versions
run: nox -s set-minimal-package-versions
- run: nox -s check-all

env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu

clippy:
needs: [fmt]
runs-on: ${{ matrix.platform.os }}
Expand Down Expand Up @@ -80,16 +104,6 @@ jobs:
rust-target: "i686-pc-windows-msvc",
},
]
include:
- rust: 1.48.0
python-version: "3.11"
platform:
{
os: "ubuntu-latest",
python-architecture: "x64",
rust-target: "x86_64-unknown-linux-gnu",
}
msrv: "MSRV"
name: clippy/${{ matrix.platform.rust-target }}/${{ matrix.rust }}
steps:
- uses: actions/checkout@v3
Expand All @@ -106,15 +120,12 @@ jobs:
key: clippy-${{ matrix.platform.rust-target }}-${{ matrix.platform.os }}-${{ matrix.rust }}
continue-on-error: true
- run: python -m pip install --upgrade pip && pip install nox
- if: matrix.msrv == 'MSRV'
name: Prepare minimal package versions (MSRV only)
run: nox -s set-minimal-package-versions
- run: nox -s clippy-all
env:
CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }}

build-pr:
if: github.event_name == 'pull_request'
if: ${{ !contains(github.event.pull_request.labels.*.name, 'CI-build-full') && github.event_name == 'pull_request' }}
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} rust-${{ matrix.rust }}
needs: [fmt]
uses: ./.github/workflows/build.yml
Expand Down Expand Up @@ -158,7 +169,7 @@ jobs:
}
]
build-full:
if: ${{ github.event_name != 'pull_request' && github.ref != 'refs/heads/main' }}
if: ${{ contains(github.event.pull_request.labels.*.name, 'CI-build-full') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main') }}
name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} rust-${{ matrix.rust }}
needs: [fmt]
uses: ./.github/workflows/build.yml
Expand All @@ -183,9 +194,11 @@ jobs:
"3.9",
"3.10",
"3.11",
"pypy-3.7",
"pypy-3.8",
"pypy-3.9"
"3.12-dev",
"pypy3.7",
"pypy3.8",
"pypy3.9",
"pypy3.10",
]
platform:
[
Expand Down Expand Up @@ -353,6 +366,7 @@ jobs:
conclusion:
needs:
- fmt
- check-msrv
- clippy
- build-pr
- build-full
Expand Down
32 changes: 28 additions & 4 deletions .netlify/build.sh
Expand Up @@ -17,21 +17,45 @@ mv pyo3-gh-pages netlify_build
## Configure netlify _redirects file

# Add redirect for each documented version
set +x # these loops get very spammy and fill the deploy log

for d in netlify_build/v*; do
version="${d/netlify_build\/v/}"
echo "/v$version/doc/* https://docs.rs/pyo3/$version/:splat" >> netlify_build/_redirects
if [ $version != $PYO3_VERSION ]; then
# for old versions, mark the files in the latest version as the canonical URL
for file in $(find $d -type f); do
file_path="${file/$d\//}"
# remove index.html and/or .html suffix to match the page URL on the
# final netlfiy site
url_path="$file_path"
if [[ $file_path == index.html ]]; then
url_path=""
elif [[ $file_path == *.html ]]; then
url_path="${file_path%.html}"
fi
echo "/v$version/$url_path" >> netlify_build/_headers
if test -f "netlify_build/v$PYO3_VERSION/$file_path"; then
echo " Link: <https://pyo3.rs/v$PYO3_VERSION/$url_path>; rel=\"canonical\"" >> netlify_build/_headers
else
# this file doesn't exist in the latest guide, don't index it
echo " X-Robots-Tag: noindex" >> netlify_build/_headers
fi
done
fi
done

# Add latest redirect
echo "/latest/* /v${PYO3_VERSION}/:splat" >> netlify_build/_redirects
echo "/latest/* /v${PYO3_VERSION}/:splat 302" >> netlify_build/_redirects

## Add landing page redirect
if [ "${CONTEXT}" == "deploy-preview" ]; then
echo "/ /main/" >> netlify_build/_redirects
else
echo "/ /v${PYO3_VERSION}/" >> netlify_build/_redirects
echo "/ /v${PYO3_VERSION}/ 302" >> netlify_build/_redirects
fi

set -x
## Generate towncrier release notes

pip install towncrier
Expand All @@ -53,15 +77,15 @@ mv target/guide netlify_build/main/

## Build public docs

cargo xtask doc
nox -s docs
mv target/doc netlify_build/main/doc/

echo "<meta http-equiv=refresh content=0;url=pyo3/>" > netlify_build/main/doc/index.html

## Build internal docs

echo "<div class='internal-banner' style='position:fixed; z-index: 99999; color:red;border:3px solid red;margin-left: auto; margin-right: auto; width: 430px;left:0;right: 0;'><div style='display: flex; align-items: center; justify-content: center;'> ⚠️ Internal Docs ⚠️ Not Public API 👉 <a href='https://pyo3.rs/main/doc/pyo3/index.html' style='color:red;text-decoration:underline;'>Official Docs Here</a></div></div>" > netlify_build/banner.html
RUSTDOCFLAGS="--html-before-content netlify_build/banner.html" cargo xtask doc --internal
RUSTDOCFLAGS="--html-before-content netlify_build/banner.html" nox -s docs -- nightly internal
rm netlify_build/banner.html

mkdir -p netlify_build/internal
Expand Down
28 changes: 27 additions & 1 deletion CHANGELOG.md
Expand Up @@ -10,6 +10,31 @@ To see unreleased changes, please see the [CHANGELOG on the main branch guide](h

<!-- towncrier release notes start -->

## [0.19.1] - 2023-07-03

### Packaging

- Extend range of supported versions of `hashbrown` optional dependency to include version 0.14 [#3258](https://github.com/PyO3/pyo3/pull/3258)
- Extend range of supported versions of `indexmap` optional dependency to include version 2. [#3277](https://github.com/PyO3/pyo3/pull/3277)
- Support PyPy 3.10. [#3289](https://github.com/PyO3/pyo3/pull/3289)

### Added

- Add `pyo3::types::PyFrozenSetBuilder` to allow building a `PyFrozenSet` item by item. [#3156](https://github.com/PyO3/pyo3/pull/3156)
- Add support for converting to and from Python's `ipaddress.IPv4Address`/`ipaddress.IPv6Address` and `std::net::IpAddr`. [#3197](https://github.com/PyO3/pyo3/pull/3197)
- Add support for `num-bigint` feature in combination with `abi3`. [#3198](https://github.com/PyO3/pyo3/pull/3198)
- Add `PyErr_GetRaisedException()`, `PyErr_SetRaisedException()` to FFI definitions for Python 3.12 and later. [#3248](https://github.com/PyO3/pyo3/pull/3248)
- Add `Python::with_pool` which is a safer but more limited alternative to `Python::new_pool`. [#3263](https://github.com/PyO3/pyo3/pull/3263)
- Add `PyDict::get_item_with_error` on PyPy. [#3270](https://github.com/PyO3/pyo3/pull/3270)
- Allow `#[new]` methods may to return `Py<Self>` in order to return existing instances. [#3287](https://github.com/PyO3/pyo3/pull/3287)

### Fixed

- Fix conversion of classes implementing `__complex__` to `Complex` when using `abi3` or PyPy. [#3185](https://github.com/PyO3/pyo3/pull/3185)
- Stop suppressing unrelated exceptions in `PyAny::hasattr`. [#3271](https://github.com/PyO3/pyo3/pull/3271)
- Fix memory leak when creating `PySet` or `PyFrozenSet` or returning types converted into these internally, e.g. `HashSet` or `BTreeSet`. [#3286](https://github.com/PyO3/pyo3/pull/3286)


## [0.19.0] - 2023-05-31

### Packaging
Expand Down Expand Up @@ -1478,7 +1503,8 @@ Yanked

- Initial release

[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.19.0...HEAD
[Unreleased]: https://github.com/pyo3/pyo3/compare/v0.19.1...HEAD
[0.19.1]: https://github.com/pyo3/pyo3/compare/v0.19.0...v0.19.1
[0.19.0]: https://github.com/pyo3/pyo3/compare/v0.18.3...v0.19.0
[0.18.3]: https://github.com/pyo3/pyo3/compare/v0.18.2...v0.18.3
[0.18.2]: https://github.com/pyo3/pyo3/compare/v0.18.1...v0.18.2
Expand Down
15 changes: 6 additions & 9 deletions Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pyo3"
version = "0.19.0"
version = "0.19.1"
description = "Bindings to Python interpreter"
authors = ["PyO3 Project and Contributors <https://github.com/PyO3>"]
readme = "README.md"
Expand All @@ -20,10 +20,10 @@ parking_lot = ">= 0.11, < 0.13"
memoffset = "0.9"

# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
pyo3-ffi = { path = "pyo3-ffi", version = "=0.19.0" }
pyo3-ffi = { path = "pyo3-ffi", version = "=0.19.1" }

# support crates for macros feature
pyo3-macros = { path = "pyo3-macros", version = "=0.19.0", optional = true }
pyo3-macros = { path = "pyo3-macros", version = "=0.19.1", optional = true }
indoc = { version = "1.0.3", optional = true }
unindent = { version = "0.1.4", optional = true }

Expand All @@ -34,8 +34,8 @@ inventory = { version = "0.3.0", optional = true }
anyhow = { version = "1.0", optional = true }
chrono = { version = "0.4", default-features = false, optional = true }
eyre = { version = ">= 0.4, < 0.7", optional = true }
hashbrown = { version = ">= 0.9, < 0.14", optional = true }
indexmap = { version = "1.6", optional = true }
hashbrown = { version = ">= 0.9, < 0.15", optional = true }
indexmap = { version = ">= 1.6, < 3", optional = true }
num-bigint = { version = "0.4", optional = true }
num-complex = { version = ">= 0.2, < 0.5", optional = true }
rust_decimal = { version = "1.0.0", default-features = false, optional = true }
Expand All @@ -58,7 +58,7 @@ rust_decimal = { version = "1.8.0", features = ["std"] }
widestring = "0.5.1"

[build-dependencies]
pyo3-build-config = { path = "pyo3-build-config", version = "0.19.0", features = ["resolve-config"] }
pyo3-build-config = { path = "pyo3-build-config", version = "0.19.1", features = ["resolve-config"] }

[features]
default = ["macros"]
Expand Down Expand Up @@ -176,14 +176,11 @@ harness = false
[workspace]
members = [
"pyo3-ffi",
"pyo3-ffi-check",
"pyo3-ffi-check/macro",
"pyo3-build-config",
"pyo3-macros",
"pyo3-macros-backend",
"pytests",
"examples",
"xtask"
]

[package.metadata.docs.rs]
Expand Down
10 changes: 6 additions & 4 deletions Contributing.md
Expand Up @@ -51,7 +51,7 @@ There are some specific areas of focus where help is currently needed for the do
You can build the docs (including all features) with

```shell
cargo xtask doc --open
nox -s docs -- open
```

#### Doctests
Expand Down Expand Up @@ -95,8 +95,10 @@ Tests run with all supported Python versions with the latest stable Rust compile
If you are adding a new feature, you should add it to the `full` feature in our *Cargo.toml** so that it is tested in CI.

You can run these tests yourself with
```cargo xtask ci```
See [its documentation](https://github.com/PyO3/pyo3/tree/main/xtask#readme) for more commands you can run.
```nox```
and
```nox -l```
lists further commands you can run.

### Documenting changes

Expand Down Expand Up @@ -145,7 +147,7 @@ You can view what code is and isn't covered by PyO3's tests. We aim to have 100%

- First, generate a `lcov.info` file with
```shell
cargo xtask coverage
nox -s coverage
```
You can install an IDE plugin to view the coverage. For example, if you use VSCode:
- Add the [coverage-gutters](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters) plugin.
Expand Down

0 comments on commit 489144a

Please sign in to comment.