Skip to main content

PyDeclares

This library provides a simple API for encoding and decoding declared classes to and from JSON, XML, FORM-DATA or QueryString.

It's very easy to get started.

Quickstart

pip install pydeclares

from pydeclares import var, Declared

class Person(Declared):
	name = var(str)
	age = var(int)

# decode json string
data = '{"name": "Tom", "age": 18}'
person = Person.from_json(data)

assert person.name == "Tom"
assert person.age == 18

# you can encode to xml after decode json string
result = person.to_xml()

assert result == '<person><name>Tom</name><age>18</age></person>'

# or form-data
result = person.to_form_data()

assert result == "name=Tom&age=18"

# or query string
person = Person(name="tom@a", age=18)
result = person.to_query_string()

assert result == "name=tom%40a&age=18"

Metadata

Release files for pydeclares 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydeclares 0.5
File Size Uploaded Provenance Actions
pydeclares-0.5.tar.gz 10.2 kB Without provenance Details for pydeclares-0.5.tar.gz

Release files / pydeclares-0.5.tar.gz

Download URL pydeclares-0.5.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c2fccafcdf5694ccd07a6f601a38bfb9d8b2008e7a7c63452a7051ac46a7f90f
BLAKE2b-256 checksum
How to use checksums
76c5fadfca4c71d35394df95194da4cae2fdd9c2ce0afdc88cd819a3535bee10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

Security for pydeclares 0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page