-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: contribution page and readme improvements
- Loading branch information
Showing
6 changed files
with
260 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,47 @@ | ||
# pydantic-scim2 [![Documentation Status](https://readthedocs.org/projects/pydantic-scim2/badge/?version=latest)](https://pydantic-scim2.readthedocs.io/en/latest/?badge=latest) ![Unit tests](https://github.com/yaal-coop/pydantic-scim2/actions/workflows/tests.yaml/badge.svg) | ||
# pydantic-scim2 | ||
|
||
Fork of [pydantic-scim](https://github.com/chalk-ai/pydantic-scim) to bring support for pydantic 2. | ||
Pydantic models for SCIM2 schemas defined in [RFC7643](https://www.rfc-editor.org/rfc/rfc7643). | ||
This allows to parse and produce SCIM2 payloads. | ||
|
||
pydantic-scim2 is a fork of [pydantic-scim](https://github.com/chalk-ai/pydantic-scim) to bring support for pydantic 2. | ||
|
||
## Installation | ||
|
||
```shell | ||
pip install pydantic-scim2 | ||
``` | ||
|
||
## Example | ||
|
||
```python | ||
from pydantic_scim2 import User | ||
import datetime | ||
|
||
payload = { | ||
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"], | ||
"id": "2819c223-7f76-453a-919d-413861904646", | ||
"userName": "[email protected]", | ||
"meta": { | ||
"resourceType": "User", | ||
"created": "2010-01-23T04:56:22Z", | ||
"lastModified": "2011-05-13T04:42:34Z", | ||
"version": 'W\\/"3694e05e9dff590"', | ||
"location": "https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646", | ||
}, | ||
} | ||
|
||
# Pythonize JSON SCIM payload: | ||
|
||
user = User.model_validate(payload) | ||
assert user.userName == "[email protected]" | ||
assert user.meta.created == datetime.datetime( | ||
2010, 1, 23, 4, 56, 22, tzinfo=datetime.timezone.utc | ||
) | ||
|
||
# JSONify Python SCIM models: | ||
|
||
dump = user.model_dump( | ||
exclude_none=True, exclude_unset=True, by_alias=True, mode="json", | ||
) | ||
assert dump == payload | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Contributions | ||
============= | ||
|
||
Contributions are welcome! | ||
|
||
The repository is hosted at `github.com/yaal-coop/pydantic-scim2 <https://github.com/yaal-coop/pydantic-scim2>`_. | ||
|
||
Discuss | ||
------- | ||
|
||
If you want to implement a feature or a bugfix, please start by discussing it with us on | ||
the `bugtracker <https://github.com/yaal-coop/pydantic-scim2/issues>`_. | ||
|
||
Unit tests | ||
---------- | ||
|
||
To run the tests, you just can run `poetry run pytest` and/or `tox` to test all the supported python environments. | ||
Everything must be green before patches get merged. | ||
|
||
The test coverage is 100%, patches won't be accepted if not entirely covered. You can check the | ||
test coverage with ``poetry run pytest --cov --cov-report=html`` or ``tox -e coverage -- --cov-report=html``. | ||
You can check the HTML coverage report in the newly created `htmlcov` directory. | ||
|
||
Code style | ||
---------- | ||
|
||
We use `ruff <https://docs.astral.sh/ruff/>`_ along with other tools to format our code. | ||
Please run ``tox -e style`` on your patches before submiting them. | ||
In order to perform a style check and correction at each commit you can use our | ||
`pre-commit <https://pre-commit.com/>`_ configuration with ``pre-commit install``. | ||
|
||
Documentation | ||
------------- | ||
|
||
The documentation is generated when the tests run: | ||
|
||
.. code-block:: bash | ||
tox -e doc | ||
You can also run sphinx by hand, that should be faster since it avoids the tox environment initialization: | ||
|
||
.. code-block:: bash | ||
sphinx-build doc build/sphinx/html | ||
The generated documentation is located at ``build/sphinx/html``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
pydantic-scim2 | ||
============== | ||
.. include:: ../README.md | ||
:parser: myst_parser.parsers.docutils_ | ||
|
||
SCIM2 models for pydantic | ||
Table of contents | ||
----------------- | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
reference | ||
contributing | ||
changelog |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters