xproject-python 0.1__py3-none-any.whl
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.
- xproject_python/__init__.py +0 -0
- xproject_python/attribute.py +8 -0
- xproject_python/configure.py +162 -0
- xproject_python/projector.py +367 -0
- xproject_python/templates/module/__init__.py +0 -0
- xproject_python/templates/module/attribute.py +8 -0
- xproject_python/templates/package/.coveragerc +12 -0
- xproject_python/templates/package/.flake8 +9 -0
- xproject_python/templates/package/.pylintrc +7 -0
- xproject_python/templates/package/Makefile +59 -0
- xproject_python/templates/package/hatch_build.py +9 -0
- xproject_python/templates/package/pyproject.toml +48 -0
- xproject_python/templates/project/readme.md +3 -0
- xproject_python/utilities.py +216 -0
- xproject_python-0.1.dist-info/METADATA +19 -0
- xproject_python-0.1.dist-info/RECORD +19 -0
- xproject_python-0.1.dist-info/WHEEL +4 -0
- xproject_python-0.1.dist-info/entry_points.txt +3 -0
- xproject_python-0.1.dist-info/licenses/LICENSE +339 -0
|
File without changes
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from dataclasses import field
|
|
5
|
+
from errno import ENOENT
|
|
6
|
+
from typing import Dict
|
|
7
|
+
from typing import List
|
|
8
|
+
from typing import Optional
|
|
9
|
+
from typing import Sequence
|
|
10
|
+
|
|
11
|
+
from xkits_command.actuator import Command
|
|
12
|
+
from xkits_command.actuator import CommandArgument
|
|
13
|
+
from xkits_command.actuator import CommandExecutor
|
|
14
|
+
from xkits_command.parser import ArgParser
|
|
15
|
+
from xkits_config import Settings
|
|
16
|
+
from xkits_config_toml import ConfigTOML
|
|
17
|
+
|
|
18
|
+
from xproject_python.attribute import __project_home__ as xproject_home
|
|
19
|
+
from xproject_python.attribute import __project_name__ as xproject_name
|
|
20
|
+
from xproject_python.attribute import __version__ as version
|
|
21
|
+
|
|
22
|
+
DEFAULT_CONFIG_FILE: str = f".{xproject_name}_python"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass
|
|
26
|
+
class AuthorConfig(Settings):
|
|
27
|
+
name: str
|
|
28
|
+
email: str
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass
|
|
32
|
+
class ModuleConfig(Settings):
|
|
33
|
+
base: Optional[str] = None
|
|
34
|
+
package: Optional[List[str]] = None
|
|
35
|
+
omitted: List[str] = field(default_factory=list)
|
|
36
|
+
exclude: List[str] = field(default_factory=list)
|
|
37
|
+
include: Dict[str, str] = field(default_factory=dict)
|
|
38
|
+
scripts: Dict[str, str] = field(default_factory=dict)
|
|
39
|
+
templates: Dict[str, bool] = field(default_factory=dict)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@dataclass
|
|
43
|
+
class PackageConfig(Settings): # pylint: disable=too-many-instance-attributes
|
|
44
|
+
base: Optional[str] = None
|
|
45
|
+
version: Optional[str] = None
|
|
46
|
+
requires_python: Optional[str] = None
|
|
47
|
+
authors: List[str] = field(default_factory=list)
|
|
48
|
+
keywords: List[str] = field(default_factory=list)
|
|
49
|
+
requirements: List[str] = field(default_factory=list)
|
|
50
|
+
modules: Dict[str, ModuleConfig] = field(default_factory=dict)
|
|
51
|
+
max_complexity: int = 10
|
|
52
|
+
max_line_length: int = 127
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass
|
|
56
|
+
class ProjectConfig(ConfigTOML):
|
|
57
|
+
name: str = xproject_name
|
|
58
|
+
home: str = xproject_home
|
|
59
|
+
description: str = f"Automatically created by [{xproject_name}]({xproject_home})." # noqa:E501
|
|
60
|
+
authors: Dict[str, AuthorConfig] = field(default_factory=dict)
|
|
61
|
+
keywords: List[str] = field(default_factory=list)
|
|
62
|
+
packages: Dict[str, PackageConfig] = field(default_factory=dict)
|
|
63
|
+
version: str = "0.1.alpha.1"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@CommandArgument("update", help="Update Python project configuration")
|
|
67
|
+
def add_cmd_config_update(_arg: ArgParser):
|
|
68
|
+
pass
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@CommandExecutor(add_cmd_config_update)
|
|
72
|
+
def run_cmd_config_update(cmds: Command) -> int:
|
|
73
|
+
try:
|
|
74
|
+
ProjectConfig.loadf(cmds.args.file).dumpf(cmds.args.file)
|
|
75
|
+
cmds.stderr_green(f"Configuration file {cmds.args.file} updated")
|
|
76
|
+
return 0
|
|
77
|
+
except FileNotFoundError:
|
|
78
|
+
cmds.stderr_red(f"Configuration file {cmds.args.file} not found")
|
|
79
|
+
return ENOENT
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@CommandArgument("config", help="Manage Python project configuration")
|
|
83
|
+
def add_cmd_config(_arg: ArgParser):
|
|
84
|
+
_arg.add_argument("--file", dest="file", type=str, nargs=None,
|
|
85
|
+
metavar="FILE", default=DEFAULT_CONFIG_FILE,
|
|
86
|
+
help="Specify configuration file")
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@CommandExecutor(add_cmd_config, add_cmd_config_update)
|
|
90
|
+
def run_cmd_config(cmds: Command) -> int: # pylint: disable=unused-argument
|
|
91
|
+
return 0
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
95
|
+
cmds = Command()
|
|
96
|
+
cmds.version = version
|
|
97
|
+
return cmds.run(root=add_cmd_config, argv=argv, epilog=f"For more, please visit {xproject_home}.") # noqa:E501
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
if __name__ == "__main__":
|
|
101
|
+
project_name: str = "xproject"
|
|
102
|
+
project_home: str = "https://github.com/bondbox/xproject/"
|
|
103
|
+
project_desc: str = "Initialize project files"
|
|
104
|
+
|
|
105
|
+
ProjectConfig(
|
|
106
|
+
name=project_name,
|
|
107
|
+
home=project_home,
|
|
108
|
+
description=project_desc,
|
|
109
|
+
authors={
|
|
110
|
+
"zoumingzhe": AuthorConfig(
|
|
111
|
+
name="Mingzhe Zou",
|
|
112
|
+
email="zoumingzhe@outlook.com",
|
|
113
|
+
),
|
|
114
|
+
},
|
|
115
|
+
keywords=[
|
|
116
|
+
"project",
|
|
117
|
+
],
|
|
118
|
+
packages={
|
|
119
|
+
f"{project_name}-python": PackageConfig(
|
|
120
|
+
base=f"{project_name}-python",
|
|
121
|
+
version=None,
|
|
122
|
+
requires_python=">=3.8",
|
|
123
|
+
authors=[
|
|
124
|
+
"zoumingzhe",
|
|
125
|
+
],
|
|
126
|
+
keywords=[
|
|
127
|
+
],
|
|
128
|
+
requirements=[
|
|
129
|
+
"xkits-command",
|
|
130
|
+
"xkits-config-toml>=0.5",
|
|
131
|
+
"xkits-file>=0.9",
|
|
132
|
+
"prompt-toolkit",
|
|
133
|
+
],
|
|
134
|
+
modules={
|
|
135
|
+
f"{project_name}-python": ModuleConfig(
|
|
136
|
+
base=f"{project_name}_python",
|
|
137
|
+
package=None,
|
|
138
|
+
omitted=[
|
|
139
|
+
"attribute.py",
|
|
140
|
+
"unittest/*",
|
|
141
|
+
],
|
|
142
|
+
exclude=[
|
|
143
|
+
"unittest",
|
|
144
|
+
],
|
|
145
|
+
include={
|
|
146
|
+
"templates": "templates",
|
|
147
|
+
},
|
|
148
|
+
scripts={
|
|
149
|
+
f"{project_name}-python": "blueprint:main",
|
|
150
|
+
},
|
|
151
|
+
templates={
|
|
152
|
+
"__init__.py": False,
|
|
153
|
+
"attribute.py": True,
|
|
154
|
+
},
|
|
155
|
+
),
|
|
156
|
+
},
|
|
157
|
+
max_complexity=15,
|
|
158
|
+
max_line_length=127,
|
|
159
|
+
),
|
|
160
|
+
},
|
|
161
|
+
version="0.1.alpha.1",
|
|
162
|
+
).dumpf(DEFAULT_CONFIG_FILE)
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
|
|
3
|
+
from errno import ENOENT
|
|
4
|
+
from json import dumps
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from sys import version_info
|
|
7
|
+
from typing import Dict
|
|
8
|
+
from typing import Iterator
|
|
9
|
+
from typing import List
|
|
10
|
+
from typing import Optional
|
|
11
|
+
from typing import Sequence
|
|
12
|
+
from typing import Tuple
|
|
13
|
+
from typing import Union
|
|
14
|
+
|
|
15
|
+
from packaging.specifiers import SpecifierSet
|
|
16
|
+
from xkits_command.actuator import Command
|
|
17
|
+
from xkits_command.actuator import CommandArgument
|
|
18
|
+
from xkits_command.actuator import CommandExecutor
|
|
19
|
+
from xkits_command.parser import ArgParser
|
|
20
|
+
from xkits_file.template import TemplateManagerPath
|
|
21
|
+
from xkits_file.template import Variable
|
|
22
|
+
|
|
23
|
+
from xproject_python.attribute import __project_home__ as project_home
|
|
24
|
+
from xproject_python.attribute import __version__ as version
|
|
25
|
+
from xproject_python.configure import AuthorConfig
|
|
26
|
+
from xproject_python.configure import DEFAULT_CONFIG_FILE
|
|
27
|
+
from xproject_python.configure import ModuleConfig
|
|
28
|
+
from xproject_python.configure import PackageConfig
|
|
29
|
+
from xproject_python.configure import ProjectConfig
|
|
30
|
+
from xproject_python.utilities import CoverageRC
|
|
31
|
+
from xproject_python.utilities import Flake8
|
|
32
|
+
from xproject_python.utilities import PylintRC
|
|
33
|
+
from xproject_python.utilities import Pyproject
|
|
34
|
+
from xproject_python.utilities import Requirements
|
|
35
|
+
|
|
36
|
+
TEMPLATES: Path = Path(__file__).parent / "templates"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class Module:
|
|
40
|
+
TEMPLATES_MODULE: Path = TEMPLATES / "module"
|
|
41
|
+
ATTRIBUTE: str = "attribute.py"
|
|
42
|
+
DOT: str = "."
|
|
43
|
+
|
|
44
|
+
def __init__(self, name: str, config: PackageConfig, variable: Optional[Variable] = None): # noqa:E501
|
|
45
|
+
option: ModuleConfig = config.modules[name]
|
|
46
|
+
|
|
47
|
+
variables: Variable = variable.duplicate()if isinstance(variable, Variable) else Variable() # noqa:E501
|
|
48
|
+
variables.set_default("module_name", module_name := self.normalize(name)) # noqa:E501
|
|
49
|
+
|
|
50
|
+
self.__name: str = module_name
|
|
51
|
+
self.__option: ModuleConfig = option
|
|
52
|
+
self.__variable: Variable = variables
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def name(self) -> str:
|
|
56
|
+
return self.__name
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def base(self) -> str:
|
|
60
|
+
return self.option.base or self.DOT
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def option(self) -> ModuleConfig:
|
|
64
|
+
return self.__option
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def variable(self) -> Variable:
|
|
68
|
+
return self.__variable
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def include(self) -> Iterator[Tuple[str, str]]:
|
|
72
|
+
for name, path in self.option.include.items():
|
|
73
|
+
yield name, self.path_join(path)
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def exclude(self) -> Iterator[str]:
|
|
77
|
+
for path in self.option.exclude:
|
|
78
|
+
yield self.path_join(path)
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def package(self) -> Iterator[str]:
|
|
82
|
+
if self.option.package is not None:
|
|
83
|
+
for path in self.option.package:
|
|
84
|
+
yield self.path_join(path)
|
|
85
|
+
else:
|
|
86
|
+
yield self.base
|
|
87
|
+
|
|
88
|
+
@property
|
|
89
|
+
def omitted(self) -> Iterator[str]:
|
|
90
|
+
for path in self.option.omitted:
|
|
91
|
+
yield self.path_join(path)
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def scripts(self) -> Iterator[Tuple[str, str]]:
|
|
95
|
+
for name, entry in self.option.scripts.items():
|
|
96
|
+
point: str = (parts := entry.rsplit(":", maxsplit=1)).pop()
|
|
97
|
+
yield name, ":".join([self.dot_join(*parts), point])
|
|
98
|
+
|
|
99
|
+
def prepend(self, *parts: str) -> Tuple[str, ...]:
|
|
100
|
+
return (base, *parts) if (base := self.base) != self.DOT else parts # noqa:E501
|
|
101
|
+
|
|
102
|
+
def dot_join(self, *parts: str) -> str:
|
|
103
|
+
return self.DOT.join(self.prepend(*parts))
|
|
104
|
+
|
|
105
|
+
def path_join(self, *parts: str) -> str:
|
|
106
|
+
return Path(*self.prepend(*parts)).as_posix()
|
|
107
|
+
|
|
108
|
+
@classmethod
|
|
109
|
+
def normalize(cls, name: str) -> str:
|
|
110
|
+
return Requirements.normalize(requirement=name).name.replace("-", "_")
|
|
111
|
+
|
|
112
|
+
def dump(self, base: Union[str, Path], writable: bool = False) -> None:
|
|
113
|
+
root: Path = base if isinstance(base, Path) else Path(base)
|
|
114
|
+
|
|
115
|
+
files: List[str] = [
|
|
116
|
+
name for name, edit in self.option.templates.items()
|
|
117
|
+
if not (root / name).exists() or edit
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
templates: TemplateManagerPath = TemplateManagerPath(self.variable)
|
|
121
|
+
templates.load(base=self.TEMPLATES_MODULE, include=files)
|
|
122
|
+
templates.dump(base=root, writable=writable)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class Package: # pylint: disable=too-many-instance-attributes
|
|
126
|
+
TEMPLATES_PACKAGE: Path = TEMPLATES / "package"
|
|
127
|
+
FILES: List[str] = ["Makefile"]
|
|
128
|
+
|
|
129
|
+
def __init__(self, name: str, config: ProjectConfig, variable: Optional[Variable] = None): # pylint: disable=too-many-locals # noqa:E501
|
|
130
|
+
option: PackageConfig = config.packages[name]
|
|
131
|
+
|
|
132
|
+
variables: Variable = variable.duplicate() if isinstance(variable, Variable) else Variable() # noqa:E501
|
|
133
|
+
variables.set_default("package_name", package_name := Requirements.normalize(requirement=name).name) # noqa:E501
|
|
134
|
+
variables.set_default("package_version", package_version := option.version or config.version) # noqa:E501
|
|
135
|
+
|
|
136
|
+
authors: List[AuthorConfig] = [config.authors[index] for index in option.authors] # noqa:E501
|
|
137
|
+
variables.set_default("authors", dumps(authors, indent=4, default=lambda i: i.__dict__)) # noqa:E501
|
|
138
|
+
|
|
139
|
+
coverage: CoverageRC = CoverageRC.load(self.TEMPLATES_PACKAGE / CoverageRC.FILENAME) # noqa:E501
|
|
140
|
+
flake8: Flake8 = Flake8.load(self.TEMPLATES_PACKAGE / Flake8.FILENAME)
|
|
141
|
+
pylint: PylintRC = PylintRC.load(self.TEMPLATES_PACKAGE / PylintRC.FILENAME) # noqa:E501
|
|
142
|
+
|
|
143
|
+
python_version: str = option.requires_python or f"{version_info.major}.{version_info.minor}" # noqa:E501
|
|
144
|
+
pyproject: Pyproject = Pyproject.load(self.TEMPLATES_PACKAGE / Pyproject.FILENAME) # noqa:E501
|
|
145
|
+
pyproject.project["name"] = package_name
|
|
146
|
+
pyproject.project["description"] = config.description
|
|
147
|
+
pyproject.project["requires-python"] = python_version
|
|
148
|
+
pyproject.project_authors.extend(author.__dict__ for author in authors)
|
|
149
|
+
pyproject.project_keywords.extend(config.keywords)
|
|
150
|
+
pyproject.project_keywords.extend(option.keywords)
|
|
151
|
+
pyproject.project_urls["Homepage"] = config.home
|
|
152
|
+
|
|
153
|
+
requirements: Requirements = Requirements()
|
|
154
|
+
for requirement in option.requirements:
|
|
155
|
+
requirements.add(requirement)
|
|
156
|
+
|
|
157
|
+
self.__name: str = package_name
|
|
158
|
+
self.__version: str = package_version
|
|
159
|
+
self.__option: PackageConfig = option
|
|
160
|
+
self.__variable: Variable = variables
|
|
161
|
+
self.__coverage: CoverageRC = coverage
|
|
162
|
+
self.__flake8: Flake8 = flake8
|
|
163
|
+
self.__pylint: PylintRC = pylint
|
|
164
|
+
self.__pyproject: Pyproject = pyproject
|
|
165
|
+
self.__requirements: Requirements = requirements
|
|
166
|
+
|
|
167
|
+
def __iter__(self) -> Iterator[Module]:
|
|
168
|
+
for name in self.option.modules:
|
|
169
|
+
yield Module(name=name, config=self.option, variable=self.variable)
|
|
170
|
+
|
|
171
|
+
@property
|
|
172
|
+
def name(self) -> str:
|
|
173
|
+
return self.__name
|
|
174
|
+
|
|
175
|
+
@property
|
|
176
|
+
def version(self) -> str:
|
|
177
|
+
return self.__version
|
|
178
|
+
|
|
179
|
+
@property
|
|
180
|
+
def base(self) -> str:
|
|
181
|
+
return self.option.base or "."
|
|
182
|
+
|
|
183
|
+
@property
|
|
184
|
+
def option(self) -> PackageConfig:
|
|
185
|
+
return self.__option
|
|
186
|
+
|
|
187
|
+
@property
|
|
188
|
+
def variable(self) -> Variable:
|
|
189
|
+
return self.__variable
|
|
190
|
+
|
|
191
|
+
@property
|
|
192
|
+
def coverage(self) -> CoverageRC:
|
|
193
|
+
return self.__coverage
|
|
194
|
+
|
|
195
|
+
@property
|
|
196
|
+
def flake8(self) -> Flake8:
|
|
197
|
+
return self.__flake8
|
|
198
|
+
|
|
199
|
+
@property
|
|
200
|
+
def pylint(self) -> PylintRC:
|
|
201
|
+
return self.__pylint
|
|
202
|
+
|
|
203
|
+
@property
|
|
204
|
+
def pyproject(self) -> Pyproject:
|
|
205
|
+
return self.__pyproject
|
|
206
|
+
|
|
207
|
+
@property
|
|
208
|
+
def requirements(self) -> Requirements:
|
|
209
|
+
return self.__requirements
|
|
210
|
+
|
|
211
|
+
def dump(self, base: Union[str, Path], writable: bool = False) -> None: # pylint: disable=too-many-locals # noqa:E501
|
|
212
|
+
root: Path = base if isinstance(base, Path) else Path(base)
|
|
213
|
+
modules: List[Module] = list(iter(self))
|
|
214
|
+
|
|
215
|
+
attribute_modules: List[Module] = []
|
|
216
|
+
coverage_omit: str = ""
|
|
217
|
+
coverage_source: str = ""
|
|
218
|
+
flake8_exclude: str = ""
|
|
219
|
+
flake8_modules: List[str] = []
|
|
220
|
+
pylint_files: List[str] = []
|
|
221
|
+
|
|
222
|
+
for module in sorted(modules, key=lambda m: m.base):
|
|
223
|
+
for include_name, include_path in module.include:
|
|
224
|
+
self.pyproject.tool_hatch_build_targets_sdist_force_include[include_name] = include_path # noqa:E501
|
|
225
|
+
self.pyproject.tool_hatch_build_targets_wheel_force_include[include_name] = include_path # noqa:E501
|
|
226
|
+
|
|
227
|
+
for exclude in module.exclude:
|
|
228
|
+
self.pyproject.tool_hatch_build_targets_sdist_exclude.append(exclude) # noqa:E501
|
|
229
|
+
self.pyproject.tool_hatch_build_targets_wheel_exclude.append(exclude) # noqa:E501
|
|
230
|
+
flake8_exclude += f"\n{exclude}"
|
|
231
|
+
|
|
232
|
+
for package in module.package:
|
|
233
|
+
self.pyproject.tool_hatch_build_targets_sdist_packages.append(package) # noqa:E501
|
|
234
|
+
self.pyproject.tool_hatch_build_targets_wheel_packages.append(package) # noqa:E501
|
|
235
|
+
coverage_source += f"\n{package.removesuffix('.py')}"
|
|
236
|
+
flake8_modules.append(package)
|
|
237
|
+
|
|
238
|
+
pylint_files.append(f"{module.base}/*.py")
|
|
239
|
+
|
|
240
|
+
for omitted in module.omitted:
|
|
241
|
+
coverage_omit += f"\n{omitted}"
|
|
242
|
+
|
|
243
|
+
for script_name, script_entry in module.scripts:
|
|
244
|
+
self.pyproject.project_scripts[script_name] = script_entry
|
|
245
|
+
|
|
246
|
+
if Module.ATTRIBUTE in module.option.templates:
|
|
247
|
+
attribute_modules.append(module)
|
|
248
|
+
|
|
249
|
+
if (attribute_module_number := len(attribute_modules)) > 1:
|
|
250
|
+
raise ValueError(f"Package {self.name} has more than one attribute module: {', '.join(m.name for m in attribute_modules)}") # noqa:E501
|
|
251
|
+
if attribute_module_number < 1:
|
|
252
|
+
raise ValueError(f"Package {self.name} has no attribute module")
|
|
253
|
+
|
|
254
|
+
self.coverage.parser["run"]["omit"] = coverage_omit
|
|
255
|
+
self.coverage.parser["run"]["source"] = coverage_source
|
|
256
|
+
self.flake8.parser["flake8"]["exclude"] = flake8_exclude
|
|
257
|
+
self.flake8.parser["flake8"]["max-complexity"] = str(self.option.max_complexity) # noqa:E501
|
|
258
|
+
self.flake8.parser["flake8"]["max-line-length"] = str(self.option.max_line_length) # noqa:E501
|
|
259
|
+
|
|
260
|
+
variables: Variable = self.variable
|
|
261
|
+
variables.set_default("attribute_module", attribute_modules[0].dot_join(Path(Module.ATTRIBUTE).stem)) # noqa:E501
|
|
262
|
+
variables.set_default("flake8_modules", " ".join(flake8_modules))
|
|
263
|
+
variables.set_default("pylint_files", " ".join(pylint_files))
|
|
264
|
+
|
|
265
|
+
templates: TemplateManagerPath = TemplateManagerPath(variables)
|
|
266
|
+
templates.load(base=self.TEMPLATES_PACKAGE, include=self.FILES)
|
|
267
|
+
templates.dump(base=root, writable=writable)
|
|
268
|
+
|
|
269
|
+
self.requirements.dumpf(filepath=root / Requirements.FILENAME, writable=writable) # noqa:E501
|
|
270
|
+
self.pyproject.tool_hatch_metadata_hooks_requirements_txt_files.append(Requirements.FILENAME) # noqa:E501
|
|
271
|
+
self.pyproject.tool_hatch_version["path"] = attribute_modules[0].path_join(Module.ATTRIBUTE) # noqa:E501
|
|
272
|
+
self.pyproject.dump(filepath=root / Pyproject.FILENAME, writable=writable) # noqa:E501
|
|
273
|
+
|
|
274
|
+
self.coverage.dump(filepath=root / CoverageRC.FILENAME, writable=writable) # noqa:E501
|
|
275
|
+
self.flake8.dump(filepath=root / Flake8.FILENAME, writable=writable) # noqa:E501
|
|
276
|
+
self.pylint.dump(filepath=root / PylintRC.FILENAME, writable=writable) # noqa:E501
|
|
277
|
+
|
|
278
|
+
for module in modules:
|
|
279
|
+
module.dump(base=root / module.base, writable=writable)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
class Project:
|
|
283
|
+
TEMPLATES_PROJECT: Path = TEMPLATES / "project"
|
|
284
|
+
|
|
285
|
+
def __init__(self, config: ProjectConfig):
|
|
286
|
+
project_name: str = Requirements.normalize(requirement=config.name).name # noqa:E501
|
|
287
|
+
|
|
288
|
+
variables: Variable = Variable(
|
|
289
|
+
project_name=project_name,
|
|
290
|
+
project_home=config.home,
|
|
291
|
+
project_description=config.description,
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
self.__name: str = project_name
|
|
295
|
+
self.__option: ProjectConfig = config
|
|
296
|
+
self.__variable: Variable = variables
|
|
297
|
+
|
|
298
|
+
def __iter__(self) -> Iterator[Package]:
|
|
299
|
+
for name in self.option.packages:
|
|
300
|
+
yield Package(name=name, config=self.option, variable=self.variable) # noqa:E501
|
|
301
|
+
|
|
302
|
+
@property
|
|
303
|
+
def name(self) -> str:
|
|
304
|
+
return self.__name
|
|
305
|
+
|
|
306
|
+
@property
|
|
307
|
+
def option(self) -> ProjectConfig:
|
|
308
|
+
return self.__option
|
|
309
|
+
|
|
310
|
+
@property
|
|
311
|
+
def variable(self) -> Variable:
|
|
312
|
+
return self.__variable
|
|
313
|
+
|
|
314
|
+
def dump(self, base: Union[str, Path], writable: bool = False) -> None:
|
|
315
|
+
root: Path = base if isinstance(base, Path) else Path(base)
|
|
316
|
+
|
|
317
|
+
templates: TemplateManagerPath = TemplateManagerPath(self.variable)
|
|
318
|
+
templates.load(base=self.TEMPLATES_PROJECT, include=None)
|
|
319
|
+
templates.dump(base=root, writable=writable)
|
|
320
|
+
|
|
321
|
+
packages: Dict[str, Package] = {package.name: package for package in iter(self)} # noqa:E501
|
|
322
|
+
|
|
323
|
+
for package in packages.values():
|
|
324
|
+
dest: Path = root / package.base
|
|
325
|
+
|
|
326
|
+
for requirement in package.requirements:
|
|
327
|
+
if dependence := packages.get(requirement.name):
|
|
328
|
+
requirement.specifier = SpecifierSet(f">={dependence.version}") # noqa:E501
|
|
329
|
+
|
|
330
|
+
package.dump(base=dest, writable=writable)
|
|
331
|
+
|
|
332
|
+
if dest != root:
|
|
333
|
+
if not (readme_link := dest / "readme.md").exists():
|
|
334
|
+
readme_link.symlink_to("../readme.md")
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
@CommandArgument("generate", help="Create or update Python project files")
|
|
338
|
+
def add_cmd_generate(_arg: ArgParser):
|
|
339
|
+
_arg.add_opt_on("--change", help="allow changes to existing files")
|
|
340
|
+
_arg.add_opt("--config", dest="config", type=str, nargs=None,
|
|
341
|
+
metavar="FILE", default=DEFAULT_CONFIG_FILE,
|
|
342
|
+
help="Specify configuration file")
|
|
343
|
+
_arg.add_pos("root", type=str, nargs="?", metavar="PATH", default=".",
|
|
344
|
+
help="Project root directory")
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
@CommandExecutor(add_cmd_generate)
|
|
348
|
+
def run_cmd_generate(cmds: Command) -> int:
|
|
349
|
+
try:
|
|
350
|
+
config: ProjectConfig = ProjectConfig.loadf(cmds.args.config)
|
|
351
|
+
except FileNotFoundError:
|
|
352
|
+
cmds.stderr_red(f"Configuration file {cmds.args.config} not found")
|
|
353
|
+
return ENOENT
|
|
354
|
+
|
|
355
|
+
root: Path = Path(cmds.args.root).resolve()
|
|
356
|
+
cmds.stderr_yellow(f"Generate to root directory: {root}")
|
|
357
|
+
|
|
358
|
+
project: Project = Project(config=config)
|
|
359
|
+
project.dump(base=root, writable=cmds.args.change)
|
|
360
|
+
cmds.stderr_green(f"Project {project.name} generated")
|
|
361
|
+
return 0
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
365
|
+
cmds = Command()
|
|
366
|
+
cmds.version = version
|
|
367
|
+
return cmds.run(root=add_cmd_generate, argv=argv, epilog=f"For more, please visit {project_home}.") # noqa:E501
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
MAKEFLAGS += --always-make
|
|
2
|
+
|
|
3
|
+
VERSION ?= $(shell python3 -c "from {attribute_module} import __version__; print(__version__)")
|
|
4
|
+
|
|
5
|
+
all: build test
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
release: all
|
|
9
|
+
if [ -n "${{VERSION}}" ]; then \
|
|
10
|
+
git tag -a v${{VERSION}} -m "release v${{VERSION}}"; \
|
|
11
|
+
git push origin --tags; \
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
version:
|
|
15
|
+
@echo ${{VERSION}}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
upload:
|
|
19
|
+
python3 -m pip install --upgrade xpip-upload
|
|
20
|
+
xpip-upload --config-file .pypirc dist/*
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
build-prepare:
|
|
24
|
+
python3 -m pip install --upgrade xpip-build
|
|
25
|
+
build-clean:
|
|
26
|
+
find . -type d -name "__pycache__" -exec rm -rf {{}} +
|
|
27
|
+
rm -rf build dist *.egg-info
|
|
28
|
+
build: build-prepare build-clean
|
|
29
|
+
python3 -m build --sdist --wheel
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
install-requirements:
|
|
33
|
+
python3 -m pip install --upgrade -r requirements.txt
|
|
34
|
+
install: install-requirements
|
|
35
|
+
python3 -m pip install --force-reinstall --no-deps dist/*.whl
|
|
36
|
+
uninstall:
|
|
37
|
+
python3 -m pip uninstall -y {package_name}
|
|
38
|
+
reinstall: uninstall install
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
test-prepare: install-requirements
|
|
42
|
+
python3 -m pip install --upgrade mock flake8 pylint pytest pytest-cov
|
|
43
|
+
flake8:
|
|
44
|
+
flake8 {flake8_modules}
|
|
45
|
+
pylint:
|
|
46
|
+
pylint $(shell git ls-files {pylint_files})
|
|
47
|
+
pytest:
|
|
48
|
+
pytest --cov --cov-config=.coveragerc --cov-report=term-missing --cov-report=xml --cov-report=html
|
|
49
|
+
pytest-clean:
|
|
50
|
+
rm -rf .pytest_cache
|
|
51
|
+
test: test-prepare flake8 pylint pytest
|
|
52
|
+
test-clean: pytest-clean
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
clean-cover:
|
|
56
|
+
rm -rf cover .coverage coverage.xml htmlcov
|
|
57
|
+
clean-tox:
|
|
58
|
+
rm -rf .stestr .tox
|
|
59
|
+
clean: build-clean test-clean clean-cover clean-tox
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "hatchling.build"
|
|
3
|
+
requires = [
|
|
4
|
+
"hatch-requirements-txt",
|
|
5
|
+
"hatchling",
|
|
6
|
+
"xpip-build>=1.4",
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
[project]
|
|
10
|
+
authors = []
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Programming Language :: Python",
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
]
|
|
15
|
+
description = ""
|
|
16
|
+
dynamic = [
|
|
17
|
+
"dependencies",
|
|
18
|
+
"version",
|
|
19
|
+
]
|
|
20
|
+
keywords = []
|
|
21
|
+
license-files = [ "LICENSE",]
|
|
22
|
+
name = ""
|
|
23
|
+
requires-python = ""
|
|
24
|
+
|
|
25
|
+
[project.readme]
|
|
26
|
+
content-type = "text/markdown"
|
|
27
|
+
file = "readme.md"
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
|
|
33
|
+
[tool.hatch.version]
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.sdist]
|
|
36
|
+
exclude = []
|
|
37
|
+
packages = []
|
|
38
|
+
|
|
39
|
+
[tool.hatch.build.targets.wheel]
|
|
40
|
+
exclude = []
|
|
41
|
+
packages = []
|
|
42
|
+
|
|
43
|
+
[tool.hatch.metadata.hooks.requirements_txt]
|
|
44
|
+
files = []
|
|
45
|
+
|
|
46
|
+
[tool.hatch.build.targets.sdist.force-include]
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.wheel.force-include]
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# coding:utf-8
|
|
2
|
+
|
|
3
|
+
from configparser import ConfigParser
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any
|
|
6
|
+
from typing import Dict
|
|
7
|
+
from typing import Iterator
|
|
8
|
+
from typing import List
|
|
9
|
+
from typing import Optional
|
|
10
|
+
from typing import Type
|
|
11
|
+
from typing import TypeVar
|
|
12
|
+
from typing import Union
|
|
13
|
+
|
|
14
|
+
from packaging.requirements import Requirement
|
|
15
|
+
from toml import dump
|
|
16
|
+
from toml import load
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
CFGT = TypeVar("CFGT", bound="Configuration")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Configuration:
|
|
23
|
+
|
|
24
|
+
def __init__(self, parser: Optional[ConfigParser] = None):
|
|
25
|
+
self.__parser: ConfigParser = parser or ConfigParser()
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def parser(self) -> ConfigParser:
|
|
29
|
+
return self.__parser
|
|
30
|
+
|
|
31
|
+
def dump(self, filepath: Union[str, Path], writable: bool = False):
|
|
32
|
+
if isinstance(filepath, str):
|
|
33
|
+
filepath = Path(filepath) # pragma: no cover
|
|
34
|
+
|
|
35
|
+
if not filepath.exists() or writable:
|
|
36
|
+
with filepath.open("w", encoding="utf-8") as whdl:
|
|
37
|
+
self.parser.write(whdl)
|
|
38
|
+
|
|
39
|
+
@classmethod
|
|
40
|
+
def load(cls: Type[CFGT], filepath: Union[str, Path]) -> CFGT:
|
|
41
|
+
(parser := ConfigParser()).read(filepath)
|
|
42
|
+
return cls(parser=parser)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class CoverageRC(Configuration):
|
|
46
|
+
FILENAME: str = ".coveragerc"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class Flake8(Configuration):
|
|
50
|
+
FILENAME: str = ".flake8"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class PylintRC(Configuration):
|
|
54
|
+
FILENAME: str = ".pylintrc"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class Pyproject: # pylint: disable=too-many-public-methods
|
|
58
|
+
FILENAME: str = "pyproject.toml"
|
|
59
|
+
|
|
60
|
+
def __init__(self, coder: Dict[str, Any]):
|
|
61
|
+
self.__coder: Dict[str, Any] = coder
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def coder(self) -> Dict[str, Any]:
|
|
65
|
+
return self.__coder
|
|
66
|
+
|
|
67
|
+
@property
|
|
68
|
+
def project(self) -> Dict[str, Any]:
|
|
69
|
+
return self.coder["project"]
|
|
70
|
+
|
|
71
|
+
@property
|
|
72
|
+
def project_authors(self) -> List[Dict[str, str]]:
|
|
73
|
+
return self.project["authors"]
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def project_keywords(self) -> List[str]:
|
|
77
|
+
return self.project["keywords"]
|
|
78
|
+
|
|
79
|
+
@property
|
|
80
|
+
def project_scripts(self) -> Dict[str, Any]:
|
|
81
|
+
return self.project["scripts"]
|
|
82
|
+
|
|
83
|
+
@property
|
|
84
|
+
def project_urls(self) -> Dict[str, str]:
|
|
85
|
+
return self.project["urls"]
|
|
86
|
+
|
|
87
|
+
@property
|
|
88
|
+
def tool(self) -> Dict[str, Any]:
|
|
89
|
+
return self.coder["tool"]
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def tool_hatch(self) -> Dict[str, Any]:
|
|
93
|
+
return self.tool["hatch"]
|
|
94
|
+
|
|
95
|
+
@property
|
|
96
|
+
def tool_hatch_build(self) -> Dict[str, Any]:
|
|
97
|
+
return self.tool_hatch["build"]
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def tool_hatch_build_targets(self) -> Dict[str, Any]:
|
|
101
|
+
return self.tool_hatch_build["targets"]
|
|
102
|
+
|
|
103
|
+
@property
|
|
104
|
+
def tool_hatch_build_targets_sdist(self) -> Dict[str, Any]:
|
|
105
|
+
return self.tool_hatch_build_targets["sdist"]
|
|
106
|
+
|
|
107
|
+
@property
|
|
108
|
+
def tool_hatch_build_targets_sdist_force_include(self) -> Dict[str, Any]:
|
|
109
|
+
return self.tool_hatch_build_targets_sdist["force-include"]
|
|
110
|
+
|
|
111
|
+
@property
|
|
112
|
+
def tool_hatch_build_targets_sdist_exclude(self) -> List[str]:
|
|
113
|
+
return self.tool_hatch_build_targets_sdist["exclude"]
|
|
114
|
+
|
|
115
|
+
@property
|
|
116
|
+
def tool_hatch_build_targets_sdist_packages(self) -> List[str]:
|
|
117
|
+
return self.tool_hatch_build_targets_sdist["packages"]
|
|
118
|
+
|
|
119
|
+
@property
|
|
120
|
+
def tool_hatch_build_targets_wheel(self) -> Dict[str, Any]:
|
|
121
|
+
return self.tool_hatch_build_targets["wheel"]
|
|
122
|
+
|
|
123
|
+
@property
|
|
124
|
+
def tool_hatch_build_targets_wheel_force_include(self) -> Dict[str, Any]:
|
|
125
|
+
return self.tool_hatch_build_targets_wheel["force-include"]
|
|
126
|
+
|
|
127
|
+
@property
|
|
128
|
+
def tool_hatch_build_targets_wheel_exclude(self) -> List[str]:
|
|
129
|
+
return self.tool_hatch_build_targets_wheel["exclude"]
|
|
130
|
+
|
|
131
|
+
@property
|
|
132
|
+
def tool_hatch_build_targets_wheel_packages(self) -> List[str]:
|
|
133
|
+
return self.tool_hatch_build_targets_wheel["packages"]
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
def tool_hatch_metadata(self) -> Dict[str, Any]:
|
|
137
|
+
return self.tool_hatch["metadata"]
|
|
138
|
+
|
|
139
|
+
@property
|
|
140
|
+
def tool_hatch_metadata_hooks(self) -> Dict[str, Any]:
|
|
141
|
+
return self.tool_hatch_metadata["hooks"]
|
|
142
|
+
|
|
143
|
+
@property
|
|
144
|
+
def tool_hatch_metadata_hooks_requirements_txt(self) -> Dict[str, Any]:
|
|
145
|
+
return self.tool_hatch_metadata_hooks["requirements_txt"]
|
|
146
|
+
|
|
147
|
+
@property
|
|
148
|
+
def tool_hatch_metadata_hooks_requirements_txt_files(self) -> List[str]:
|
|
149
|
+
return self.tool_hatch_metadata_hooks_requirements_txt["files"]
|
|
150
|
+
|
|
151
|
+
@property
|
|
152
|
+
def tool_hatch_version(self) -> List[str]:
|
|
153
|
+
return self.tool_hatch["version"]
|
|
154
|
+
|
|
155
|
+
def dump(self, filepath: Union[str, Path], writable: bool = False):
|
|
156
|
+
if isinstance(filepath, str):
|
|
157
|
+
filepath = Path(filepath) # pragma: no cover
|
|
158
|
+
|
|
159
|
+
if not filepath.exists() or writable:
|
|
160
|
+
with filepath.open("w", encoding="utf-8") as whdl:
|
|
161
|
+
dump(self.coder, whdl)
|
|
162
|
+
|
|
163
|
+
@classmethod
|
|
164
|
+
def load(cls, filepath: Union[str, Path]) -> "Pyproject":
|
|
165
|
+
if isinstance(filepath, str):
|
|
166
|
+
filepath = Path(filepath) # pragma: no cover
|
|
167
|
+
|
|
168
|
+
with filepath.open("r", encoding="utf-8") as rhdl:
|
|
169
|
+
return cls(coder=load(rhdl))
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class Requirements:
|
|
173
|
+
"""Requirements
|
|
174
|
+
|
|
175
|
+
Reference:
|
|
176
|
+
- [PEP 508](https://peps.python.org/pep-0508/)
|
|
177
|
+
Dependency specification for Python Software Packages
|
|
178
|
+
"""
|
|
179
|
+
FILENAME: str = "requirements.txt"
|
|
180
|
+
|
|
181
|
+
def __init__(self, *requirements: Union[str, Requirement]):
|
|
182
|
+
self.__requirements: List[Requirement] = [self.normalize(requirement) for requirement in requirements] # noqa:E501
|
|
183
|
+
|
|
184
|
+
def __iter__(self) -> Iterator[Requirement]:
|
|
185
|
+
yield from self.__requirements
|
|
186
|
+
|
|
187
|
+
def add(self, requirement: Union[str, Requirement]) -> None:
|
|
188
|
+
self.__requirements.append(self.normalize(requirement))
|
|
189
|
+
|
|
190
|
+
def dumps(self) -> str:
|
|
191
|
+
return "\n".join(str(requirement) for requirement in self.__requirements) # noqa:E501
|
|
192
|
+
|
|
193
|
+
def dumpf(self, filepath: Union[str, Path], writable: bool = False) -> None: # noqa:E501
|
|
194
|
+
if isinstance(filepath, str):
|
|
195
|
+
filepath = Path(filepath) # pragma: no cover
|
|
196
|
+
|
|
197
|
+
if not filepath.exists() or writable:
|
|
198
|
+
with filepath.open("w", encoding="utf-8") as whdl:
|
|
199
|
+
whdl.write(self.dumps())
|
|
200
|
+
whdl.write("\n")
|
|
201
|
+
|
|
202
|
+
@classmethod
|
|
203
|
+
def normalize(cls, requirement: Union[str, Requirement]) -> Requirement: # noqa:E501
|
|
204
|
+
"""Normalized Names with PEP 503
|
|
205
|
+
|
|
206
|
+
Reference:
|
|
207
|
+
- https://peps.python.org/pep-0426/#name
|
|
208
|
+
- https://peps.python.org/pep-0503/#normalized-names
|
|
209
|
+
"""
|
|
210
|
+
from re import sub # pylint: disable=import-outside-toplevel
|
|
211
|
+
|
|
212
|
+
if not isinstance(requirement, Requirement):
|
|
213
|
+
requirement = Requirement(requirement)
|
|
214
|
+
|
|
215
|
+
requirement.name = sub(r"[-_.]+", "-", requirement.name).lower()
|
|
216
|
+
return requirement
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xproject-python
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Initialize project files
|
|
5
|
+
Project-URL: Homepage, https://github.com/bondbox/xproject/
|
|
6
|
+
Author-email: Mingzhe Zou <zoumingzhe@outlook.com>
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: project
|
|
9
|
+
Classifier: Programming Language :: Python
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Requires-Dist: xkits-command>=0.6
|
|
13
|
+
Requires-Dist: xkits-config-toml>=0.7
|
|
14
|
+
Requires-Dist: xkits-file>=0.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# xproject
|
|
18
|
+
|
|
19
|
+
> Initialize project files
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
xproject_python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
xproject_python/attribute.py,sha256=oRA_N6VH3likW_L9EmrW6NRMHIq91csfhOpJRXWpQm0,186
|
|
3
|
+
xproject_python/configure.py,sha256=5MB5F-uiP0iDpvV6nmYIBWQgdu_h8tOt6gGPHOwGQCs,5376
|
|
4
|
+
xproject_python/projector.py,sha256=SmOjjzvjUqIQZp6K9O7gQQkFzoU864PlPD-40oraZis,14643
|
|
5
|
+
xproject_python/utilities.py,sha256=AHCJIOqDQ5R8eimhDs-zXvzjrTRVs_YoCK37UUrjViQ,6649
|
|
6
|
+
xproject_python/templates/module/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
xproject_python/templates/module/attribute.py,sha256=7dhF1l7pV9x5uQVZUE4-yxGRa5xbktybg3NEp1W75s8,181
|
|
8
|
+
xproject_python/templates/package/.coveragerc,sha256=IywRebZYYu_hhx84NMb61-PwbODbl_sQAzIsbMQAbso,173
|
|
9
|
+
xproject_python/templates/package/.flake8,sha256=88RBDY1kVe7Zp49xNdRnZ9zO-UlTq8-_oj91r92BAvs,138
|
|
10
|
+
xproject_python/templates/package/.pylintrc,sha256=2g6-1ka_eOEiEIyo71JetDtijVv1tOiFaiCBgeu3CuY,197
|
|
11
|
+
xproject_python/templates/package/Makefile,sha256=vwdOrGKPRkGwux9lep73Y-R4-V7KbPHuJfXUT6CW_xs,1437
|
|
12
|
+
xproject_python/templates/package/hatch_build.py,sha256=Y1JZyIq_Kel6O2bLUgNLhHYGzp55AuvkLEa60pfjYI0,228
|
|
13
|
+
xproject_python/templates/package/pyproject.toml,sha256=sE0KwjM6eCvGfaaBtQufW00wlDhoPY5ThZ4qfbzoQM8,798
|
|
14
|
+
xproject_python/templates/project/readme.md,sha256=WM6Vxsbw4V8OL-HcYIsyVf9Q-6m_YEt0n5LHgXyJRPM,42
|
|
15
|
+
xproject_python-0.1.dist-info/METADATA,sha256=mFfR429wpyhydQBKaW9H1sRNz0REnqWW-rhRJEOPuFM,540
|
|
16
|
+
xproject_python-0.1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
17
|
+
xproject_python-0.1.dist-info/entry_points.txt,sha256=Xo8CIP0Za9cxneK7BvtZ3fdZkpNlEikctcUscCVdQ-0,132
|
|
18
|
+
xproject_python-0.1.dist-info/licenses/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
|
|
19
|
+
xproject_python-0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 2, June 1991
|
|
3
|
+
|
|
4
|
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
|
5
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
6
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
7
|
+
of this license document, but changing it is not allowed.
|
|
8
|
+
|
|
9
|
+
Preamble
|
|
10
|
+
|
|
11
|
+
The licenses for most software are designed to take away your
|
|
12
|
+
freedom to share and change it. By contrast, the GNU General Public
|
|
13
|
+
License is intended to guarantee your freedom to share and change free
|
|
14
|
+
software--to make sure the software is free for all its users. This
|
|
15
|
+
General Public License applies to most of the Free Software
|
|
16
|
+
Foundation's software and to any other program whose authors commit to
|
|
17
|
+
using it. (Some other Free Software Foundation software is covered by
|
|
18
|
+
the GNU Lesser General Public License instead.) You can apply it to
|
|
19
|
+
your programs, too.
|
|
20
|
+
|
|
21
|
+
When we speak of free software, we are referring to freedom, not
|
|
22
|
+
price. Our General Public Licenses are designed to make sure that you
|
|
23
|
+
have the freedom to distribute copies of free software (and charge for
|
|
24
|
+
this service if you wish), that you receive source code or can get it
|
|
25
|
+
if you want it, that you can change the software or use pieces of it
|
|
26
|
+
in new free programs; and that you know you can do these things.
|
|
27
|
+
|
|
28
|
+
To protect your rights, we need to make restrictions that forbid
|
|
29
|
+
anyone to deny you these rights or to ask you to surrender the rights.
|
|
30
|
+
These restrictions translate to certain responsibilities for you if you
|
|
31
|
+
distribute copies of the software, or if you modify it.
|
|
32
|
+
|
|
33
|
+
For example, if you distribute copies of such a program, whether
|
|
34
|
+
gratis or for a fee, you must give the recipients all the rights that
|
|
35
|
+
you have. You must make sure that they, too, receive or can get the
|
|
36
|
+
source code. And you must show them these terms so they know their
|
|
37
|
+
rights.
|
|
38
|
+
|
|
39
|
+
We protect your rights with two steps: (1) copyright the software, and
|
|
40
|
+
(2) offer you this license which gives you legal permission to copy,
|
|
41
|
+
distribute and/or modify the software.
|
|
42
|
+
|
|
43
|
+
Also, for each author's protection and ours, we want to make certain
|
|
44
|
+
that everyone understands that there is no warranty for this free
|
|
45
|
+
software. If the software is modified by someone else and passed on, we
|
|
46
|
+
want its recipients to know that what they have is not the original, so
|
|
47
|
+
that any problems introduced by others will not reflect on the original
|
|
48
|
+
authors' reputations.
|
|
49
|
+
|
|
50
|
+
Finally, any free program is threatened constantly by software
|
|
51
|
+
patents. We wish to avoid the danger that redistributors of a free
|
|
52
|
+
program will individually obtain patent licenses, in effect making the
|
|
53
|
+
program proprietary. To prevent this, we have made it clear that any
|
|
54
|
+
patent must be licensed for everyone's free use or not licensed at all.
|
|
55
|
+
|
|
56
|
+
The precise terms and conditions for copying, distribution and
|
|
57
|
+
modification follow.
|
|
58
|
+
|
|
59
|
+
GNU GENERAL PUBLIC LICENSE
|
|
60
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
61
|
+
|
|
62
|
+
0. This License applies to any program or other work which contains
|
|
63
|
+
a notice placed by the copyright holder saying it may be distributed
|
|
64
|
+
under the terms of this General Public License. The "Program", below,
|
|
65
|
+
refers to any such program or work, and a "work based on the Program"
|
|
66
|
+
means either the Program or any derivative work under copyright law:
|
|
67
|
+
that is to say, a work containing the Program or a portion of it,
|
|
68
|
+
either verbatim or with modifications and/or translated into another
|
|
69
|
+
language. (Hereinafter, translation is included without limitation in
|
|
70
|
+
the term "modification".) Each licensee is addressed as "you".
|
|
71
|
+
|
|
72
|
+
Activities other than copying, distribution and modification are not
|
|
73
|
+
covered by this License; they are outside its scope. The act of
|
|
74
|
+
running the Program is not restricted, and the output from the Program
|
|
75
|
+
is covered only if its contents constitute a work based on the
|
|
76
|
+
Program (independent of having been made by running the Program).
|
|
77
|
+
Whether that is true depends on what the Program does.
|
|
78
|
+
|
|
79
|
+
1. You may copy and distribute verbatim copies of the Program's
|
|
80
|
+
source code as you receive it, in any medium, provided that you
|
|
81
|
+
conspicuously and appropriately publish on each copy an appropriate
|
|
82
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
|
83
|
+
notices that refer to this License and to the absence of any warranty;
|
|
84
|
+
and give any other recipients of the Program a copy of this License
|
|
85
|
+
along with the Program.
|
|
86
|
+
|
|
87
|
+
You may charge a fee for the physical act of transferring a copy, and
|
|
88
|
+
you may at your option offer warranty protection in exchange for a fee.
|
|
89
|
+
|
|
90
|
+
2. You may modify your copy or copies of the Program or any portion
|
|
91
|
+
of it, thus forming a work based on the Program, and copy and
|
|
92
|
+
distribute such modifications or work under the terms of Section 1
|
|
93
|
+
above, provided that you also meet all of these conditions:
|
|
94
|
+
|
|
95
|
+
a) You must cause the modified files to carry prominent notices
|
|
96
|
+
stating that you changed the files and the date of any change.
|
|
97
|
+
|
|
98
|
+
b) You must cause any work that you distribute or publish, that in
|
|
99
|
+
whole or in part contains or is derived from the Program or any
|
|
100
|
+
part thereof, to be licensed as a whole at no charge to all third
|
|
101
|
+
parties under the terms of this License.
|
|
102
|
+
|
|
103
|
+
c) If the modified program normally reads commands interactively
|
|
104
|
+
when run, you must cause it, when started running for such
|
|
105
|
+
interactive use in the most ordinary way, to print or display an
|
|
106
|
+
announcement including an appropriate copyright notice and a
|
|
107
|
+
notice that there is no warranty (or else, saying that you provide
|
|
108
|
+
a warranty) and that users may redistribute the program under
|
|
109
|
+
these conditions, and telling the user how to view a copy of this
|
|
110
|
+
License. (Exception: if the Program itself is interactive but
|
|
111
|
+
does not normally print such an announcement, your work based on
|
|
112
|
+
the Program is not required to print an announcement.)
|
|
113
|
+
|
|
114
|
+
These requirements apply to the modified work as a whole. If
|
|
115
|
+
identifiable sections of that work are not derived from the Program,
|
|
116
|
+
and can be reasonably considered independent and separate works in
|
|
117
|
+
themselves, then this License, and its terms, do not apply to those
|
|
118
|
+
sections when you distribute them as separate works. But when you
|
|
119
|
+
distribute the same sections as part of a whole which is a work based
|
|
120
|
+
on the Program, the distribution of the whole must be on the terms of
|
|
121
|
+
this License, whose permissions for other licensees extend to the
|
|
122
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
|
123
|
+
|
|
124
|
+
Thus, it is not the intent of this section to claim rights or contest
|
|
125
|
+
your rights to work written entirely by you; rather, the intent is to
|
|
126
|
+
exercise the right to control the distribution of derivative or
|
|
127
|
+
collective works based on the Program.
|
|
128
|
+
|
|
129
|
+
In addition, mere aggregation of another work not based on the Program
|
|
130
|
+
with the Program (or with a work based on the Program) on a volume of
|
|
131
|
+
a storage or distribution medium does not bring the other work under
|
|
132
|
+
the scope of this License.
|
|
133
|
+
|
|
134
|
+
3. You may copy and distribute the Program (or a work based on it,
|
|
135
|
+
under Section 2) in object code or executable form under the terms of
|
|
136
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
|
137
|
+
|
|
138
|
+
a) Accompany it with the complete corresponding machine-readable
|
|
139
|
+
source code, which must be distributed under the terms of Sections
|
|
140
|
+
1 and 2 above on a medium customarily used for software interchange; or,
|
|
141
|
+
|
|
142
|
+
b) Accompany it with a written offer, valid for at least three
|
|
143
|
+
years, to give any third party, for a charge no more than your
|
|
144
|
+
cost of physically performing source distribution, a complete
|
|
145
|
+
machine-readable copy of the corresponding source code, to be
|
|
146
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
|
147
|
+
customarily used for software interchange; or,
|
|
148
|
+
|
|
149
|
+
c) Accompany it with the information you received as to the offer
|
|
150
|
+
to distribute corresponding source code. (This alternative is
|
|
151
|
+
allowed only for noncommercial distribution and only if you
|
|
152
|
+
received the program in object code or executable form with such
|
|
153
|
+
an offer, in accord with Subsection b above.)
|
|
154
|
+
|
|
155
|
+
The source code for a work means the preferred form of the work for
|
|
156
|
+
making modifications to it. For an executable work, complete source
|
|
157
|
+
code means all the source code for all modules it contains, plus any
|
|
158
|
+
associated interface definition files, plus the scripts used to
|
|
159
|
+
control compilation and installation of the executable. However, as a
|
|
160
|
+
special exception, the source code distributed need not include
|
|
161
|
+
anything that is normally distributed (in either source or binary
|
|
162
|
+
form) with the major components (compiler, kernel, and so on) of the
|
|
163
|
+
operating system on which the executable runs, unless that component
|
|
164
|
+
itself accompanies the executable.
|
|
165
|
+
|
|
166
|
+
If distribution of executable or object code is made by offering
|
|
167
|
+
access to copy from a designated place, then offering equivalent
|
|
168
|
+
access to copy the source code from the same place counts as
|
|
169
|
+
distribution of the source code, even though third parties are not
|
|
170
|
+
compelled to copy the source along with the object code.
|
|
171
|
+
|
|
172
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
|
173
|
+
except as expressly provided under this License. Any attempt
|
|
174
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
|
175
|
+
void, and will automatically terminate your rights under this License.
|
|
176
|
+
However, parties who have received copies, or rights, from you under
|
|
177
|
+
this License will not have their licenses terminated so long as such
|
|
178
|
+
parties remain in full compliance.
|
|
179
|
+
|
|
180
|
+
5. You are not required to accept this License, since you have not
|
|
181
|
+
signed it. However, nothing else grants you permission to modify or
|
|
182
|
+
distribute the Program or its derivative works. These actions are
|
|
183
|
+
prohibited by law if you do not accept this License. Therefore, by
|
|
184
|
+
modifying or distributing the Program (or any work based on the
|
|
185
|
+
Program), you indicate your acceptance of this License to do so, and
|
|
186
|
+
all its terms and conditions for copying, distributing or modifying
|
|
187
|
+
the Program or works based on it.
|
|
188
|
+
|
|
189
|
+
6. Each time you redistribute the Program (or any work based on the
|
|
190
|
+
Program), the recipient automatically receives a license from the
|
|
191
|
+
original licensor to copy, distribute or modify the Program subject to
|
|
192
|
+
these terms and conditions. You may not impose any further
|
|
193
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
|
194
|
+
You are not responsible for enforcing compliance by third parties to
|
|
195
|
+
this License.
|
|
196
|
+
|
|
197
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
|
198
|
+
infringement or for any other reason (not limited to patent issues),
|
|
199
|
+
conditions are imposed on you (whether by court order, agreement or
|
|
200
|
+
otherwise) that contradict the conditions of this License, they do not
|
|
201
|
+
excuse you from the conditions of this License. If you cannot
|
|
202
|
+
distribute so as to satisfy simultaneously your obligations under this
|
|
203
|
+
License and any other pertinent obligations, then as a consequence you
|
|
204
|
+
may not distribute the Program at all. For example, if a patent
|
|
205
|
+
license would not permit royalty-free redistribution of the Program by
|
|
206
|
+
all those who receive copies directly or indirectly through you, then
|
|
207
|
+
the only way you could satisfy both it and this License would be to
|
|
208
|
+
refrain entirely from distribution of the Program.
|
|
209
|
+
|
|
210
|
+
If any portion of this section is held invalid or unenforceable under
|
|
211
|
+
any particular circumstance, the balance of the section is intended to
|
|
212
|
+
apply and the section as a whole is intended to apply in other
|
|
213
|
+
circumstances.
|
|
214
|
+
|
|
215
|
+
It is not the purpose of this section to induce you to infringe any
|
|
216
|
+
patents or other property right claims or to contest validity of any
|
|
217
|
+
such claims; this section has the sole purpose of protecting the
|
|
218
|
+
integrity of the free software distribution system, which is
|
|
219
|
+
implemented by public license practices. Many people have made
|
|
220
|
+
generous contributions to the wide range of software distributed
|
|
221
|
+
through that system in reliance on consistent application of that
|
|
222
|
+
system; it is up to the author/donor to decide if he or she is willing
|
|
223
|
+
to distribute software through any other system and a licensee cannot
|
|
224
|
+
impose that choice.
|
|
225
|
+
|
|
226
|
+
This section is intended to make thoroughly clear what is believed to
|
|
227
|
+
be a consequence of the rest of this License.
|
|
228
|
+
|
|
229
|
+
8. If the distribution and/or use of the Program is restricted in
|
|
230
|
+
certain countries either by patents or by copyrighted interfaces, the
|
|
231
|
+
original copyright holder who places the Program under this License
|
|
232
|
+
may add an explicit geographical distribution limitation excluding
|
|
233
|
+
those countries, so that distribution is permitted only in or among
|
|
234
|
+
countries not thus excluded. In such case, this License incorporates
|
|
235
|
+
the limitation as if written in the body of this License.
|
|
236
|
+
|
|
237
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
|
238
|
+
of the General Public License from time to time. Such new versions will
|
|
239
|
+
be similar in spirit to the present version, but may differ in detail to
|
|
240
|
+
address new problems or concerns.
|
|
241
|
+
|
|
242
|
+
Each version is given a distinguishing version number. If the Program
|
|
243
|
+
specifies a version number of this License which applies to it and "any
|
|
244
|
+
later version", you have the option of following the terms and conditions
|
|
245
|
+
either of that version or of any later version published by the Free
|
|
246
|
+
Software Foundation. If the Program does not specify a version number of
|
|
247
|
+
this License, you may choose any version ever published by the Free Software
|
|
248
|
+
Foundation.
|
|
249
|
+
|
|
250
|
+
10. If you wish to incorporate parts of the Program into other free
|
|
251
|
+
programs whose distribution conditions are different, write to the author
|
|
252
|
+
to ask for permission. For software which is copyrighted by the Free
|
|
253
|
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
|
254
|
+
make exceptions for this. Our decision will be guided by the two goals
|
|
255
|
+
of preserving the free status of all derivatives of our free software and
|
|
256
|
+
of promoting the sharing and reuse of software generally.
|
|
257
|
+
|
|
258
|
+
NO WARRANTY
|
|
259
|
+
|
|
260
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
|
261
|
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
|
262
|
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
|
263
|
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
|
264
|
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
265
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
|
266
|
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
|
267
|
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
|
268
|
+
REPAIR OR CORRECTION.
|
|
269
|
+
|
|
270
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
271
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
|
272
|
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
|
273
|
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
|
274
|
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
|
275
|
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
|
276
|
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|
277
|
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|
278
|
+
POSSIBILITY OF SUCH DAMAGES.
|
|
279
|
+
|
|
280
|
+
END OF TERMS AND CONDITIONS
|
|
281
|
+
|
|
282
|
+
How to Apply These Terms to Your New Programs
|
|
283
|
+
|
|
284
|
+
If you develop a new program, and you want it to be of the greatest
|
|
285
|
+
possible use to the public, the best way to achieve this is to make it
|
|
286
|
+
free software which everyone can redistribute and change under these terms.
|
|
287
|
+
|
|
288
|
+
To do so, attach the following notices to the program. It is safest
|
|
289
|
+
to attach them to the start of each source file to most effectively
|
|
290
|
+
convey the exclusion of warranty; and each file should have at least
|
|
291
|
+
the "copyright" line and a pointer to where the full notice is found.
|
|
292
|
+
|
|
293
|
+
<one line to give the program's name and a brief idea of what it does.>
|
|
294
|
+
Copyright (C) <year> <name of author>
|
|
295
|
+
|
|
296
|
+
This program is free software; you can redistribute it and/or modify
|
|
297
|
+
it under the terms of the GNU General Public License as published by
|
|
298
|
+
the Free Software Foundation; either version 2 of the License, or
|
|
299
|
+
(at your option) any later version.
|
|
300
|
+
|
|
301
|
+
This program is distributed in the hope that it will be useful,
|
|
302
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
303
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
304
|
+
GNU General Public License for more details.
|
|
305
|
+
|
|
306
|
+
You should have received a copy of the GNU General Public License along
|
|
307
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
308
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
309
|
+
|
|
310
|
+
Also add information on how to contact you by electronic and paper mail.
|
|
311
|
+
|
|
312
|
+
If the program is interactive, make it output a short notice like this
|
|
313
|
+
when it starts in an interactive mode:
|
|
314
|
+
|
|
315
|
+
Gnomovision version 69, Copyright (C) year name of author
|
|
316
|
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
317
|
+
This is free software, and you are welcome to redistribute it
|
|
318
|
+
under certain conditions; type `show c' for details.
|
|
319
|
+
|
|
320
|
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
321
|
+
parts of the General Public License. Of course, the commands you use may
|
|
322
|
+
be called something other than `show w' and `show c'; they could even be
|
|
323
|
+
mouse-clicks or menu items--whatever suits your program.
|
|
324
|
+
|
|
325
|
+
You should also get your employer (if you work as a programmer) or your
|
|
326
|
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
|
327
|
+
necessary. Here is a sample; alter the names:
|
|
328
|
+
|
|
329
|
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
|
330
|
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
|
331
|
+
|
|
332
|
+
<signature of Ty Coon>, 1 April 1989
|
|
333
|
+
Ty Coon, President of Vice
|
|
334
|
+
|
|
335
|
+
This General Public License does not permit incorporating your program into
|
|
336
|
+
proprietary programs. If your program is a subroutine library, you may
|
|
337
|
+
consider it more useful to permit linking proprietary applications with the
|
|
338
|
+
library. If this is what you want to do, use the GNU Lesser General
|
|
339
|
+
Public License instead of this License.
|