Skip to main content

PyPI version

Anson.py3

Json (de)serialize module in Python 3.

from anson.io.odysz.anson import Anson

Install from testpypi

pip install anson.py3

Guide

  • Mapping Java vs Python package structure

Python packages tree is in format of path/to/module/class, while java has no node of module:

├── io
│   └── oz
│       ├── jserv
│       │   └── docs
│       │       └── syn
│       │           └── singleton.py "class AppSettings"
│       └── syn.py "class AnRegistry, SynodeConfig, SynOrg, YellowPages"

Java packages tree:

.
└── io
    └── oz
        └── jserv
            └── docs
                └── syn
                    ├── singleton
                    │   └── AppSettings.java
.
└── io
    └── oz
        └── syn
            ├── AnRegistry.java
            ├── SynodeConfig.java
            ├── SynOrg.java
            └── YellowPages.java

Anson.py3 is using package name path with a top level path. Say, if the json envelope define as

{ type: io.oz.syn.AnRegistry,
  ...
}

and the user's project include two parts:

  • The semantics.py3 name space for json protocol package, the user types.

Which is currently need to be manually keep all fields the same with the java end. Start the project from the source:

github.com/odys-z/antson/semantics.py3

You need use the following commands to build and install it, so it can be imported to the application project.

    python -m build
    pip install dist/semantics_py3-#.#.#-py3-none-any.whl
  • The (client end) source project for applications.

In main.py, call

    from semanticshare.your.package import Your_class

Issues

  • Printing Anson subclasses with non-default field without value initialization will result in errors

If SynOrg.parent is defined as

class SynOrg(Anson)
    parent: str

    def __init__(self):
        super().__init__()

org = Anson.from_file(...)
print (org)

Error
Traceback (most recent call last):
  File "/home/antson/py3/test/testYellowPages.py", line 18, in testAnregistry
    print(diction)
  File "/usr/lib/python3.12/dataclasses.py", line 262, in wrapper
    result = user_function(self)
             ^^^^^^^^^^^^^^^^^^^
  File "<string>", line 3, in __repr__
  File "/usr/lib/python3.12/dataclasses.py", line 262, in wrapper
    result = user_function(self)
             ^^^^^^^^^^^^^^^^^^^
  File "<string>", line 3, in __repr__
  File "/usr/lib/python3.12/dataclasses.py", line 262, in wrapper
    result = user_function(self)
             ^^^^^^^^^^^^^^^^^^^
  File "<string>", line 3, in __repr__
AttributeError: 'SynOrg' object has no attribute 'parent'

References

Troubleshootings

.pypirc

[testpypi]
repository: https://test.pypi.org/legacy/
username = __token__
password = pypi-zzz
python3 -m twine --version
twine version 6.1.0 (keyring: 25.6.0, packaging: 24.2, requests: 2.31.0, requests-toolbelt: 1.0.0,
urllib3: 2.0.7, id: 1.5.0)
python3 -m build
python3 -m twine upload --repository testpypi dist/*
ERROR   InvalidDistribution: Invalid distribution metadata: unrecognized or malformed field
        'license-file'; unrecognized or malformed field 'license-expression'  

Install twine 6.1.0 and packaging 24.

pip install packaging -U

See issue #1216.

Metadata

Release files for anson.py3 0.6.1

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

Source distribution (sdist)

Source distribution for anson.py3 0.6.1
File Size Uploaded Provenance Actions
anson_py3-0.6.1.tar.gz 33.4 kB Without provenance Details for anson_py3-0.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for anson.py3 0.6.1
File Interpreter ABI Platform Actions
anson_py3-0.6.1-py3-none-any.whl Python 3 none any Details for anson_py3-0.6.1-py3-none-any.whl

Total release size: 59.3 kB

Release files / anson_py3-0.6.1.tar.gz

Download URL anson_py3-0.6.1.tar.gz
Size 33.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b26c7ef8a47dd5d5d37b5ed4c1b5482c7a6417578c5a1b526e3f92c144b581ee
BLAKE2b-256 checksum
How to use checksums
fc8fc236652ddb5a1d885353a17e30281d07d385caaaf77ab774dd310d5590fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.1

Release files / anson_py3-0.6.1-py3-none-any.whl

Download URL anson_py3-0.6.1-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51f9c52374cf5fd3fb5d2fa669cdd9ebf9251aa291d93b46d6d886affabad30f
BLAKE2b-256 checksum
How to use checksums
5498e4e8392987fba37e27c3d8ef973d7be9d58b48ef413b5af6d5911cc9da83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.1

Security for anson.py3 0.6.1

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.

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files No provenance

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