py2dataclasses 3.14.112__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.
Files changed (50) hide show
  1. py2dataclasses-3.14.112/.github/workflows/build.yml +62 -0
  2. py2dataclasses-3.14.112/.github/workflows/publish.yaml +55 -0
  3. py2dataclasses-3.14.112/.github/workflows/test.yaml +58 -0
  4. py2dataclasses-3.14.112/.gitignore +144 -0
  5. py2dataclasses-3.14.112/LICENSE +9 -0
  6. py2dataclasses-3.14.112/PKG-INFO +86 -0
  7. py2dataclasses-3.14.112/PYTHON2_USAGE.md +583 -0
  8. py2dataclasses-3.14.112/README.md +43 -0
  9. py2dataclasses-3.14.112/pyproject.toml +4 -0
  10. py2dataclasses-3.14.112/setup.cfg +4 -0
  11. py2dataclasses-3.14.112/setup.py +66 -0
  12. py2dataclasses-3.14.112/src/_py2dataclasses/__init__.py +34 -0
  13. py2dataclasses-3.14.112/src/_py2dataclasses/abc_utils.py +45 -0
  14. py2dataclasses-3.14.112/src/_py2dataclasses/class_utils.py +57 -0
  15. py2dataclasses-3.14.112/src/_py2dataclasses/dataclasses.py +2101 -0
  16. py2dataclasses-3.14.112/src/_py2dataclasses/reprlib.py +237 -0
  17. py2dataclasses-3.14.112/src/_py2dataclasses/string_utils.py +53 -0
  18. py2dataclasses-3.14.112/src/_py2dataclasses/type_utils.py +259 -0
  19. py2dataclasses-3.14.112/src/dataclasses.py +1 -0
  20. py2dataclasses-3.14.112/src/py2dataclasses.egg-info/PKG-INFO +86 -0
  21. py2dataclasses-3.14.112/src/py2dataclasses.egg-info/SOURCES.txt +48 -0
  22. py2dataclasses-3.14.112/src/py2dataclasses.egg-info/dependency_links.txt +1 -0
  23. py2dataclasses-3.14.112/src/py2dataclasses.egg-info/requires.txt +15 -0
  24. py2dataclasses-3.14.112/src/py2dataclasses.egg-info/top_level.txt +3 -0
  25. py2dataclasses-3.14.112/src/py2dataclasses.py +1 -0
  26. py2dataclasses-3.14.112/tests/README.md +30 -0
  27. py2dataclasses-3.14.112/tests/__init__.py +13 -0
  28. py2dataclasses-3.14.112/tests/_fixtures_compat_backport_to_stdlib.py +123 -0
  29. py2dataclasses-3.14.112/tests/_fixtures_compat_stdlib_to_backport.py +55 -0
  30. py2dataclasses-3.14.112/tests/_fixtures_loader.py +75 -0
  31. py2dataclasses-3.14.112/tests/_fixtures_py27/__init__.py +5063 -0
  32. py2dataclasses-3.14.112/tests/_fixtures_py27/dataclass_module_1.py +32 -0
  33. py2dataclasses-3.14.112/tests/_fixtures_py27/dataclass_module_1_str.py +32 -0
  34. py2dataclasses-3.14.112/tests/_fixtures_py27/dataclass_module_2.py +32 -0
  35. py2dataclasses-3.14.112/tests/_fixtures_py27/dataclass_module_2_str.py +32 -0
  36. py2dataclasses-3.14.112/tests/_fixtures_py27/dataclass_textanno.py +12 -0
  37. py2dataclasses-3.14.112/tests/_fixtures_py314/__init__.py +5349 -0
  38. py2dataclasses-3.14.112/tests/_fixtures_py314/dataclass_module_1.py +32 -0
  39. py2dataclasses-3.14.112/tests/_fixtures_py314/dataclass_module_1_str.py +32 -0
  40. py2dataclasses-3.14.112/tests/_fixtures_py314/dataclass_module_2.py +32 -0
  41. py2dataclasses-3.14.112/tests/_fixtures_py314/dataclass_module_2_str.py +32 -0
  42. py2dataclasses-3.14.112/tests/_fixtures_py314/dataclass_textanno.py +12 -0
  43. py2dataclasses-3.14.112/tests/_xmlrunner.py +27 -0
  44. py2dataclasses-3.14.112/tests/test_load.py +1208 -0
  45. py2dataclasses-3.14.112/tests/test_native_on_nativelib.py +10 -0
  46. py2dataclasses-3.14.112/tests/test_native_on_portedlib.py +17 -0
  47. py2dataclasses-3.14.112/tests/test_ported_on_nativelib.py +10 -0
  48. py2dataclasses-3.14.112/tests/test_ported_on_portedlib.py +10 -0
  49. py2dataclasses-3.14.112/tests/tests_analyzer.py +157 -0
  50. py2dataclasses-3.14.112/tox.ini +39 -0
@@ -0,0 +1,62 @@
1
+ name: Build
2
+
3
+ concurrency:
4
+ group: ${{ github.workflow }}-${{ github.ref }}
5
+ cancel-in-progress: true
6
+
7
+ on:
8
+ push:
9
+ branches:
10
+ - dev
11
+ - staging
12
+ - master
13
+ tags:
14
+ - "v*"
15
+ pull_request:
16
+
17
+ jobs:
18
+ build:
19
+ strategy:
20
+ matrix:
21
+ include:
22
+ - python-version: "2.7"
23
+ suffix: "2"
24
+ os: ubuntu-latest
25
+ container:
26
+ image: coatldev/six:latest
27
+ env:
28
+ UV_PYTHON: '3.14'
29
+ - python-version: "3.14"
30
+ os: ubuntu-latest
31
+ container: python:3.14
32
+ # - python-version: "3.x"
33
+ # os: ubuntu-latest
34
+ # container: python:latest
35
+
36
+ runs-on: ${{ matrix.os }}
37
+ container: ${{ matrix.container }}
38
+ steps:
39
+ - name: Checkout
40
+ uses: actions/checkout@v4
41
+ with:
42
+ fetch-depth: 0
43
+ - name: Install build tools
44
+ run: |
45
+ python${{ matrix.suffix }} -m pip install --upgrade pip
46
+ python${{ matrix.suffix }} -m pip install setuptools wheel build
47
+
48
+ - name: Build package of py2
49
+ if: matrix.suffix == '2'
50
+ run: |
51
+ python${{ matrix.suffix }} -m build --wheel
52
+
53
+ - name: Build packages
54
+ if: matrix.suffix == ''
55
+ run: |
56
+ python${{ matrix.suffix }} -m build
57
+
58
+ - name: Upload artifacts
59
+ uses: actions/upload-artifact@v4
60
+ with:
61
+ name: py2dataclasses-py${{ matrix.python-version }}
62
+ path: dist/*
@@ -0,0 +1,55 @@
1
+ name: Publish
2
+ permissions:
3
+ contents: write
4
+ discussions: write
5
+ on:
6
+ push:
7
+ tags:
8
+ - "v*"
9
+ workflow_dispatch:
10
+ inputs:
11
+ ref:
12
+ description: 'Release commit or tag'
13
+ required: false
14
+ type: string
15
+ default: ''
16
+
17
+ jobs:
18
+ publish:
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - name: Checkout
23
+ uses: actions/checkout@v4
24
+ with:
25
+ ref: ${{ inputs.ref || github.sha }}
26
+ fetch-depth: 0
27
+
28
+ - name: Download artifacts
29
+ uses: dawidd6/action-download-artifact@v3
30
+ with:
31
+ workflow: build.yml
32
+ workflow_conclusion: success
33
+ commit: ${{ inputs.ref || github.sha }}
34
+ path: dist
35
+
36
+ - name: Install Twine
37
+ run: |
38
+ python -m pip install --upgrade pip
39
+ python -m pip install twine
40
+
41
+ - name: Create release and upload assets
42
+ if: ${{ startsWith(github.ref, 'refs/tags/') }}
43
+ uses: softprops/action-gh-release@v2
44
+ with:
45
+ files: |
46
+ dist/**/*
47
+ env:
48
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
49
+
50
+ - name: Publish to PyPI
51
+ env:
52
+ TWINE_USERNAME: __token__
53
+ TWINE_PASSWORD: ${{ secrets.PYPI }}
54
+ run: |
55
+ python -m twine upload dist/**/* --verbose
@@ -0,0 +1,58 @@
1
+ name: Test
2
+
3
+ on: [push]
4
+
5
+ concurrency:
6
+ group: ${{ github.workflow }}-${{ github.ref }}
7
+ cancel-in-progress: true
8
+
9
+ jobs:
10
+ build:
11
+ strategy:
12
+ matrix:
13
+ include:
14
+ - python-version: "2.7"
15
+ os: ubuntu-latest
16
+ suffix: "2"
17
+ container:
18
+ image: coatldev/six:latest
19
+ tox-env: "test_ported_on_portedlib_py27"
20
+ - python-version: "3.14"
21
+ os: ubuntu-latest
22
+ container: python:3.14
23
+ tox-env: "test_native_on_portedlib"
24
+ - python-version: "3.14"
25
+ os: ubuntu-latest
26
+ container: python:3.14
27
+ tox-env: "test_ported_on_portedlib"
28
+ - python-version: "3.14"
29
+ os: ubuntu-latest
30
+ container: python:3.14
31
+ tox-env: "test_ported_on_nativelib"
32
+ - python-version: "3.14"
33
+ os: ubuntu-latest
34
+ container: python:3.14
35
+ tox-env: "test_native_on_nativelib"
36
+ runs-on: ${{ matrix.os }}
37
+ container: ${{ matrix.container }}
38
+ steps:
39
+ - uses: actions/checkout@v5
40
+ - name: Install deps
41
+ # coatldev/six:latest doesnt have gpg installed so we need to do this.
42
+ # TODO: maybe there is a way to extend container right here in the yml file?
43
+ if: matrix.suffix == '2'
44
+ run: apt-get update --quiet && apt-get install --yes gnupg
45
+ - name: Install tox
46
+ run: python${{ matrix.suffix }} -m pip install tox
47
+ - name: Run tox
48
+ run: python${{ matrix.suffix }} -m tox -e ${{ matrix.tox-env }}
49
+ continue-on-error: true
50
+ - name: Upload test results to Codecov
51
+ if: ${{ !cancelled() }}
52
+ uses: codecov/codecov-action@v5
53
+ with:
54
+ token: ${{ secrets.CODECOV_TOKEN }}
55
+ files: ${{ matrix.tox-env }}.xml
56
+ name: ${{ matrix.tox-env }}
57
+ flags: ${{ matrix.tox-env }}
58
+ slug: nev3rfail/py2dataclasses
@@ -0,0 +1,144 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+ **__pycache__
131
+
132
+ # PyCharm / IntelliJ
133
+ .idea/
134
+ *.iml
135
+ .run/
136
+
137
+ # RStudio project files
138
+ **.Rproj.user/
139
+ **.Rproj.user*
140
+ **.Rproj
141
+ **.Rhistory
142
+
143
+ # MacOS
144
+ .DS_Store
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2025 Python Community
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,86 @@
1
+ Metadata-Version: 2.4
2
+ Name: py2dataclasses
3
+ Version: 3.14.112
4
+ Summary: PEP-557 compatible dataclasses backport for Python 2.7+
5
+ Home-page: https://github.com/nev3rfail/py2dataclasses
6
+ Author: nev3rfail
7
+ License: MIT
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 2
11
+ Classifier: Programming Language :: Python :: 2.7
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.6
14
+ Classifier: Programming Language :: Python :: 3.7
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Software Development :: Libraries
23
+ Requires-Python: >=2.7
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: typing>=3.7; python_version < "3.5"
27
+ Requires-Dist: unittest-xml-reporting>=1.17.0; python_version < "3.5"
28
+ Requires-Dist: typing-extensions>=3.7; python_version < "3.8"
29
+ Requires-Dist: dictproxyhack>=1.1; python_version < "3.0"
30
+ Requires-Dist: funcsigs>=1.0; python_version < "3.0"
31
+ Requires-Dist: six>=1.17
32
+ Requires-Dist: unittest-xml-reporting>=4.0.0; python_version > "3.5"
33
+ Dynamic: author
34
+ Dynamic: classifier
35
+ Dynamic: description
36
+ Dynamic: description-content-type
37
+ Dynamic: home-page
38
+ Dynamic: license
39
+ Dynamic: license-file
40
+ Dynamic: requires-dist
41
+ Dynamic: requires-python
42
+ Dynamic: summary
43
+
44
+ # py2dataclasses
45
+
46
+ This project is a PEP-557 compatible dataclass implementation for Python 2.7.
47
+
48
+ ## Usage
49
+
50
+ On Python 2.7 there is no annotation syntax (`x: int`), so fields are declared using `field()` descriptors:
51
+
52
+ ```python
53
+ from dataclasses import dataclass, field
54
+
55
+ @dataclass
56
+ class Point(object):
57
+ x = field(int)
58
+ y = field(int)
59
+
60
+ p = Point(3, 4)
61
+ print(p) # Point(x=3, y=4)
62
+ print(p.x) # 3
63
+ print(p == Point(3, 4)) # True
64
+ ```
65
+
66
+ ## Disclaimer
67
+
68
+ Sometimes systems have a proprietary legacy that is not possible
69
+ to port to newer versions of languages. But people
70
+ still need to work, systems using python 2 still have to be supported and extended.
71
+
72
+ ### ⚠ WARNING
73
+
74
+ * Please, DO NOT use Python 2.7 in 2026
75
+
76
+
77
+ ## Development
78
+
79
+ - This is quite a straightforward convertion of dataclasses into a py2 syntax/standard done initially by neural network,
80
+ and after that it was reviewed, fixed and finished by human.
81
+ - Tests are taken from the cpython 3.14 branch and converted to py2
82
+
83
+ ## Testing
84
+
85
+ - This project aims to pass all the tests from Python 3.14
86
+ - It also aims to pass all backported tests.