Skip to content

Commit

Permalink
Publish to PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
hunyadi committed Aug 14, 2021
1 parent fd1f591 commit f4fd962
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Auxiliary services for working with Python type annotations
# Type-safe data interchange for Python data classes

JSON is a popular message interchange format employed in API design for its simplicity, readability, flexibility and wide support. However, `json.dump` and `json.load` offer no direct support when working with Python data classes employing type annotations. This package offers services for working with strongly-typed Python classes: serializing objects to JSON, deserializing JSON to objects, and producing a JSON schema that matches the data class, e.g. to be used in an OpenAPI specification.

This package offers the following services:

Expand All @@ -9,6 +11,13 @@ This package offers the following services:

In the context of this package, a *JSON object* is the (intermediate) Python object representation produced by `json.loads` from a *JSON string*. In contrast, a *JSON string* is the string representation generated by `json.dumps` from the (intermediate) Python object representation.

## Use cases

* Writing a cloud function (lambda) that communicates with JSON messages received as HTTP payload or websocket text messages
* Verifying if an API endpoint receives well-formed input
* Generating a type schema for an OpenAPI specification to impose constraints on what messages an API can receive
* Parsing JSON configuration files into a Python object

## Usage

Consider the following class definition:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
README = f.read()

setup(
name="strong_typing",
name="json_strong_typing",
version="0.1.0",
description="Auxiliary services for working with Python type annotations",
long_description=README,
Expand Down
Empty file added tests/__init__.py
Empty file.

0 comments on commit f4fd962

Please sign in to comment.