Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.2 #12

Merged
merged 8 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ jobs:

test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-13, windows-latest ]
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10']
exclude:
- python_version: 3.7
os: macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -51,13 +49,13 @@ jobs:
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get install mkcert
- name: Install mkcert (MacOS)
if: matrix.os == 'macos-12'
if: matrix.os == 'macos-13'
run: brew install mkcert
- name: Inject fake CA in TrustStore
if: matrix.os == 'macos-12' || matrix.os == 'ubuntu-22.04'
if: matrix.os == 'macos-13' || matrix.os == 'ubuntu-22.04'
run: mkcert -install
- name: Generate a valid certificate
if: matrix.os == 'macos-12' || matrix.os == 'ubuntu-22.04'
if: matrix.os == 'macos-13' || matrix.os == 'ubuntu-22.04'
run: mkcert example.test
- name: Build wheels (Unix, Linux)
if: matrix.os != 'windows-latest'
Expand Down Expand Up @@ -153,9 +151,6 @@ jobs:
python_version: 'pypy-3.9'
- target: aarch64
python_version: 'pypy-3.10'
# known bug pyo3+maturin fail to produce correct wheel
- target: aarch64
python_version: 3.13t
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -164,19 +159,28 @@ jobs:
python-version: ${{ matrix.python_version }}
architecture: x64
- uses: Quansight-Labs/setup-python@v5
if: matrix.python_version == '3.13t'
if: matrix.python_version == '3.13t' && matrix.target == 'x64'
with:
python-version: '3.13t'
architecture: x64
- name: Build wheels
- name: Build wheels (normal)
uses: PyO3/maturin-action@v1
if: matrix.python_version != '3.13t' || matrix.target == 'x64'
env:
UNSAFE_PYO3_SKIP_VERSION_CHECK: 1
PYO3_CROSS: ${{ matrix.target == 'aarch64' && '1' || '' }}
with:
target: ${{ matrix.target }}
args: --release --out dist
sccache: 'false'
- name: Build wheels (workaround 3.13t arm64)
uses: PyO3/maturin-action@v1
if: matrix.python_version == '3.13t' && matrix.target == 'aarch64'
env:
PYO3_CROSS: 1
with:
target: ${{ matrix.target }}
args: --release --out dist -i 3.13t
sccache: 'false'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
rev: v1.14.1
hooks:
- id: mypy
args: [--check-untyped-defs]
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to wassima will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## 1.2.0 (2025-01-12)

### Changed
- pyo3 updated from 0.23.3 to 0.23.4
- rustls-native-certs updated from 0.7 to 0.8

## 1.1.6 (2024-12-26)

### Changed
Expand Down
64 changes: 27 additions & 37 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
name = "wassima"
version = "1.1.6"
version = "1.2.0"
edition = "2021"

[lib]
name = "wassima"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.23.3", features = ["abi3-py37", "extension-module", "generate-import-lib"] }
rustls-native-certs = "0.7.3"
pyo3 = { version = "0.23.4", features = ["abi3-py37", "extension-module", "generate-import-lib"] }
rustls-native-certs = "0.8.1"

[package.metadata.maturin]
python-source = "wassima"
11 changes: 5 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ use pyo3::{prelude::*, types::PyBytes};
#[pyfunction]
fn root_der_certificates(py: Python) -> PyResult<Vec<Bound<'_, PyBytes>>> {
let mut roots = Vec::new();
let certs = rustls_native_certs::load_native_certs();

if certs.is_err() {
return Err(PyRuntimeError::new_err(
"unable to extract root certificates",
));
let container = rustls_native_certs::load_native_certs();

if container.certs.is_empty() {
return Err(PyRuntimeError::new_err("Failed to load native cert store"));
}

for cert in certs.unwrap() {
for cert in container.certs {
roots.push(PyBytes::new(py, cert.as_ref()));
}

Expand Down
16 changes: 10 additions & 6 deletions tests/test_ctx.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,24 @@ def test_ctx_use_system_store(host: str, port: int, expect_failure: bool) -> Non
s.close()


def serve():
def serve(server: http.server.HTTPServer):
context = SSLContext(PROTOCOL_TLS_SERVER)
context.load_cert_chain(
certfile="./example.test.pem", keyfile="./example.test-key.pem"
)
server_address = ("127.0.0.1", 47476)
httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler)
httpd.socket = context.wrap_socket(httpd.socket, server_side=True)
httpd.serve_forever()

server.socket = context.wrap_socket(server.socket, server_side=True)
server.serve_forever()


@pytest.mark.skipif(not exists("./example.test.pem"), reason="test requires mkcert")
def test_ctx_access_local_trusted_root() -> None:
ctx = create_default_ssl_context()

t = threading.Thread(target=serve)
server_address = ("127.0.0.1", 47476)
httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler)

t = threading.Thread(target=serve, args=(httpd,))
t.daemon = True
t.start()

Expand Down Expand Up @@ -141,3 +143,5 @@ def test_ctx_access_local_trusted_root() -> None:

assert s.getpeercert() is not None
s.close()

httpd.shutdown()
2 changes: 1 addition & 1 deletion wassima/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations

__version__ = "1.1.6"
__version__ = "1.2.0"
VERSION = __version__.split(".")