Skip to content

Commit ebe89e2

Browse files
committed
fix: migrate from httpx to httpx2
1 parent 8ffcedc commit ebe89e2

20 files changed

Lines changed: 871 additions & 614 deletions

‎README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
A SCIM client Python library built upon [scim2-models](https://scim2-models.readthedocs.io) ,
44
that pythonically build requests and parse responses,
55
following the [RFC7643](https://datatracker.ietf.org/doc/html/rfc7643.html) and [RFC7644](https://datatracker.ietf.org/doc/html/rfc7644.html) specifications.
6-
You can use whatever request engine you prefer to perform network requests, but scim2-client comes with [httpx](https://github.com/encode/httpx) support.
6+
You can use whatever request engine you prefer to perform network requests, but scim2-client comes with [httpx2](https://github.com/pydantic/httpx2) support.
77

88
It aims to be used in SCIM client applications, or in unit tests for SCIM server applications.
99

@@ -21,14 +21,14 @@ It allows users and groups creations, modifications and deletions to be synchron
2121
- **Server Discovery**: Automatic retrieval of `ServiceProviderConfig`, `ResourceTypes` and `Schemas`
2222
- **Search & Filtering**: Support for SCIM filters, sorting, pagination and attribute selection
2323
- **Sync & Async**: Both synchronous and asynchronous clients available
24-
- **Multiple HTTP Engines**: Built-in support for [httpx](https://github.com/encode/httpx) (sync/async) and [werkzeug](https://werkzeug.palletsprojects.com/) (testing). Adaptable to any network engine.
24+
- **Multiple HTTP Engines**: Built-in support for [httpx2](https://github.com/pydantic/httpx2) (sync/async) and [werkzeug](https://werkzeug.palletsprojects.com/) (testing). Adaptable to any network engine.
2525
- **Request & Response Validation**: Automatic payload validation against SCIM schemas
2626
- **Error Handling**: Structured exceptions for network, request and response errors
2727

2828
## Installation
2929

3030
```shell
31-
pip install scim2-client[httpx]
31+
pip install scim2-client[httpx2]
3232
```
3333

3434
## Usage
@@ -40,9 +40,9 @@ Here is an example of usage:
4040

4141
```python
4242
import datetime
43-
from httpx import Client
43+
from httpx2 import Client
4444
from scim2_client import SCIMResponseErrorObject
45-
from scim2_client.engines.httpx import SyncSCIMClient
45+
from scim2_client.engines.httpx2 import SyncSCIMClient
4646

4747
client = Client(base_url="https://auth.example/scim/v2", headers={"Authorization": "Bearer foobar"})
4848
scim = SyncSCIMClient(client)

‎doc/changelog.rst‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
Changelog
22
=========
33

4+
[Unreleased]
5+
------------
6+
7+
Added
8+
^^^^^
9+
- The network request engines are built upon `httpx2 <https://github.com/pydantic/httpx2>`_,
10+
which is maintained, and live in ``scim2_client.engines.httpx2``.
11+
They are shipped in the ``httpx2`` packaging extra.
12+
`httpx <https://github.com/encode/httpx>`_ is still used when httpx2 is not installed.
13+
14+
Deprecated
15+
^^^^^^^^^^
16+
- The ``httpx`` packaging extra, in favor of the ``httpx2`` extra. Will be removed in 0.9.
17+
- The ``scim2_client.engines.httpx`` module, in favor of ``scim2_client.engines.httpx2``.
18+
Will be removed in 0.9.
19+
- Passing a :code:`httpx.Client` or a :code:`httpx.AsyncClient` to the request engines,
20+
in favor of their httpx2 counterparts. Will be removed in 0.9.
21+
422
[0.7.5] - 2026-04-02
523
--------------------
624

‎doc/reference.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Reference
22
=========
33

4-
.. automodule:: scim2_client.engines.httpx
4+
.. automodule:: scim2_client.engines.httpx2
55
:members:
66
:member-order: bysource
77

‎doc/tutorial.rst‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@ Tutorial
44
Initialization
55
==============
66

7-
scim2-client depends on request engines such as `httpx <https://github.com/encode/httpx>`_ to perform network requests.
8-
This tutorial demonstrate how to use scim2-client with httpx, and suppose you have installed the `httpx` extra for example with ``pip install scim2-client[httpx]``.
7+
scim2-client depends on request engines such as `httpx2 <https://github.com/pydantic/httpx2>`_ to perform network requests.
8+
This tutorial demonstrate how to use scim2-client with httpx2, and suppose you have installed the `httpx2` extra for example with ``pip install scim2-client[httpx2]``.
99

10-
As a start you will need to instantiate a httpx :code:`Client` (or :code:`AsyncClient`) object that you can parameter as your will, and then pass it to a :class:`~scim2_client.SCIMClient` object.
11-
In addition to your SCIM server root endpoint, you will probably want to provide some authorization headers through the httpx :code:`Client` :code:`headers` parameter:
10+
.. note::
11+
12+
The engines still work with `httpx <https://github.com/encode/httpx>`_, shipped in the deprecated `httpx` extra.
13+
It is used when httpx2 is not installed, and both its extra and its support will be removed in 0.9.
14+
Applications that cannot migrate all their dependencies at once can call :code:`httpx2.alias_httpx()`
15+
at the very top of their entrypoint, so that :code:`import httpx` resolves to httpx2 process-wide.
16+
17+
As a start you will need to instantiate a httpx2 :code:`Client` (or :code:`AsyncClient`) object that you can parameter as your will, and then pass it to a :class:`~scim2_client.SCIMClient` object.
18+
In addition to your SCIM server root endpoint, you will probably want to provide some authorization headers through the httpx2 :code:`Client` :code:`headers` parameter:
1219

1320
.. tab-set::
1421
:class: outline
@@ -18,8 +25,8 @@ In addition to your SCIM server root endpoint, you will probably want to provide
1825

1926
.. code-block:: python
2027
21-
from httpx import Client
22-
from scim2_client.engines.httpx import SyncSCIMClient
28+
from httpx2 import Client
29+
from scim2_client.engines.httpx2 import SyncSCIMClient
2330
2431
client = Client(
2532
base_url="https://auth.example/scim/v2",
@@ -32,8 +39,8 @@ In addition to your SCIM server root endpoint, you will probably want to provide
3239

3340
.. code-block:: python
3441
35-
from httpx import AsyncClient
36-
from scim2_client.engines.httpx import AsyncSCIMClient
42+
from httpx2 import AsyncClient
43+
from scim2_client.engines.httpx2 import AsyncSCIMClient
3744
3845
client = AsyncClient(
3946
base_url="https://auth.example/scim/v2",
@@ -392,8 +399,8 @@ Engines
392399
scim2-client comes with a light abstraction layers that allows for different requests engines.
393400
Currently those engines are shipped:
394401

395-
- :class:`~scim2_client.engines.httpx.SyncSCIMClient`: A synchronous engine using `httpx <https://github.com/encode/httpx>`_ to perform the HTTP requests.
396-
- :class:`~scim2_client.engines.httpx.AsyncSCIMClient`: An asynchronous engine using `httpx <https://github.com/encode/httpx>`_ to perform the HTTP requests. It has the very same API than its synchronous version, except it is asynchronous.
402+
- :class:`~scim2_client.engines.httpx2.SyncSCIMClient`: A synchronous engine using `httpx2 <https://github.com/pydantic/httpx2>`_ to perform the HTTP requests.
403+
- :class:`~scim2_client.engines.httpx2.AsyncSCIMClient`: An asynchronous engine using `httpx2 <https://github.com/pydantic/httpx2>`_ to perform the HTTP requests. It has the very same API than its synchronous version, except it is asynchronous.
397404
- :class:`~scim2_client.engines.werkzeug.TestSCIMClient`: A test engine for development purposes.
398405
It takes a WSGI app and directly execute the server code instead of performing real HTTP requests.
399406
This is faster in unit test suites, and helpful to catch the server exceptions.

‎pyproject.toml‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ description = "Pythonically build SCIM requests and parse SCIM responses"
99
authors = [{name="Yaal Coop", email="contact@yaal.coop"}]
1010
license = {file = "LICENSE.md"}
1111
readme = "README.md"
12-
keywords = ["scim", "scim2", "provisioning", "rfc7643", "rfc7644", "httpx", "api"]
12+
keywords = ["scim", "scim2", "provisioning", "rfc7643", "rfc7644", "httpx2", "api"]
1313
classifiers = [
1414
"Intended Audience :: Developers",
1515
"Development Status :: 3 - Alpha",
@@ -31,6 +31,11 @@ dependencies = [
3131
]
3232

3333
[project.optional-dependencies]
34+
httpx2 = [
35+
"httpx2>=2.12",
36+
]
37+
38+
# Deprecated, will be removed in 0.9.
3439
httpx = [
3540
"httpx>=0.28.0",
3641
]
@@ -50,6 +55,7 @@ module-root = ""
5055

5156
[dependency-groups]
5257
dev = [
58+
"httpx>=0.28.0",
5359
"mypy>=1.13.0",
5460
"portpicker>=1.6.0",
5561
"prek>=0.1.0",
@@ -139,13 +145,14 @@ env_list = [
139145
"py312",
140146
"py313",
141147
"py314",
148+
"legacy",
142149
"minversions",
143150
"doc",
144151
"coverage",
145152
]
146153

147154
[tool.tox.env_run_base]
148-
extras = ["httpx", "werkzeug"]
155+
extras = ["httpx2", "werkzeug"]
149156
runner = "uv-venv-lock-runner"
150157
dependency_groups = ["dev"]
151158
commands = [
@@ -158,6 +165,9 @@ commands = [
158165
["prek", "run", "--all-files", "--show-diff-on-failure"],
159166
]
160167

168+
[tool.tox.env.legacy]
169+
extras = ["httpx", "werkzeug"]
170+
161171
[tool.tox.env.minversions]
162172
runner = "uv-venv-runner"
163173
uv_resolution = "lowest-direct"

0 commit comments

Comments
 (0)