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.5.4

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.5.4
File Size Uploaded Provenance Actions
anson_py3-0.5.4.tar.gz 27.6 kB Without provenance Details for anson_py3-0.5.4.tar.gz

Built distribution (wheel)

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

Total release size: 48.4 kB

Release files / anson_py3-0.5.4.tar.gz

Download URL anson_py3-0.5.4.tar.gz
Size 27.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5b8ef25cbdbcbf020a94ae413a5b894988e08301642b32ece7c0debbe1ce5729
BLAKE2b-256 checksum
How to use checksums
90114f1be48ef919292ac5f13f0f9d058bfc204007feb4b0ce3cbaf9ea7a6705
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.5.4-py3-none-any.whl

Download URL anson_py3-0.5.4-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fec4223361009ca150e95295ab2b326207d2a95486c7835e096d106464bc969
BLAKE2b-256 checksum
How to use checksums
8c0f9accbecc5d7708b9bfb6bcba28ce290cef5532437d93137d14f115c0fb96
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.5.4

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.5.4 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