Type handling and normalization for non-standard types like email, phone numbers, money, dates, etc. serializable and deserializable as JSON, JSON Schema, and Pydantic.
Project description
atypical
Custom types for things like phone numbers, emails, etc. with normalization, Pydantic handling and JSON Schema serialization
Examples
from atypical.email import Email
from atypical.money import Money
from atypical.phone import PhoneNumber
from atypical.url import NormalizedURL
from sartorial.schema import Schema
class MyModel(Schema):
email: Email
phone_number: PhoneNumber
amount: Money
website: NormalizedURL
import json
print(MyModel.model_json_schema()) # or MyModel.to_schema_dict()
# Output
'''
{
"additionalProperties": true,
"properties": {
"email": {
"format": "email",
"type": "string"
},
"phone_number": {
"format": "phone",
"type": "string"
},
"amount": {
"format": "money",
"type": "string"
},
"website": {
"format": "normalized-url",
"type": "string"
}
},
"required": [
"email",
"phone_number",
"amount",
"website"
],
"title": "MyModel",
"type": "object"
}
'''
m = MyModel(email="foo.bar+baz@gmail",
phone_number="1 (212) 555-6789",
amount="$100",
website="example.com")
print(m.model_dump_json(indent=4)) # or m.to_json()
# Output
'''
{
"email": "foobar@gmail.com",
"phone_number": "+12125556789",
"amount": "$100.00",
"website": "https://example.com/"
}
'''
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file atypical-0.4.0.tar.gz.
File metadata
- Download URL: atypical-0.4.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16a33c06c3c2b2ebb44b282002991e21602f3fc3c4d916724793a8ba932d402a
|
|
| MD5 |
d97407ceb35956966ad2c8055273a74f
|
|
| BLAKE2b-256 |
75ca168c79fbadd23c0c630e23e3716da62aaecf6f13ab584a46e116c6c47c21
|
Provenance
The following attestation bundles were made for atypical-0.4.0.tar.gz:
Publisher:
build.yml on goodcleanfun/atypical
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
atypical-0.4.0.tar.gz -
Subject digest:
16a33c06c3c2b2ebb44b282002991e21602f3fc3c4d916724793a8ba932d402a - Sigstore transparency entry: 185125616
- Sigstore integration time:
-
Permalink:
goodcleanfun/atypical@d78217d5e6d9fdf5d86a2df167c29366f26e034a -
Branch / Tag:
refs/tags/0.4.0 - Owner: https://github.com/goodcleanfun
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@d78217d5e6d9fdf5d86a2df167c29366f26e034a -
Trigger Event:
push
-
Statement type:
File details
Details for the file atypical-0.4.0-py3-none-any.whl.
File metadata
- Download URL: atypical-0.4.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23d552304bf1eb2f3fbdb88bdf0fc38abf15e59bc21a8c9fde7626ea0a93e250
|
|
| MD5 |
7c20b57993e83b3f0b24b1dd8e37e413
|
|
| BLAKE2b-256 |
308be04ba161d41ea6f79402065b3f84272020fbb794797b443fb60b5c0e2b7a
|
Provenance
The following attestation bundles were made for atypical-0.4.0-py3-none-any.whl:
Publisher:
build.yml on goodcleanfun/atypical
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
atypical-0.4.0-py3-none-any.whl -
Subject digest:
23d552304bf1eb2f3fbdb88bdf0fc38abf15e59bc21a8c9fde7626ea0a93e250 - Sigstore transparency entry: 185125618
- Sigstore integration time:
-
Permalink:
goodcleanfun/atypical@d78217d5e6d9fdf5d86a2df167c29366f26e034a -
Branch / Tag:
refs/tags/0.4.0 - Owner: https://github.com/goodcleanfun
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@d78217d5e6d9fdf5d86a2df167c29366f26e034a -
Trigger Event:
push
-
Statement type: