Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pydentic

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pydentic

Pydantic Identifiers

  • 0.0.1.dev3
  • Source
  • PyPI
  • Socket score

Maintainers
1

Pydentic

Pydentic is a thin wrapper over python-stdnum to facilitate the use of its extensive collection of validators and formatters in Pydantic models.

pip install pydentic

Features

Automatic validation and formatting.

from pydentic.strings import Iban
from pydantic import BaseModel

class User(BaseModel):
    name: str
    iban: Iban

user = User(name='John Doe', iban='es1000750080110600658108')
print(user)

#> name='John Doe' iban='ES10 0075 0080 1106 0065 8108'
# note the extra last character
user = User(name='John Doe', iban='es1000750080110600658108Ñ')

# raises
...
pydantic.error_wrappers.ValidationError: 1 validation error for User
iban
  es1000750080110600658108Ñ (type=value_error.format; error=invalid literal for int() with base 36: 'Ñ')

Title and description in the JSON Schema.

{
  "title": "User",
  "type": "object",
  "properties": {
    "name": {
      "title": "Name",
      "type": "string"
    },
    "iban": {
      "title": "IBAN",
      "description": "International Bank Account Number",
      "type": "string"
    }
  },
  "required": ["user", "iban"]
}

The classes Isan, Isbn, and Issn include a urn property that, not surprisingly, returns their URN.

from pydentic.strings import Isbn
from pydantic import BaseModel

class Book(BaseModel):
    author: str
    title: str
    isbn: Isbn

book = Book(author='D. Hofstadter', title='GEB', isbn='978-0-465-02656-2')
print(book.isbn.urn)

#> urn:isbn:9780465026562

Identifiers

The list below contains some available international identifiers. There are around 200 more identifiers included (see the python-stdnum docs for the complete list.)

identifierspecdescription
BICISO 9362Business Identifier Code
BIC-CodeISO 6346International standard for container identification
Bitcoin address
CAS RNChemical Abstracts Service Registry Number
CUSIP numberfinancial security identification number
EANInternational Article Number
FIGIOMG FIGIFinancial Instrument Global Identifier
GRidGlobal Release Identifier
GS1-128GS-1 (product information) using Code 128 barcodes
IBANISO 13616International Bank Account Number
IMEIInternational Mobile Equipment Identity
IMO numberInternational Maritime Organization number
IMSIInternational Mobile Subscriber Identity
ISANISO 15706International Standard Audiovisual Number
ISBNISO 2108International Standard Book Number
ISILISO 15511International Standard Identifier for Libraries
ISINISO 6166International Securities Identification Number
ISMNISO 10957International Standard Music Number for notated music
ISSNISO 3297International Standard Serial Number
LEIISO 17442Legal Entity Identifier
MAC addressMedia Access Control address
MEIDMobile Equipment Identifier
ISO 11649Structured Creditor Reference

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc