nerva-py 1.0.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.
- nerva_py-1.0.0/.github/FUNDING.yml +3 -0
- nerva_py-1.0.0/.github/workflows/build.yml +27 -0
- nerva_py-1.0.0/.github/workflows/publish.yml +25 -0
- nerva_py-1.0.0/.github/workflows/ruff.yml +28 -0
- nerva_py-1.0.0/.gitignore +160 -0
- nerva_py-1.0.0/.pre-commit-config.yaml +6 -0
- nerva_py-1.0.0/.python-version +1 -0
- nerva_py-1.0.0/LICENSE +21 -0
- nerva_py-1.0.0/Makefile +18 -0
- nerva_py-1.0.0/PKG-INFO +96 -0
- nerva_py-1.0.0/README.md +72 -0
- nerva_py-1.0.0/nerva/__init__.py +45 -0
- nerva_py-1.0.0/nerva/__main__.py +54 -0
- nerva_py-1.0.0/nerva/daemon.py +1326 -0
- nerva_py-1.0.0/nerva/utils.py +53 -0
- nerva_py-1.0.0/nerva/wallet.py +2179 -0
- nerva_py-1.0.0/pyproject.toml +57 -0
- nerva_py-1.0.0/uv.lock +759 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: ci/gh-actions/build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
paths-ignore:
|
|
6
|
+
- "README.md"
|
|
7
|
+
pull_request:
|
|
8
|
+
paths-ignore:
|
|
9
|
+
- "README.md"
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v3
|
|
19
|
+
with:
|
|
20
|
+
version: "0.4.22"
|
|
21
|
+
enable-cache: true
|
|
22
|
+
- name: Set up Python
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version-file: ".python-version"
|
|
26
|
+
- name: Build
|
|
27
|
+
run: uv build
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: ci/gh-actions/publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- '*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- name: Install uv
|
|
14
|
+
uses: astral-sh/setup-uv@v3
|
|
15
|
+
with:
|
|
16
|
+
version: "0.4.22"
|
|
17
|
+
enable-cache: true
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version-file: ".python-version"
|
|
22
|
+
- name: Build
|
|
23
|
+
run: uv build
|
|
24
|
+
- name: Publish
|
|
25
|
+
run: uv publish --token ${{ secrets.PYPI_TOKEN }}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: ci/gh-actions/ruff
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
paths-ignore:
|
|
6
|
+
- "README.md"
|
|
7
|
+
pull_request:
|
|
8
|
+
paths-ignore:
|
|
9
|
+
- "README.md"
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
ruff:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version-file: ".python-version"
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: |
|
|
23
|
+
python -m pip install --upgrade pip
|
|
24
|
+
pip install ruff
|
|
25
|
+
- name: Lint
|
|
26
|
+
run: ruff check --select I --no-fix .
|
|
27
|
+
- name: Format
|
|
28
|
+
run: ruff format --check .
|
|
@@ -0,0 +1,160 @@
|
|
|
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
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
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
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't projects.html, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
158
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
159
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
160
|
+
.idea/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
nerva_py-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Sayan "Sn1F3rt" Bhattacharyya
|
|
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.
|
nerva_py-1.0.0/Makefile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
env:
|
|
2
|
+
uv sync --no-dev
|
|
3
|
+
|
|
4
|
+
dev:
|
|
5
|
+
uv sync --all-extras
|
|
6
|
+
|
|
7
|
+
format:
|
|
8
|
+
ruff check --select I --fix .
|
|
9
|
+
ruff format .
|
|
10
|
+
|
|
11
|
+
build:
|
|
12
|
+
uv build
|
|
13
|
+
|
|
14
|
+
publish:
|
|
15
|
+
uv publish --token $(token)
|
|
16
|
+
|
|
17
|
+
.PHONY: env dev format build publish
|
|
18
|
+
.DEFAULT_GOAL := build
|
nerva_py-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: nerva-py
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python bindings for the JSON RPC interface of the Nerva cryptocurrency.
|
|
5
|
+
Author-email: Sayan Bhattacharyya <sayan@sn1f3rt.dev>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: bindings,cryptocurrency,json-rpc,nerva,python
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Requires-Dist: aiohttp>=3.10.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# Nerva Python Library
|
|
26
|
+
|
|
27
|
+
[](https://github.com/Sn1F3rt/nerva-py/actions/workflows/ruff.yml)
|
|
28
|
+
[](https://github.com/Sn1F3rt/nerva-py/actions/workflows/build.yml)
|
|
29
|
+
[](LICENSE)
|
|
30
|
+
|
|
31
|
+
## Table of Contents
|
|
32
|
+
|
|
33
|
+
- [About](#about)
|
|
34
|
+
- [Installation](#installation)
|
|
35
|
+
* [Requirements](#requirements)
|
|
36
|
+
* [Setup](#setup)
|
|
37
|
+
- [Documentation](#documentation)
|
|
38
|
+
- [Support](#support)
|
|
39
|
+
- [License](#license)
|
|
40
|
+
|
|
41
|
+
## About
|
|
42
|
+
|
|
43
|
+
Python bindings for the JSON RPC interface of the Nerva cryptocurrency.
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
### Requirements
|
|
48
|
+
|
|
49
|
+
- Python 3.8+
|
|
50
|
+
- [`uv`](https://docs.astral.sh/uv/) (for development only)
|
|
51
|
+
|
|
52
|
+
### Setup
|
|
53
|
+
|
|
54
|
+
To install current latest release you can use following command:
|
|
55
|
+
```sh
|
|
56
|
+
pip install nerva-py
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
To install the latest development version you can use following command:
|
|
60
|
+
```sh
|
|
61
|
+
uv add git+https://github.com/Sn1F3rt/nerva-py.git --branch main
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Documentation
|
|
65
|
+
|
|
66
|
+
Developers please refer to the docstrings in the code for more information. Full API reference will be available soon.
|
|
67
|
+
|
|
68
|
+
Here is a simple example to get you started:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import asyncio
|
|
72
|
+
|
|
73
|
+
from nerva.daemon import DaemonJSONRPC
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
async def main():
|
|
77
|
+
daemon = DaemonJSONRPC(
|
|
78
|
+
host="x.y.z.w",
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
print(await daemon.get_info())
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
asyncio.run(main())
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Support
|
|
88
|
+
|
|
89
|
+
- [Issues](https://github.com/Sn1F3rt/nerva-py/issues)
|
|
90
|
+
- [Discord](https://discord.gg/ufysfvcFwe) - `Development > #nerva-py`
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
[MIT License](LICENSE)
|
|
95
|
+
|
|
96
|
+
Copyright © 2024 [Sayan "Sn1F3rt" Bhattacharyya](https://sn1f3rt.dev)
|
nerva_py-1.0.0/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Nerva Python Library
|
|
2
|
+
|
|
3
|
+
[](https://github.com/Sn1F3rt/nerva-py/actions/workflows/ruff.yml)
|
|
4
|
+
[](https://github.com/Sn1F3rt/nerva-py/actions/workflows/build.yml)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [About](#about)
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
* [Requirements](#requirements)
|
|
12
|
+
* [Setup](#setup)
|
|
13
|
+
- [Documentation](#documentation)
|
|
14
|
+
- [Support](#support)
|
|
15
|
+
- [License](#license)
|
|
16
|
+
|
|
17
|
+
## About
|
|
18
|
+
|
|
19
|
+
Python bindings for the JSON RPC interface of the Nerva cryptocurrency.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
### Requirements
|
|
24
|
+
|
|
25
|
+
- Python 3.8+
|
|
26
|
+
- [`uv`](https://docs.astral.sh/uv/) (for development only)
|
|
27
|
+
|
|
28
|
+
### Setup
|
|
29
|
+
|
|
30
|
+
To install current latest release you can use following command:
|
|
31
|
+
```sh
|
|
32
|
+
pip install nerva-py
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
To install the latest development version you can use following command:
|
|
36
|
+
```sh
|
|
37
|
+
uv add git+https://github.com/Sn1F3rt/nerva-py.git --branch main
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Documentation
|
|
41
|
+
|
|
42
|
+
Developers please refer to the docstrings in the code for more information. Full API reference will be available soon.
|
|
43
|
+
|
|
44
|
+
Here is a simple example to get you started:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import asyncio
|
|
48
|
+
|
|
49
|
+
from nerva.daemon import DaemonJSONRPC
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
async def main():
|
|
53
|
+
daemon = DaemonJSONRPC(
|
|
54
|
+
host="x.y.z.w",
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
print(await daemon.get_info())
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
asyncio.run(main())
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Support
|
|
64
|
+
|
|
65
|
+
- [Issues](https://github.com/Sn1F3rt/nerva-py/issues)
|
|
66
|
+
- [Discord](https://discord.gg/ufysfvcFwe) - `Development > #nerva-py`
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
[MIT License](LICENSE)
|
|
71
|
+
|
|
72
|
+
Copyright © 2024 [Sayan "Sn1F3rt" Bhattacharyya](https://sn1f3rt.dev)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from typing import Literal, NamedTuple
|
|
2
|
+
|
|
3
|
+
from . import (
|
|
4
|
+
utils as utils,
|
|
5
|
+
daemon as daemon,
|
|
6
|
+
wallet as wallet,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class VersionInfo(NamedTuple):
|
|
11
|
+
major: int
|
|
12
|
+
minor: int
|
|
13
|
+
micro: int
|
|
14
|
+
releaselevel: Literal[
|
|
15
|
+
"alpha", "beta", "release-candidate", "post", "dev", "final"
|
|
16
|
+
]
|
|
17
|
+
serial: int
|
|
18
|
+
|
|
19
|
+
def __str__(self) -> str:
|
|
20
|
+
v = f"{version_info.major}.{version_info.minor}.{version_info.micro}"
|
|
21
|
+
|
|
22
|
+
if version_info.releaselevel != "final":
|
|
23
|
+
if version_info.releaselevel == "alpha":
|
|
24
|
+
v += "a"
|
|
25
|
+
elif version_info.releaselevel == "beta":
|
|
26
|
+
v += "b"
|
|
27
|
+
elif version_info.releaselevel == "release-candidate":
|
|
28
|
+
v += "rc"
|
|
29
|
+
elif version_info.releaselevel == "post":
|
|
30
|
+
v += "post"
|
|
31
|
+
elif version_info.releaselevel == "dev":
|
|
32
|
+
v += "dev"
|
|
33
|
+
|
|
34
|
+
v += str(version_info.serial)
|
|
35
|
+
|
|
36
|
+
return v
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
version_info: VersionInfo = VersionInfo(
|
|
40
|
+
major=1, minor=0, micro=0, releaselevel="final", serial=0
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
__version__ = str(version_info)
|
|
44
|
+
|
|
45
|
+
del NamedTuple, Literal, VersionInfo
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import argparse
|
|
3
|
+
import platform
|
|
4
|
+
|
|
5
|
+
import aiohttp
|
|
6
|
+
|
|
7
|
+
import nerva
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def show_version() -> None:
|
|
11
|
+
entries = list()
|
|
12
|
+
|
|
13
|
+
v = sys.version_info
|
|
14
|
+
entries.append(
|
|
15
|
+
f"- Python v{v.major}.{v.minor}.{v.micro}"
|
|
16
|
+
+ (f"-{v.releaselevel}{v.serial}" if v.releaselevel != "final" else "")
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
entries.append(f"- nerva-py v{nerva.__version__}")
|
|
20
|
+
|
|
21
|
+
entries.append(f"- aiohttp v{aiohttp.__version__}")
|
|
22
|
+
|
|
23
|
+
uname = platform.uname()
|
|
24
|
+
entries.append(f"- System Info: {uname.system} {uname.release} {uname.version}")
|
|
25
|
+
|
|
26
|
+
print("\n".join(entries))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def core(parser: argparse.ArgumentParser, args: argparse.Namespace) -> None:
|
|
30
|
+
if args.version:
|
|
31
|
+
show_version()
|
|
32
|
+
else:
|
|
33
|
+
parser.print_help()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def parse_args() -> tuple[argparse.ArgumentParser, argparse.Namespace]:
|
|
37
|
+
parser = argparse.ArgumentParser(
|
|
38
|
+
prog="pyxnv", description="Tools for helping with the library"
|
|
39
|
+
)
|
|
40
|
+
parser.add_argument(
|
|
41
|
+
"-v", "--version", action="store_true", help="Shows the library version"
|
|
42
|
+
)
|
|
43
|
+
parser.set_defaults(func=core)
|
|
44
|
+
|
|
45
|
+
return parser, parser.parse_args()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def main() -> None:
|
|
49
|
+
parser, args = parse_args()
|
|
50
|
+
args.func(parser, args)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
if __name__ == "__main__":
|
|
54
|
+
main()
|