anson.py3 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- anson_py3-0.1.0/.gitignore +2 -0
- anson_py3-0.1.0/.idea/.gitignore +3 -0
- anson_py3-0.1.0/.idea/inspectionProfiles/Project_Default.xml +12 -0
- anson_py3-0.1.0/.idea/inspectionProfiles/profiles_settings.xml +6 -0
- anson_py3-0.1.0/.idea/misc.xml +7 -0
- anson_py3-0.1.0/.idea/modules.xml +8 -0
- anson_py3-0.1.0/.idea/py3.iml +8 -0
- anson_py3-0.1.0/.idea/vcs.xml +6 -0
- anson_py3-0.1.0/.idea/workspace.xml +110 -0
- anson_py3-0.1.0/.project +17 -0
- anson_py3-0.1.0/.pydevproject +8 -0
- anson_py3-0.1.0/LICENSE +21 -0
- anson_py3-0.1.0/PKG-INFO +181 -0
- anson_py3-0.1.0/README.md +164 -0
- anson_py3-0.1.0/pyproject.toml +29 -0
- anson_py3-0.1.0/src/anson/__init__.py +0 -0
- anson_py3-0.1.0/src/anson/io/odysz/__init__.py +0 -0
- anson_py3-0.1.0/src/anson/io/odysz/anson/__init__.py +0 -0
- anson_py3-0.1.0/src/anson/io/odysz/anson/x/__init__.py +10 -0
- anson_py3-0.1.0/src/anson/io/odysz/ansons.py +231 -0
- anson_py3-0.1.0/src/anson/io/odysz/common.py +83 -0
- anson_py3-0.1.0/src/ansonpy_del/.gitignore +1 -0
- anson_py3-0.1.0/src/ansonpy_del/JSONLexer.py +138 -0
- anson_py3-0.1.0/src/ansonpy_del/JSONListener.py +84 -0
- anson_py3-0.1.0/src/ansonpy_del/JSONParser.py +721 -0
- anson_py3-0.1.0/src/ansonpy_del/JsonOpt.py +6 -0
- anson_py3-0.1.0/src/ansonpy_del/anson.py +992 -0
- anson_py3-0.1.0/src/ansonpy_del/x/AnsonException.py +9 -0
- anson_py3-0.1.0/test/__init__.py +0 -0
- anson_py3-0.1.0/test/ansontypes.py +14 -0
- anson_py3-0.1.0/test/hello.py +83 -0
- anson_py3-0.1.0/test/io/__init__.py +0 -0
- anson_py3-0.1.0/test/io/odysz/__init__.py +18 -0
- anson_py3-0.1.0/test/io/odysz/jclient.py +86 -0
- anson_py3-0.1.0/test/io/odysz/semantic/__init__.py +0 -0
- anson_py3-0.1.0/test/io/odysz/semantic/jprotocol.py +93 -0
- anson_py3-0.1.0/test/io/odysz/semantic/jserv/__init__.py +0 -0
- anson_py3-0.1.0/test/io/odysz/semantic/jserv/echo.py +12 -0
- anson_py3-0.1.0/test/io/oz/__init__.py +0 -0
- anson_py3-0.1.0/test/io/oz/jserv/__init__.py +0 -0
- anson_py3-0.1.0/test/io/oz/jserv/docs/__init__.py +0 -0
- anson_py3-0.1.0/test/io/oz/jserv/docs/syn/__init__.py +0 -0
- anson_py3-0.1.0/test/io/oz/jserv/docs/syn/singleton.py +101 -0
- anson_py3-0.1.0/test/io/oz/syn.py +127 -0
- anson_py3-0.1.0/test/jserv-sample/README.md +3 -0
- anson_py3-0.1.0/test/json/01.json +1 -0
- anson_py3-0.1.0/test/json/registry/dictionary.json +30 -0
- anson_py3-0.1.0/test/json/registry/settings.json +9 -0
- anson_py3-0.1.0/test/json/registry/syntity.json +6 -0
- anson_py3-0.1.0/test/testAnson.py +69 -0
- anson_py3-0.1.0/test/testFrom.py +39 -0
- anson_py3-0.1.0/test/testLangExt.py +50 -0
- anson_py3-0.1.0/test/testPing.py +26 -0
- anson_py3-0.1.0/test/testTo.py +65 -0
- anson_py3-0.1.0/test/testYellowPages.py +27 -0
- anson_py3-0.1.0/test/testier/__init__.py +0 -0
- anson_py3-0.1.0/test/testier/extra.py +19 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
|
5
|
+
<option name="ignoredErrors">
|
|
6
|
+
<list>
|
|
7
|
+
<option value="E501" />
|
|
8
|
+
</list>
|
|
9
|
+
</option>
|
|
10
|
+
</inspection_tool>
|
|
11
|
+
</profile>
|
|
12
|
+
</component>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="Black">
|
|
4
|
+
<option name="sdkName" value="Python 3.12" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
|
7
|
+
</project>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="PYTHON_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
|
5
|
+
<orderEntry type="jdk" jdkName="Python 3.12" jdkType="Python SDK" />
|
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
+
</component>
|
|
8
|
+
</module>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="AutoImportSettings">
|
|
4
|
+
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ChangeListManager">
|
|
7
|
+
<list default="true" id="8abd2f88-f467-4ea4-848e-e32bbaf197e2" name="Changes" comment="" />
|
|
8
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
9
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
10
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
11
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
12
|
+
</component>
|
|
13
|
+
<component name="FileTemplateManagerImpl">
|
|
14
|
+
<option name="RECENT_TEMPLATES">
|
|
15
|
+
<list>
|
|
16
|
+
<option value="Python Script" />
|
|
17
|
+
</list>
|
|
18
|
+
</option>
|
|
19
|
+
</component>
|
|
20
|
+
<component name="Git.Settings">
|
|
21
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
|
22
|
+
</component>
|
|
23
|
+
<component name="MarkdownSettingsMigration">
|
|
24
|
+
<option name="stateVersion" value="1" />
|
|
25
|
+
</component>
|
|
26
|
+
<component name="ProjectId" id="2XHS1eigFVfsCqhKGGKDGDVYhNP" />
|
|
27
|
+
<component name="ProjectViewState">
|
|
28
|
+
<option name="hideEmptyMiddlePackages" value="true" />
|
|
29
|
+
<option name="showLibraryContents" value="true" />
|
|
30
|
+
</component>
|
|
31
|
+
<component name="PropertiesComponent">{
|
|
32
|
+
"keyToString": {
|
|
33
|
+
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
|
34
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
35
|
+
"last_opened_file_path": "C:/Users/Alice/github/Ever-connecting/synode-gui/portfolio-gui"
|
|
36
|
+
}
|
|
37
|
+
}</component>
|
|
38
|
+
<component name="RecentsManager">
|
|
39
|
+
<key name="CopyFile.RECENT_KEYS">
|
|
40
|
+
<recent name="C:\Users\Alice\github\antson\py3\test\testier" />
|
|
41
|
+
</key>
|
|
42
|
+
<key name="MoveFile.RECENT_KEYS">
|
|
43
|
+
<recent name="C:\Users\Alice\github\antson\py3\test" />
|
|
44
|
+
<recent name="C:\Users\Alice\github\antson\py3\test\io" />
|
|
45
|
+
<recent name="C:\Users\Alice\github\antson\py3" />
|
|
46
|
+
<recent name="C:\Users\Alice\github\antson\py3\ansonpy" />
|
|
47
|
+
</key>
|
|
48
|
+
</component>
|
|
49
|
+
<component name="RunManager">
|
|
50
|
+
<configuration name="testAnson" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
|
51
|
+
<module name="py3" />
|
|
52
|
+
<option name="INTERPRETER_OPTIONS" value="" />
|
|
53
|
+
<option name="PARENT_ENVS" value="true" />
|
|
54
|
+
<envs>
|
|
55
|
+
<env name="PYTHONUNBUFFERED" value="1" />
|
|
56
|
+
</envs>
|
|
57
|
+
<option name="SDK_HOME" value="" />
|
|
58
|
+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" />
|
|
59
|
+
<option name="IS_MODULE_SDK" value="true" />
|
|
60
|
+
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
61
|
+
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
62
|
+
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/test/testAnson.py" />
|
|
63
|
+
<option name="PARAMETERS" value="" />
|
|
64
|
+
<option name="SHOW_COMMAND_LINE" value="false" />
|
|
65
|
+
<option name="EMULATE_TERMINAL" value="false" />
|
|
66
|
+
<option name="MODULE_MODE" value="false" />
|
|
67
|
+
<option name="REDIRECT_INPUT" value="false" />
|
|
68
|
+
<option name="INPUT_FILE" value="" />
|
|
69
|
+
<method v="2" />
|
|
70
|
+
</configuration>
|
|
71
|
+
<recent_temporary>
|
|
72
|
+
<list>
|
|
73
|
+
<item itemvalue="Python.testAnson" />
|
|
74
|
+
</list>
|
|
75
|
+
</recent_temporary>
|
|
76
|
+
</component>
|
|
77
|
+
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
78
|
+
<component name="TaskManager">
|
|
79
|
+
<task active="true" id="Default" summary="Default task">
|
|
80
|
+
<changelist id="8abd2f88-f467-4ea4-848e-e32bbaf197e2" name="Changes" comment="" />
|
|
81
|
+
<created>1698284298825</created>
|
|
82
|
+
<option name="number" value="Default" />
|
|
83
|
+
<option name="presentableId" value="Default" />
|
|
84
|
+
<updated>1698284298825</updated>
|
|
85
|
+
</task>
|
|
86
|
+
<servers />
|
|
87
|
+
</component>
|
|
88
|
+
<component name="XDebuggerManager">
|
|
89
|
+
<breakpoint-manager>
|
|
90
|
+
<default-breakpoints>
|
|
91
|
+
<breakpoint type="python-exception">
|
|
92
|
+
<properties notifyOnTerminate="true" exception="BaseException">
|
|
93
|
+
<option name="notifyOnTerminate" value="true" />
|
|
94
|
+
</properties>
|
|
95
|
+
</breakpoint>
|
|
96
|
+
</default-breakpoints>
|
|
97
|
+
</breakpoint-manager>
|
|
98
|
+
<watches-manager>
|
|
99
|
+
<configuration name="PythonConfigurationType">
|
|
100
|
+
<watch expression="get_origin(f.type)" language="Python" />
|
|
101
|
+
<watch expression="it.type == str" language="Python" />
|
|
102
|
+
<watch expression="it.type == type(list())" language="Python" />
|
|
103
|
+
<watch expression="issubclass(it.type, Number)" language="Python" />
|
|
104
|
+
<watch expression="get_origin(f.type) == list" language="Python" />
|
|
105
|
+
<watch expression="issubclass(myfields[k].type, Number)" language="Python" />
|
|
106
|
+
<watch expression="isinstance(v, str)" language="Python" />
|
|
107
|
+
</configuration>
|
|
108
|
+
</watches-manager>
|
|
109
|
+
</component>
|
|
110
|
+
</project>
|
anson_py3-0.1.0/.project
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<projectDescription>
|
|
3
|
+
<name>anston.py3</name>
|
|
4
|
+
<comment></comment>
|
|
5
|
+
<projects>
|
|
6
|
+
</projects>
|
|
7
|
+
<buildSpec>
|
|
8
|
+
<buildCommand>
|
|
9
|
+
<name>org.python.pydev.PyDevBuilder</name>
|
|
10
|
+
<arguments>
|
|
11
|
+
</arguments>
|
|
12
|
+
</buildCommand>
|
|
13
|
+
</buildSpec>
|
|
14
|
+
<natures>
|
|
15
|
+
<nature>org.python.pydev.pythonNature</nature>
|
|
16
|
+
</natures>
|
|
17
|
+
</projectDescription>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<?eclipse-pydev version="1.0"?><pydev_project>
|
|
3
|
+
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
|
|
4
|
+
<path>/${PROJECT_DIR_NAME}</path>
|
|
5
|
+
</pydev_pathproperty>
|
|
6
|
+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 3.5</pydev_property>
|
|
7
|
+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
|
8
|
+
</pydev_project>
|
anson_py3-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 odys-z
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
anson_py3-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: anson.py3
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Anson for Python3
|
|
5
|
+
Project-URL: Homepage, https://github.com/odys-z/antson
|
|
6
|
+
Project-URL: Issues, https://github.com/odys-z/antson/issues
|
|
7
|
+
Author-email: Ody Z <odys.zhou@gmail.com>
|
|
8
|
+
License: Copyright (c) 2025 Ody Z. All rights reserved.
|
|
9
|
+
|
|
10
|
+
This work is licensed under the terms of the MIT license.
|
|
11
|
+
For a copy, see <https://opensource.org/licenses/MIT>.
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# Anson.py3
|
|
19
|
+
|
|
20
|
+
A testing package ...
|
|
21
|
+
|
|
22
|
+
```code
|
|
23
|
+
from ansons.anson import Anson
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
# Install from testpypi
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
pip install --index-url https://test.pypi.org/simple --extra-index-url https://pypi.org/simple anson.py3
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
# Guide
|
|
33
|
+
|
|
34
|
+
- Mapping Java vs Python package structure
|
|
35
|
+
|
|
36
|
+
Python packages tree is in format of *path/to/module/class*, while java has no node of *module*:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
├── io
|
|
40
|
+
│ └── oz
|
|
41
|
+
│ ├── jserv
|
|
42
|
+
│ │ └── docs
|
|
43
|
+
│ │ └── syn
|
|
44
|
+
│ │ └── singleton.py "class AppSettings"
|
|
45
|
+
│ └── syn.py "class AnRegistry, SynodeConfig, SynOrg, YellowPages"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Java packages tree:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
.
|
|
52
|
+
└── io
|
|
53
|
+
└── oz
|
|
54
|
+
└── jserv
|
|
55
|
+
└── docs
|
|
56
|
+
└── syn
|
|
57
|
+
├── singleton
|
|
58
|
+
│ └── AppSettings.java
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
.
|
|
63
|
+
└── io
|
|
64
|
+
└── oz
|
|
65
|
+
└── syn
|
|
66
|
+
├── AnRegistry.java
|
|
67
|
+
├── SynodeConfig.java
|
|
68
|
+
├── SynOrg.java
|
|
69
|
+
└── YellowPages.java
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Anson.py3 is using package name path with a top level path. Say, if the json envelope
|
|
73
|
+
define as
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
{ type: io.oz.syn.AnRegistry,
|
|
77
|
+
...
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
and the user's project tree is:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
src
|
|
85
|
+
├── io
|
|
86
|
+
│ └── oz
|
|
87
|
+
│ ├── jserv
|
|
88
|
+
│ │ └── docs
|
|
89
|
+
│ │ └── syn
|
|
90
|
+
│ │ └── singleton.py "class AppSettings"
|
|
91
|
+
│ └── syn.py "class AnRegistry, SynodeConfig, SynOrg, YellowPages"
|
|
92
|
+
main.py
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
In main.py, call
|
|
96
|
+
|
|
97
|
+
```code
|
|
98
|
+
Anson.java_src('src')
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
before
|
|
102
|
+
|
|
103
|
+
```code
|
|
104
|
+
AnRegistry.from_file(path)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
# Issues
|
|
108
|
+
|
|
109
|
+
- Printing Anson subclasses with non-default field without value initialization will result in errors
|
|
110
|
+
|
|
111
|
+
If SynOrg.parent is defined as
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
class SynOrg(Anson)
|
|
115
|
+
parent: str
|
|
116
|
+
|
|
117
|
+
def __init__(self):
|
|
118
|
+
super().__init__()
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
org = Anson.from_file(...)
|
|
124
|
+
print (org)
|
|
125
|
+
|
|
126
|
+
Error
|
|
127
|
+
Traceback (most recent call last):
|
|
128
|
+
File "/home/antson/py3/test/testYellowPages.py", line 18, in testAnregistry
|
|
129
|
+
print(diction)
|
|
130
|
+
File "/usr/lib/python3.12/dataclasses.py", line 262, in wrapper
|
|
131
|
+
result = user_function(self)
|
|
132
|
+
^^^^^^^^^^^^^^^^^^^
|
|
133
|
+
File "<string>", line 3, in __repr__
|
|
134
|
+
File "/usr/lib/python3.12/dataclasses.py", line 262, in wrapper
|
|
135
|
+
result = user_function(self)
|
|
136
|
+
^^^^^^^^^^^^^^^^^^^
|
|
137
|
+
File "<string>", line 3, in __repr__
|
|
138
|
+
File "/usr/lib/python3.12/dataclasses.py", line 262, in wrapper
|
|
139
|
+
result = user_function(self)
|
|
140
|
+
^^^^^^^^^^^^^^^^^^^
|
|
141
|
+
File "<string>", line 3, in __repr__
|
|
142
|
+
AttributeError: 'SynOrg' object has no attribute 'parent'
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
# References
|
|
146
|
+
|
|
147
|
+
- https://packaging.python.org/en/latest/tutorials/packaging-projects/
|
|
148
|
+
|
|
149
|
+
```python3 -m twine upload --repository testpypi dist/*```
|
|
150
|
+
|
|
151
|
+
# Troubleshootings
|
|
152
|
+
|
|
153
|
+
.pypirc
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
[testpypi]
|
|
157
|
+
repository: https://test.pypi.org/legacy/
|
|
158
|
+
username = __token__
|
|
159
|
+
password = pypi-zzz
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
python3 -m twine --version
|
|
164
|
+
twine version 6.1.0 (keyring: 25.6.0, packaging: 24.2, requests: 2.31.0, requests-toolbelt: 1.0.0,
|
|
165
|
+
urllib3: 2.0.7, id: 1.5.0)
|
|
166
|
+
python3 -m build
|
|
167
|
+
python3 -m twine upload --repository testpypi dist/*
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
ERROR InvalidDistribution: Invalid distribution metadata: unrecognized or malformed field
|
|
172
|
+
'license-file'; unrecognized or malformed field 'license-expression'
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Install twine 6.1.0 and packaging 24.
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
pip install packaging -U
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
See [issue #1216](https://github.com/pypa/twine/issues/1216#issuecomment-2609745412).
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Anson.py3
|
|
2
|
+
|
|
3
|
+
A testing package ...
|
|
4
|
+
|
|
5
|
+
```code
|
|
6
|
+
from ansons.anson import Anson
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
# Install from testpypi
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
pip install --index-url https://test.pypi.org/simple --extra-index-url https://pypi.org/simple anson.py3
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
# Guide
|
|
16
|
+
|
|
17
|
+
- Mapping Java vs Python package structure
|
|
18
|
+
|
|
19
|
+
Python packages tree is in format of *path/to/module/class*, while java has no node of *module*:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
├── io
|
|
23
|
+
│ └── oz
|
|
24
|
+
│ ├── jserv
|
|
25
|
+
│ │ └── docs
|
|
26
|
+
│ │ └── syn
|
|
27
|
+
│ │ └── singleton.py "class AppSettings"
|
|
28
|
+
│ └── syn.py "class AnRegistry, SynodeConfig, SynOrg, YellowPages"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Java packages tree:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
.
|
|
35
|
+
└── io
|
|
36
|
+
└── oz
|
|
37
|
+
└── jserv
|
|
38
|
+
└── docs
|
|
39
|
+
└── syn
|
|
40
|
+
├── singleton
|
|
41
|
+
│ └── AppSettings.java
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
.
|
|
46
|
+
└── io
|
|
47
|
+
└── oz
|
|
48
|
+
└── syn
|
|
49
|
+
├── AnRegistry.java
|
|
50
|
+
├── SynodeConfig.java
|
|
51
|
+
├── SynOrg.java
|
|
52
|
+
└── YellowPages.java
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Anson.py3 is using package name path with a top level path. Say, if the json envelope
|
|
56
|
+
define as
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
{ type: io.oz.syn.AnRegistry,
|
|
60
|
+
...
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
and the user's project tree is:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
src
|
|
68
|
+
├── io
|
|
69
|
+
│ └── oz
|
|
70
|
+
│ ├── jserv
|
|
71
|
+
│ │ └── docs
|
|
72
|
+
│ │ └── syn
|
|
73
|
+
│ │ └── singleton.py "class AppSettings"
|
|
74
|
+
│ └── syn.py "class AnRegistry, SynodeConfig, SynOrg, YellowPages"
|
|
75
|
+
main.py
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
In main.py, call
|
|
79
|
+
|
|
80
|
+
```code
|
|
81
|
+
Anson.java_src('src')
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
before
|
|
85
|
+
|
|
86
|
+
```code
|
|
87
|
+
AnRegistry.from_file(path)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
# Issues
|
|
91
|
+
|
|
92
|
+
- Printing Anson subclasses with non-default field without value initialization will result in errors
|
|
93
|
+
|
|
94
|
+
If SynOrg.parent is defined as
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
class SynOrg(Anson)
|
|
98
|
+
parent: str
|
|
99
|
+
|
|
100
|
+
def __init__(self):
|
|
101
|
+
super().__init__()
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
org = Anson.from_file(...)
|
|
107
|
+
print (org)
|
|
108
|
+
|
|
109
|
+
Error
|
|
110
|
+
Traceback (most recent call last):
|
|
111
|
+
File "/home/antson/py3/test/testYellowPages.py", line 18, in testAnregistry
|
|
112
|
+
print(diction)
|
|
113
|
+
File "/usr/lib/python3.12/dataclasses.py", line 262, in wrapper
|
|
114
|
+
result = user_function(self)
|
|
115
|
+
^^^^^^^^^^^^^^^^^^^
|
|
116
|
+
File "<string>", line 3, in __repr__
|
|
117
|
+
File "/usr/lib/python3.12/dataclasses.py", line 262, in wrapper
|
|
118
|
+
result = user_function(self)
|
|
119
|
+
^^^^^^^^^^^^^^^^^^^
|
|
120
|
+
File "<string>", line 3, in __repr__
|
|
121
|
+
File "/usr/lib/python3.12/dataclasses.py", line 262, in wrapper
|
|
122
|
+
result = user_function(self)
|
|
123
|
+
^^^^^^^^^^^^^^^^^^^
|
|
124
|
+
File "<string>", line 3, in __repr__
|
|
125
|
+
AttributeError: 'SynOrg' object has no attribute 'parent'
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
# References
|
|
129
|
+
|
|
130
|
+
- https://packaging.python.org/en/latest/tutorials/packaging-projects/
|
|
131
|
+
|
|
132
|
+
```python3 -m twine upload --repository testpypi dist/*```
|
|
133
|
+
|
|
134
|
+
# Troubleshootings
|
|
135
|
+
|
|
136
|
+
.pypirc
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
[testpypi]
|
|
140
|
+
repository: https://test.pypi.org/legacy/
|
|
141
|
+
username = __token__
|
|
142
|
+
password = pypi-zzz
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
python3 -m twine --version
|
|
147
|
+
twine version 6.1.0 (keyring: 25.6.0, packaging: 24.2, requests: 2.31.0, requests-toolbelt: 1.0.0,
|
|
148
|
+
urllib3: 2.0.7, id: 1.5.0)
|
|
149
|
+
python3 -m build
|
|
150
|
+
python3 -m twine upload --repository testpypi dist/*
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
ERROR InvalidDistribution: Invalid distribution metadata: unrecognized or malformed field
|
|
155
|
+
'license-file'; unrecognized or malformed field 'license-expression'
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Install twine 6.1.0 and packaging 24.
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
pip install packaging -U
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
See [issue #1216](https://github.com/pypa/twine/issues/1216#issuecomment-2609745412).
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "anson.py3"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Ody Z", email="odys.zhou@gmail.com" },
|
|
10
|
+
]
|
|
11
|
+
description = "Anson for Python3"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|
|
18
|
+
license = {text = """Copyright (c) 2025 Ody Z. All rights reserved.
|
|
19
|
+
|
|
20
|
+
This work is licensed under the terms of the MIT license.
|
|
21
|
+
For a copy, see <https://opensource.org/licenses/MIT>.""" }
|
|
22
|
+
|
|
23
|
+
[tool.hatch.build.targets.wheel]
|
|
24
|
+
packages = ["src/anson"]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/odys-z/antson"
|
|
28
|
+
Issues = "https://github.com/odys-z/antson/issues"
|
|
29
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
class AnsonException:
|
|
3
|
+
type = "io.odysz.ansons.x.AnsonException"
|
|
4
|
+
excode = 0
|
|
5
|
+
err = ""
|
|
6
|
+
|
|
7
|
+
def __init__(self, excode: int, template: str, *param: object):
|
|
8
|
+
super().__init__()
|
|
9
|
+
self.excode = excode
|
|
10
|
+
self.err = template if param is None else template.format(param)
|