Skip to main content

PyPI version

Anson.py3

Json (de)serialize module in Python 3.

from anson.io.odysz.anson import Anson

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

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.10
File Size Uploaded Provenance Actions
anson_py3-0.6.10.tar.gz 31.3 kB Without provenance Details for anson_py3-0.6.10.tar.gz

Built distribution (wheel)

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

Total release size: 64.9 kB

Release files / anson_py3-0.6.10.tar.gz

Download URL anson_py3-0.6.10.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a04b6a944a4c75fc88a16d2155a926ab95a21f2c58c2715d285d1fc74e75b36d
BLAKE2b-256 checksum
How to use checksums
03ae12ce7c67dec5d5d5ccc9a2bcbbc8684dc18b39a10c0b5760188035b92d05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.1

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

Download URL anson_py3-0.6.10-py3-none-any.whl
Size 33.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1dc19c3486717a562fdd6fe2d74d7e85f274576183bf0b89d36b30e0c59106e
BLAKE2b-256 checksum
How to use checksums
23e5e660d757fdf5e12de7242ed9d3b1b1b15aaaf7ca890f9184cc63321c4f68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.1

Security for anson.py3 0.6.10

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