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"

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
pydeclares-0.5.tar.gz 10.2 kB Details

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

Release history Release notifications | RSS feed

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.6.3

1 release file

0.6.1

1 release file

0.6

1 release file

This release

0.5 This release

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

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