xkits-command 0.5.2__tar.gz → 0.6__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.
- xkits_command-0.6/.gitignore +176 -0
- xkits_command-0.6/PKG-INFO +18 -0
- xkits_command-0.6/pyproject.toml +42 -0
- {xkits_command-0.5.2 → xkits_command-0.6}/xkits_command/actuator.py +2 -2
- xkits_command-0.6/xkits_command/attribute.py +8 -0
- {xkits_command-0.5.2 → xkits_command-0.6}/xkits_command/parser.py +4 -4
- xkits_command-0.5.2/PKG-INFO +0 -24
- xkits_command-0.5.2/setup.cfg +0 -24
- xkits_command-0.5.2/setup.py +0 -56
- xkits_command-0.5.2/xargproject/__init__.py +0 -0
- xkits_command-0.5.2/xargproject/command.py +0 -45
- xkits_command-0.5.2/xargproject/project.py +0 -284
- xkits_command-0.5.2/xkits_command/attribute.py +0 -10
- xkits_command-0.5.2/xkits_command.egg-info/PKG-INFO +0 -24
- xkits_command-0.5.2/xkits_command.egg-info/SOURCES.txt +0 -18
- xkits_command-0.5.2/xkits_command.egg-info/dependency_links.txt +0 -1
- xkits_command-0.5.2/xkits_command.egg-info/entry_points.txt +0 -2
- xkits_command-0.5.2/xkits_command.egg-info/requires.txt +0 -2
- xkits_command-0.5.2/xkits_command.egg-info/top_level.txt +0 -2
- xkits_command-0.5.2/xkits_command.egg-info/zip-safe +0 -1
- {xkits_command-0.5.2 → xkits_command-0.6}/LICENSE +0 -0
- /xkits_command-0.5.2/README.md → /xkits_command-0.6/readme.md +0 -0
- {xkits_command-0.5.2 → xkits_command-0.6}/xkits_command/__init__.py +0 -0
|
@@ -0,0 +1,176 @@
|
|
|
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
|
+
.stestr
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py,cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
cover/
|
|
55
|
+
|
|
56
|
+
# Translations
|
|
57
|
+
*.mo
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
# Django stuff:
|
|
61
|
+
*.log
|
|
62
|
+
local_settings.py
|
|
63
|
+
db.sqlite3
|
|
64
|
+
db.sqlite3-journal
|
|
65
|
+
|
|
66
|
+
# Flask stuff:
|
|
67
|
+
instance/
|
|
68
|
+
.webassets-cache
|
|
69
|
+
|
|
70
|
+
# Scrapy stuff:
|
|
71
|
+
.scrapy
|
|
72
|
+
|
|
73
|
+
# Sphinx documentation
|
|
74
|
+
docs/_build/
|
|
75
|
+
|
|
76
|
+
# PyBuilder
|
|
77
|
+
.pybuilder/
|
|
78
|
+
target/
|
|
79
|
+
|
|
80
|
+
# Jupyter Notebook
|
|
81
|
+
.ipynb_checkpoints
|
|
82
|
+
|
|
83
|
+
# IPython
|
|
84
|
+
profile_default/
|
|
85
|
+
ipython_config.py
|
|
86
|
+
|
|
87
|
+
# pyenv
|
|
88
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
89
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
90
|
+
.python-version
|
|
91
|
+
|
|
92
|
+
# pipenv
|
|
93
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
94
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
95
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
96
|
+
# install all needed dependencies.
|
|
97
|
+
#Pipfile.lock
|
|
98
|
+
|
|
99
|
+
# UV
|
|
100
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
101
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
102
|
+
# commonly ignored for libraries.
|
|
103
|
+
#uv.lock
|
|
104
|
+
|
|
105
|
+
# poetry
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
107
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
108
|
+
# commonly ignored for libraries.
|
|
109
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
110
|
+
#poetry.lock
|
|
111
|
+
|
|
112
|
+
# pdm
|
|
113
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
114
|
+
#pdm.lock
|
|
115
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
116
|
+
# in version control.
|
|
117
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
118
|
+
.pdm.toml
|
|
119
|
+
.pdm-python
|
|
120
|
+
.pdm-build/
|
|
121
|
+
|
|
122
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
123
|
+
__pypackages__/
|
|
124
|
+
|
|
125
|
+
# Celery stuff
|
|
126
|
+
celerybeat-schedule
|
|
127
|
+
celerybeat.pid
|
|
128
|
+
|
|
129
|
+
# SageMath parsed files
|
|
130
|
+
*.sage.py
|
|
131
|
+
|
|
132
|
+
# Environments
|
|
133
|
+
.env
|
|
134
|
+
.venv
|
|
135
|
+
env/
|
|
136
|
+
venv/
|
|
137
|
+
ENV/
|
|
138
|
+
env.bak/
|
|
139
|
+
venv.bak/
|
|
140
|
+
|
|
141
|
+
# Spyder project settings
|
|
142
|
+
.spyderproject
|
|
143
|
+
.spyproject
|
|
144
|
+
|
|
145
|
+
# Rope project settings
|
|
146
|
+
.ropeproject
|
|
147
|
+
|
|
148
|
+
# mkdocs documentation
|
|
149
|
+
/site
|
|
150
|
+
|
|
151
|
+
# mypy
|
|
152
|
+
.mypy_cache/
|
|
153
|
+
.dmypy.json
|
|
154
|
+
dmypy.json
|
|
155
|
+
|
|
156
|
+
# Pyre type checker
|
|
157
|
+
.pyre/
|
|
158
|
+
|
|
159
|
+
# pytype static type analyzer
|
|
160
|
+
.pytype/
|
|
161
|
+
|
|
162
|
+
# Cython debug symbols
|
|
163
|
+
cython_debug/
|
|
164
|
+
|
|
165
|
+
# PyCharm
|
|
166
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
167
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
168
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
169
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
170
|
+
#.idea/
|
|
171
|
+
|
|
172
|
+
# Ruff stuff:
|
|
173
|
+
.ruff_cache/
|
|
174
|
+
|
|
175
|
+
# PyPI configuration file
|
|
176
|
+
.pypirc
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xkits-command
|
|
3
|
+
Version: 0.6
|
|
4
|
+
Summary: Command line module
|
|
5
|
+
Project-URL: Homepage, https://github.com/bondbox/xcommand/
|
|
6
|
+
Author-email: Mingzhe Zou <zoumingzhe@outlook.com>
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: argcomplete,argparse,bash,command-line,shell,terminal
|
|
9
|
+
Classifier: Programming Language :: Python
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Requires-Dist: argcomplete>=3.2.1
|
|
13
|
+
Requires-Dist: xkits-logger>=0.3
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
# xcommand
|
|
17
|
+
|
|
18
|
+
> Command line module
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "hatchling.build"
|
|
3
|
+
requires = [ "hatch-requirements-txt", "hatchling", "xpip-build>=1.4",]
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3",]
|
|
7
|
+
description = "Command line module"
|
|
8
|
+
dynamic = [ "dependencies", "version",]
|
|
9
|
+
keywords = [ "argcomplete", "argparse", "bash", "command-line", "shell", "terminal",]
|
|
10
|
+
license-files = [ "LICENSE",]
|
|
11
|
+
name = "xkits-command"
|
|
12
|
+
requires-python = ">=3.8"
|
|
13
|
+
[[project.authors]]
|
|
14
|
+
name = "Mingzhe Zou"
|
|
15
|
+
email = "zoumingzhe@outlook.com"
|
|
16
|
+
|
|
17
|
+
[project.readme]
|
|
18
|
+
content-type = "text/markdown"
|
|
19
|
+
file = "readme.md"
|
|
20
|
+
|
|
21
|
+
[project.scripts]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://github.com/bondbox/xcommand/"
|
|
25
|
+
|
|
26
|
+
[tool.hatch.version]
|
|
27
|
+
path = "xkits_command/attribute.py"
|
|
28
|
+
|
|
29
|
+
[tool.hatch.build.targets.sdist]
|
|
30
|
+
exclude = [ "xkits_command/unittest",]
|
|
31
|
+
packages = [ "xkits_command",]
|
|
32
|
+
|
|
33
|
+
[tool.hatch.build.targets.wheel]
|
|
34
|
+
exclude = [ "xkits_command/unittest",]
|
|
35
|
+
packages = [ "xkits_command",]
|
|
36
|
+
|
|
37
|
+
[tool.hatch.metadata.hooks.requirements_txt]
|
|
38
|
+
files = [ "requirements.txt",]
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.sdist.force-include]
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build.targets.wheel.force-include]
|
|
@@ -19,7 +19,7 @@ from typing import Tuple
|
|
|
19
19
|
|
|
20
20
|
from xkits_logger.logger import Logger as Log
|
|
21
21
|
|
|
22
|
-
from xkits_command.attribute import
|
|
22
|
+
from xkits_command.attribute import __project_name__
|
|
23
23
|
from xkits_command.parser import ArgParser
|
|
24
24
|
|
|
25
25
|
|
|
@@ -350,7 +350,7 @@ class Command(Log):
|
|
|
350
350
|
|
|
351
351
|
def __init__(self):
|
|
352
352
|
if not self.__INITIALIZED:
|
|
353
|
-
self.__prog: str =
|
|
353
|
+
self.__prog: str = __project_name__
|
|
354
354
|
self.__root: Optional[CommandArgument] = None
|
|
355
355
|
self.__args: Namespace = Namespace()
|
|
356
356
|
self.__version: Optional[str] = None
|
|
@@ -12,8 +12,8 @@ from typing import Sequence
|
|
|
12
12
|
from typing import Set
|
|
13
13
|
from typing import Tuple
|
|
14
14
|
|
|
15
|
-
from xkits_command.attribute import
|
|
16
|
-
from xkits_command.attribute import
|
|
15
|
+
from xkits_command.attribute import __project_name__
|
|
16
|
+
from xkits_command.attribute import __project_home__
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class Checker():
|
|
@@ -75,8 +75,8 @@ class ArgParser(ArgumentParser):
|
|
|
75
75
|
prog: Optional[str] = None,
|
|
76
76
|
usage: Optional[str] = None,
|
|
77
77
|
prev_parser: Optional["ArgParser"] = None,
|
|
78
|
-
description: Optional[str] = f"Command-line based on {
|
|
79
|
-
epilog: Optional[str] = f"For more, please visit {
|
|
78
|
+
description: Optional[str] = f"Command-line based on {__project_name__}.", # noqa:E501
|
|
79
|
+
epilog: Optional[str] = f"For more, please visit {__project_home__}", # noqa:E501
|
|
80
80
|
**kwargs):
|
|
81
81
|
kwargs.setdefault("prog", prog)
|
|
82
82
|
kwargs.setdefault("usage", usage)
|
xkits_command-0.5.2/PKG-INFO
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: xkits-command
|
|
3
|
-
Version: 0.5.2
|
|
4
|
-
Summary: Command line module
|
|
5
|
-
Home-page: https://github.com/bondbox/xcommand/
|
|
6
|
-
Author: Mingzhe Zou
|
|
7
|
-
Author-email: zoumingzhe@outlook.com
|
|
8
|
-
License: GPLv2
|
|
9
|
-
Project-URL: Source Code, https://github.com/bondbox/xcommand/
|
|
10
|
-
Project-URL: Bug Tracker, https://github.com/bondbox/xcommand/issues
|
|
11
|
-
Project-URL: Documentation, https://github.com/bondbox/xcommand/
|
|
12
|
-
Keywords: command-line,argparse,argcomplete,shell,bash,terminal
|
|
13
|
-
Platform: any
|
|
14
|
-
Classifier: Programming Language :: Python
|
|
15
|
-
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Requires-Python: >=3.8
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
License-File: LICENSE
|
|
19
|
-
Requires-Dist: argcomplete>=3.2.1
|
|
20
|
-
Requires-Dist: xkits-logger>=0.2
|
|
21
|
-
|
|
22
|
-
# xcommand
|
|
23
|
-
|
|
24
|
-
> Command line module
|
xkits_command-0.5.2/setup.cfg
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
[metadata]
|
|
2
|
-
keywords = command-line, argparse, argcomplete, shell, bash, terminal
|
|
3
|
-
long_description = file: README.md
|
|
4
|
-
long_description_content_type = text/markdown
|
|
5
|
-
license = GPLv2
|
|
6
|
-
license_files = LICENSE
|
|
7
|
-
platforms = any
|
|
8
|
-
classifiers =
|
|
9
|
-
Programming Language :: Python
|
|
10
|
-
Programming Language :: Python :: 3
|
|
11
|
-
|
|
12
|
-
[options]
|
|
13
|
-
zip_safe = True
|
|
14
|
-
include_package_data = True
|
|
15
|
-
python_requires = >=3.8
|
|
16
|
-
|
|
17
|
-
[options.entry_points]
|
|
18
|
-
console_scripts =
|
|
19
|
-
xargproject = xargproject.command:main
|
|
20
|
-
|
|
21
|
-
[egg_info]
|
|
22
|
-
tag_build =
|
|
23
|
-
tag_date = 0
|
|
24
|
-
|
xkits_command-0.5.2/setup.py
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
|
|
3
|
-
from urllib.parse import urljoin
|
|
4
|
-
|
|
5
|
-
from setuptools import find_packages
|
|
6
|
-
from setuptools import setup
|
|
7
|
-
from setuptools.command.install import install
|
|
8
|
-
|
|
9
|
-
from xkits_command.attribute import __author__
|
|
10
|
-
from xkits_command.attribute import __author_email__
|
|
11
|
-
from xkits_command.attribute import __description__
|
|
12
|
-
from xkits_command.attribute import __project__
|
|
13
|
-
from xkits_command.attribute import __urlhome__
|
|
14
|
-
from xkits_command.attribute import __version__
|
|
15
|
-
|
|
16
|
-
__urlcode__ = __urlhome__
|
|
17
|
-
__urldocs__ = __urlhome__
|
|
18
|
-
__urlbugs__ = urljoin(__urlhome__, "issues")
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def all_requirements():
|
|
22
|
-
def read_requirements(path: str):
|
|
23
|
-
with open(path, "r", encoding="utf-8") as rhdl:
|
|
24
|
-
return rhdl.read().splitlines()
|
|
25
|
-
|
|
26
|
-
requirements = read_requirements("requirements.txt")
|
|
27
|
-
return requirements
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class CustomInstallCommand(install):
|
|
31
|
-
"""Customized setuptools install command"""
|
|
32
|
-
|
|
33
|
-
def run(self):
|
|
34
|
-
install.run(self) # Run the standard installation
|
|
35
|
-
# Execute your custom code after installation
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
setup(
|
|
39
|
-
name=__project__,
|
|
40
|
-
version=__version__,
|
|
41
|
-
description=__description__,
|
|
42
|
-
url=__urlhome__,
|
|
43
|
-
author=__author__,
|
|
44
|
-
author_email=__author_email__,
|
|
45
|
-
project_urls={"Source Code": __urlcode__,
|
|
46
|
-
"Bug Tracker": __urlbugs__,
|
|
47
|
-
"Documentation": __urldocs__},
|
|
48
|
-
packages=find_packages(
|
|
49
|
-
include=["xkits_command*", "xargproject*"],
|
|
50
|
-
exclude=["xkits_command.unittest", "xargproject.unittest"]
|
|
51
|
-
),
|
|
52
|
-
install_requires=all_requirements(),
|
|
53
|
-
cmdclass={
|
|
54
|
-
"install": CustomInstallCommand,
|
|
55
|
-
}
|
|
56
|
-
)
|
|
File without changes
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# coding:utf-8
|
|
2
|
-
|
|
3
|
-
from typing import Optional
|
|
4
|
-
from typing import Sequence
|
|
5
|
-
|
|
6
|
-
from xkits_command.actuator import Command
|
|
7
|
-
from xkits_command.actuator import CommandArgument
|
|
8
|
-
from xkits_command.actuator import CommandExecutor
|
|
9
|
-
from xkits_command.attribute import __urlhome__
|
|
10
|
-
from xkits_command.attribute import __version__
|
|
11
|
-
from xkits_command.parser import ArgParser
|
|
12
|
-
|
|
13
|
-
from xargproject.project import Project
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@CommandArgument("init", help="Initialize a command-line project.")
|
|
17
|
-
def add_cmd_init(_arg: ArgParser):
|
|
18
|
-
_arg.add_opt_on("--update", help="allow updating existing files")
|
|
19
|
-
_arg.add_argument("--license", help="select license, default to MIT",
|
|
20
|
-
type=str, metavar="LICENSE", default="MIT",
|
|
21
|
-
choices=["MIT", "GPLv2", "GPLv3"])
|
|
22
|
-
_arg.add_pos("project_name", type=str, metavar="PROJECT")
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@CommandExecutor(add_cmd_init)
|
|
26
|
-
def run_cmd_init(cmds: Command) -> int:
|
|
27
|
-
return Project.create(name=cmds.args.project_name,
|
|
28
|
-
license=cmds.args.license,
|
|
29
|
-
allow_update=cmds.args.update)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@CommandArgument("xargproject", description="Create a command-line project")
|
|
33
|
-
def add_cmd(_arg: ArgParser): # pylint: disable=unused-argument
|
|
34
|
-
pass
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
@CommandExecutor(add_cmd, add_cmd_init)
|
|
38
|
-
def run_cmd(cmds: Command) -> int: # pylint: disable=unused-argument
|
|
39
|
-
return 0
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
43
|
-
cmds = Command()
|
|
44
|
-
cmds.version = __version__
|
|
45
|
-
return cmds.run(root=add_cmd, argv=argv, epilog=f"For more, please visit {__urlhome__}.") # noqa:E501
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
# coding:utf-8
|
|
2
|
-
|
|
3
|
-
import os
|
|
4
|
-
|
|
5
|
-
from xkits_command.attribute import __author__
|
|
6
|
-
from xkits_command.attribute import __author_email__
|
|
7
|
-
from xkits_command.attribute import __project__
|
|
8
|
-
from xkits_command.attribute import __urlhome__
|
|
9
|
-
from xkits_command.attribute import __version__
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class Project:
|
|
13
|
-
|
|
14
|
-
def __init__(self, name: str, license: str, allow_update: bool = False): # noqa:E501 pylint: disable=redefined-builtin
|
|
15
|
-
# check illegal characters in project name
|
|
16
|
-
for char in [" "]:
|
|
17
|
-
if char in name:
|
|
18
|
-
raise ValueError(f"Illegal character '{char}' in '{name}'")
|
|
19
|
-
self.__name: str = name
|
|
20
|
-
self.__module: str = self.get_module_name(name)
|
|
21
|
-
self.__license: str = license
|
|
22
|
-
self.__allow_update: bool = allow_update
|
|
23
|
-
|
|
24
|
-
@property
|
|
25
|
-
def name(self) -> str:
|
|
26
|
-
return self.__name
|
|
27
|
-
|
|
28
|
-
@property
|
|
29
|
-
def module(self) -> str:
|
|
30
|
-
return self.__module
|
|
31
|
-
|
|
32
|
-
@property
|
|
33
|
-
def license(self) -> str:
|
|
34
|
-
return self.__license
|
|
35
|
-
|
|
36
|
-
@property
|
|
37
|
-
def allow_update(self) -> bool:
|
|
38
|
-
return self.__allow_update
|
|
39
|
-
|
|
40
|
-
@classmethod
|
|
41
|
-
def get_module_name(cls, project_name: str) -> str:
|
|
42
|
-
return project_name.replace("-", "_")
|
|
43
|
-
|
|
44
|
-
def write(self, path: str, content: str) -> bool:
|
|
45
|
-
if not os.path.exists(path) or self.allow_update:
|
|
46
|
-
with open(path, "w", encoding="utf-8") as whdl:
|
|
47
|
-
if len(content) > 0 and content[-1] != "\n":
|
|
48
|
-
content += "\n"
|
|
49
|
-
whdl.write(content)
|
|
50
|
-
return True
|
|
51
|
-
|
|
52
|
-
def init_requirements(self):
|
|
53
|
-
self.write("requirements.txt", f'''{__project__}>={__version__}''') # noqa:E501
|
|
54
|
-
|
|
55
|
-
def init_coveragerc(self):
|
|
56
|
-
self.write(".coveragerc", f'''[run]
|
|
57
|
-
omit =
|
|
58
|
-
{self.module}/unittest/*
|
|
59
|
-
{self.module}/attribute.py
|
|
60
|
-
|
|
61
|
-
[report]
|
|
62
|
-
exclude_lines =
|
|
63
|
-
pragma: no cover
|
|
64
|
-
raise NotImplementedError
|
|
65
|
-
if __name__ == .__main__.:
|
|
66
|
-
def __repr__
|
|
67
|
-
pass
|
|
68
|
-
''')
|
|
69
|
-
|
|
70
|
-
def init_pylintrc(self):
|
|
71
|
-
self.write(".pylintrc", '''[MASTER]
|
|
72
|
-
disable=
|
|
73
|
-
C0103, # invalid-name
|
|
74
|
-
C0114, # missing-module-docstring
|
|
75
|
-
C0115, # missing-class-docstring
|
|
76
|
-
C0116, # missing-function-docstring
|
|
77
|
-
C0301, # line-too-long
|
|
78
|
-
''')
|
|
79
|
-
|
|
80
|
-
def init_makefile(self):
|
|
81
|
-
self.write("Makefile", f'''MAKEFLAGS += --always-make
|
|
82
|
-
|
|
83
|
-
VERSION := $(shell python3 setup.py --version)
|
|
84
|
-
|
|
85
|
-
all: build reinstall test
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
release: all
|
|
89
|
-
git tag -a v${{VERSION}} -m "release v${{VERSION}}"
|
|
90
|
-
git push origin --tags
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
clean-cover:
|
|
94
|
-
rm -rf cover .coverage coverage.xml htmlcov
|
|
95
|
-
clean-tox:
|
|
96
|
-
rm -rf .stestr .tox
|
|
97
|
-
clean: build-clean test-clean clean-cover clean-tox
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
upload:
|
|
101
|
-
python3 -m pip install --upgrade xpip-upload
|
|
102
|
-
xpip-upload --config-file .pypirc dist/*
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
build-prepare:
|
|
106
|
-
python3 -m pip install --upgrade -r requirements.txt
|
|
107
|
-
python3 -m pip install --upgrade xpip-build
|
|
108
|
-
build-clean:
|
|
109
|
-
xpip-build --debug setup --clean
|
|
110
|
-
build: build-prepare build-clean
|
|
111
|
-
xpip-build --debug setup --all
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
install:
|
|
115
|
-
python3 -m pip install --force-reinstall --no-deps dist/*.whl
|
|
116
|
-
uninstall:
|
|
117
|
-
python3 -m pip uninstall -y {self.name}
|
|
118
|
-
reinstall: uninstall install
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
test-prepare:
|
|
122
|
-
python3 -m pip install --upgrade mock pylint flake8 pytest pytest-cov
|
|
123
|
-
pylint:
|
|
124
|
-
pylint $(shell git ls-files {self.module}/*.py)
|
|
125
|
-
flake8:
|
|
126
|
-
flake8 {self.module} --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
127
|
-
flake8 {self.module} --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
128
|
-
pytest:
|
|
129
|
-
pytest --cov={self.module} --cov-report=term-missing --cov-report=xml --cov-report=html --cov-config=.coveragerc --cov-fail-under=100
|
|
130
|
-
pytest-clean:
|
|
131
|
-
rm -rf .pytest_cache
|
|
132
|
-
test: test-prepare pylint flake8 pytest
|
|
133
|
-
test-clean: pytest-clean
|
|
134
|
-
''') # noqa:W191,E101,E501
|
|
135
|
-
|
|
136
|
-
def init_project(self):
|
|
137
|
-
command_module = self.get_module_name(__project__)
|
|
138
|
-
os.makedirs(self.module, exist_ok=True)
|
|
139
|
-
os.makedirs(os.path.join(self.module, "unittest"), exist_ok=True)
|
|
140
|
-
self.write(os.path.join(self.module, "__init__.py"), "")
|
|
141
|
-
self.write(os.path.join(self.module, "unittest", "__init__.py"), "")
|
|
142
|
-
self.write(os.path.join(self.module, "attribute.py"),
|
|
143
|
-
f'''# coding:utf-8
|
|
144
|
-
|
|
145
|
-
__project__ = "{self.name}"
|
|
146
|
-
__version__ = "0.1.alpha.1"
|
|
147
|
-
__urlhome__ = "{__urlhome__}"
|
|
148
|
-
__description__ = "Automatically created by {__project__}."
|
|
149
|
-
|
|
150
|
-
# author
|
|
151
|
-
__author__ = "{__author__}"
|
|
152
|
-
__author_email__ = "{__author_email__}"
|
|
153
|
-
''')
|
|
154
|
-
self.write(os.path.join(self.module, "command.py"),
|
|
155
|
-
f'''# coding:utf-8
|
|
156
|
-
|
|
157
|
-
from typing import Optional
|
|
158
|
-
from typing import Sequence
|
|
159
|
-
|
|
160
|
-
from {command_module} import ArgParser
|
|
161
|
-
from {command_module} import Command
|
|
162
|
-
from {command_module} import CommandArgument
|
|
163
|
-
from {command_module} import CommandExecutor
|
|
164
|
-
|
|
165
|
-
from {self.module}.attribute import __description__
|
|
166
|
-
from {self.module}.attribute import __project__
|
|
167
|
-
from {self.module}.attribute import __urlhome__
|
|
168
|
-
from {self.module}.attribute import __version__
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
@CommandArgument(__project__, description=__description__)
|
|
172
|
-
def add_cmd(_arg: ArgParser): # pylint: disable=unused-argument
|
|
173
|
-
pass
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
@CommandExecutor(add_cmd)
|
|
177
|
-
def run_cmd(cmds: Command) -> int: # pylint: disable=unused-argument
|
|
178
|
-
return 0
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
182
|
-
cmds = Command()
|
|
183
|
-
cmds.version = __version__
|
|
184
|
-
return cmds.run(root=add_cmd, argv=argv, epilog=f"For more, please visit {{__urlhome__}}.") # noqa:E501
|
|
185
|
-
''')
|
|
186
|
-
|
|
187
|
-
def init_readme(self):
|
|
188
|
-
self.write("README.md", f'''# {self.name}
|
|
189
|
-
|
|
190
|
-
> Automatically created by {__project__}.''')
|
|
191
|
-
|
|
192
|
-
def init_setup(self):
|
|
193
|
-
# create setup.cfg
|
|
194
|
-
self.write("setup.cfg", f'''[metadata]
|
|
195
|
-
keywords = command-line, argparse, argcomplete
|
|
196
|
-
long_description = file: README.md
|
|
197
|
-
long_description_content_type = text/markdown
|
|
198
|
-
license = {self.license}
|
|
199
|
-
license_files = LICENSE
|
|
200
|
-
platforms = any
|
|
201
|
-
classifiers =
|
|
202
|
-
Programming Language :: Python
|
|
203
|
-
Programming Language :: Python :: 3
|
|
204
|
-
|
|
205
|
-
[options]
|
|
206
|
-
zip_safe = True
|
|
207
|
-
include_package_data = True
|
|
208
|
-
python_requires = >=3.8
|
|
209
|
-
|
|
210
|
-
[options.entry_points]
|
|
211
|
-
console_scripts =
|
|
212
|
-
{self.name} = {self.module}.command:main
|
|
213
|
-
''')
|
|
214
|
-
|
|
215
|
-
# create setup.py
|
|
216
|
-
self.write("setup.py", f'''# coding=utf-8
|
|
217
|
-
|
|
218
|
-
from os.path import dirname
|
|
219
|
-
from os.path import join
|
|
220
|
-
from urllib.parse import urljoin
|
|
221
|
-
|
|
222
|
-
from setuptools import find_packages
|
|
223
|
-
from setuptools import setup
|
|
224
|
-
from setuptools.command.install import install
|
|
225
|
-
|
|
226
|
-
from {self.module}.attribute import __author__
|
|
227
|
-
from {self.module}.attribute import __author_email__
|
|
228
|
-
from {self.module}.attribute import __description__
|
|
229
|
-
from {self.module}.attribute import __project__
|
|
230
|
-
from {self.module}.attribute import __urlhome__
|
|
231
|
-
from {self.module}.attribute import __version__
|
|
232
|
-
|
|
233
|
-
__urlcode__ = __urlhome__
|
|
234
|
-
__urldocs__ = __urlhome__
|
|
235
|
-
__urlbugs__ = urljoin(__urlhome__, "issues")
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
def all_requirements():
|
|
239
|
-
def read_requirements(path: str):
|
|
240
|
-
with open(path, "r", encoding="utf-8") as rhdl:
|
|
241
|
-
return rhdl.read().splitlines()
|
|
242
|
-
|
|
243
|
-
path: str = join(dirname(__file__), "requirements.txt")
|
|
244
|
-
requirements = read_requirements(path)
|
|
245
|
-
return requirements
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
class CustomInstallCommand(install):
|
|
249
|
-
"""Customized setuptools install command"""
|
|
250
|
-
|
|
251
|
-
def run(self):
|
|
252
|
-
install.run(self) # Run the standard installation
|
|
253
|
-
# Execute your custom code after installation
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
setup(
|
|
257
|
-
name=__project__,
|
|
258
|
-
version=__version__,
|
|
259
|
-
description=__description__,
|
|
260
|
-
url=__urlhome__,
|
|
261
|
-
author=__author__,
|
|
262
|
-
author_email=__author_email__,
|
|
263
|
-
project_urls={{"Source Code": __urlcode__,
|
|
264
|
-
"Bug Tracker": __urlbugs__,
|
|
265
|
-
"Documentation": __urldocs__}},
|
|
266
|
-
packages=find_packages(include=["{self.module}*"], exclude=["{self.module}.unittest"]), # noqa:E501
|
|
267
|
-
install_requires=all_requirements(),
|
|
268
|
-
cmdclass={{
|
|
269
|
-
"install": CustomInstallCommand,
|
|
270
|
-
}}
|
|
271
|
-
)
|
|
272
|
-
''') # noqa:E501
|
|
273
|
-
|
|
274
|
-
@classmethod
|
|
275
|
-
def create(cls, name: str, license: str, allow_update: bool = False) -> int: # noqa:E501 pylint: disable=redefined-builtin
|
|
276
|
-
instance = cls(name=name, license=license, allow_update=allow_update)
|
|
277
|
-
instance.init_requirements()
|
|
278
|
-
instance.init_coveragerc()
|
|
279
|
-
instance.init_pylintrc()
|
|
280
|
-
instance.init_makefile()
|
|
281
|
-
instance.init_project()
|
|
282
|
-
instance.init_readme()
|
|
283
|
-
instance.init_setup()
|
|
284
|
-
return 0
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: xkits-command
|
|
3
|
-
Version: 0.5.2
|
|
4
|
-
Summary: Command line module
|
|
5
|
-
Home-page: https://github.com/bondbox/xcommand/
|
|
6
|
-
Author: Mingzhe Zou
|
|
7
|
-
Author-email: zoumingzhe@outlook.com
|
|
8
|
-
License: GPLv2
|
|
9
|
-
Project-URL: Source Code, https://github.com/bondbox/xcommand/
|
|
10
|
-
Project-URL: Bug Tracker, https://github.com/bondbox/xcommand/issues
|
|
11
|
-
Project-URL: Documentation, https://github.com/bondbox/xcommand/
|
|
12
|
-
Keywords: command-line,argparse,argcomplete,shell,bash,terminal
|
|
13
|
-
Platform: any
|
|
14
|
-
Classifier: Programming Language :: Python
|
|
15
|
-
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Requires-Python: >=3.8
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
License-File: LICENSE
|
|
19
|
-
Requires-Dist: argcomplete>=3.2.1
|
|
20
|
-
Requires-Dist: xkits-logger>=0.2
|
|
21
|
-
|
|
22
|
-
# xcommand
|
|
23
|
-
|
|
24
|
-
> Command line module
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
README.md
|
|
3
|
-
setup.cfg
|
|
4
|
-
setup.py
|
|
5
|
-
xargproject/__init__.py
|
|
6
|
-
xargproject/command.py
|
|
7
|
-
xargproject/project.py
|
|
8
|
-
xkits_command/__init__.py
|
|
9
|
-
xkits_command/actuator.py
|
|
10
|
-
xkits_command/attribute.py
|
|
11
|
-
xkits_command/parser.py
|
|
12
|
-
xkits_command.egg-info/PKG-INFO
|
|
13
|
-
xkits_command.egg-info/SOURCES.txt
|
|
14
|
-
xkits_command.egg-info/dependency_links.txt
|
|
15
|
-
xkits_command.egg-info/entry_points.txt
|
|
16
|
-
xkits_command.egg-info/requires.txt
|
|
17
|
-
xkits_command.egg-info/top_level.txt
|
|
18
|
-
xkits_command.egg-info/zip-safe
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|