cappysan-dotfile-scripts 0.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.
- cappysan_dotfile_scripts-0.0.0/LICENSE +21 -0
- cappysan_dotfile_scripts-0.0.0/MANIFEST.in +13 -0
- cappysan_dotfile_scripts-0.0.0/PKG-INFO +15 -0
- cappysan_dotfile_scripts-0.0.0/README.md +0 -0
- cappysan_dotfile_scripts-0.0.0/bin/clear +20 -0
- cappysan_dotfile_scripts-0.0.0/cappysan_dotfile_scripts.egg-info/PKG-INFO +15 -0
- cappysan_dotfile_scripts-0.0.0/cappysan_dotfile_scripts.egg-info/SOURCES.txt +19 -0
- cappysan_dotfile_scripts-0.0.0/cappysan_dotfile_scripts.egg-info/dependency_links.txt +1 -0
- cappysan_dotfile_scripts-0.0.0/cappysan_dotfile_scripts.egg-info/requires.txt +2 -0
- cappysan_dotfile_scripts-0.0.0/cappysan_dotfile_scripts.egg-info/top_level.txt +1 -0
- cappysan_dotfile_scripts-0.0.0/cappysan_dotfile_scripts.egg-info/zip-safe +1 -0
- cappysan_dotfile_scripts-0.0.0/constraints.txt +2 -0
- cappysan_dotfile_scripts-0.0.0/dotfiles/__init__.py +0 -0
- cappysan_dotfile_scripts-0.0.0/dotfiles/__main__.py +2 -0
- cappysan_dotfile_scripts-0.0.0/dotfiles/constants.py +1 -0
- cappysan_dotfile_scripts-0.0.0/dotfiles/testing/__init__.py +0 -0
- cappysan_dotfile_scripts-0.0.0/pyproject.toml +310 -0
- cappysan_dotfile_scripts-0.0.0/requirements-dev.txt +14 -0
- cappysan_dotfile_scripts-0.0.0/requirements.txt +0 -0
- cappysan_dotfile_scripts-0.0.0/setup.cfg +4 -0
- cappysan_dotfile_scripts-0.0.0/setup.py +76 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2025, Julien Lecomte
|
|
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.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cappysan-dotfile-scripts
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Author-email: Julien Lecomte <julien@cappysan.dev>
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://gitlab.com/cappysan/dotfiles/dotfiles
|
|
7
|
+
Project-URL: Source code, https://gitlab.com/cappysan/dotfiles/dotfiles
|
|
8
|
+
Project-URL: Bug tracker, https://gitlab.com/cappysan/dotfiles/dotfiles
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Dynamic: license-file
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
3
|
+
# $source: cappysan-dotfile-scripts$
|
|
4
|
+
# ──────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
#
|
|
6
|
+
# NAME
|
|
7
|
+
# clear - clear the terminal with any method available
|
|
8
|
+
#
|
|
9
|
+
# SEE ALSO
|
|
10
|
+
# clear_console(1), clear(1)
|
|
11
|
+
#
|
|
12
|
+
if test -x /usr/bin/clear_console; then
|
|
13
|
+
if /usr/bin/clear_console -q "${@}"; then
|
|
14
|
+
exit 0
|
|
15
|
+
fi
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if test -x /usr/bin/clear; then
|
|
19
|
+
/usr/bin/clear "${@}"
|
|
20
|
+
fi
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cappysan-dotfile-scripts
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Author-email: Julien Lecomte <julien@cappysan.dev>
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://gitlab.com/cappysan/dotfiles/dotfiles
|
|
7
|
+
Project-URL: Source code, https://gitlab.com/cappysan/dotfiles/dotfiles
|
|
8
|
+
Project-URL: Bug tracker, https://gitlab.com/cappysan/dotfiles/dotfiles
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
constraints.txt
|
|
5
|
+
pyproject.toml
|
|
6
|
+
requirements-dev.txt
|
|
7
|
+
requirements.txt
|
|
8
|
+
setup.py
|
|
9
|
+
bin/clear
|
|
10
|
+
cappysan_dotfile_scripts.egg-info/PKG-INFO
|
|
11
|
+
cappysan_dotfile_scripts.egg-info/SOURCES.txt
|
|
12
|
+
cappysan_dotfile_scripts.egg-info/dependency_links.txt
|
|
13
|
+
cappysan_dotfile_scripts.egg-info/requires.txt
|
|
14
|
+
cappysan_dotfile_scripts.egg-info/top_level.txt
|
|
15
|
+
cappysan_dotfile_scripts.egg-info/zip-safe
|
|
16
|
+
dotfiles/__init__.py
|
|
17
|
+
dotfiles/__main__.py
|
|
18
|
+
dotfiles/constants.py
|
|
19
|
+
dotfiles/testing/__init__.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dotfiles
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "0.0.0"
|
|
File without changes
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# Project metadata guidelines:
|
|
2
|
+
# https://peps.python.org/pep-0621/
|
|
3
|
+
#
|
|
4
|
+
# ------------------------------------------------------------------------------
|
|
5
|
+
# Setup
|
|
6
|
+
# ------------------------------------------------------------------------------
|
|
7
|
+
[project]
|
|
8
|
+
dynamic = ["dependencies"]
|
|
9
|
+
|
|
10
|
+
name = "cappysan-dotfile-scripts"
|
|
11
|
+
version = "0.0.0"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Julien Lecomte", email = "julien@cappysan.dev"}
|
|
14
|
+
]
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
description = ""
|
|
17
|
+
license = "MIT"
|
|
18
|
+
|
|
19
|
+
# See: https://pypi.python.org/pypi?:action=list_classifiers
|
|
20
|
+
# List of python versions and their support status: https://devguide.python.org/versions/
|
|
21
|
+
requires-python = ">=3.10"
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Intended Audience :: Developers",
|
|
24
|
+
# "Development Status :: 5 - Production/Stable",
|
|
25
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
# dotfiles-install = "dotfiles:main"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
dev = []
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://gitlab.com/cappysan/dotfiles/dotfiles"
|
|
39
|
+
"Source code" = "https://gitlab.com/cappysan/dotfiles/dotfiles"
|
|
40
|
+
"Bug tracker" = "https://gitlab.com/cappysan/dotfiles/dotfiles"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
[tool.setuptools]
|
|
44
|
+
packages = [
|
|
45
|
+
"dotfiles",
|
|
46
|
+
"dotfiles.testing",
|
|
47
|
+
]
|
|
48
|
+
zip-safe = true
|
|
49
|
+
script-files = [
|
|
50
|
+
"bin/clear",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
[tool.setuptools.dynamic]
|
|
55
|
+
dependencies = {file = ["requirements.txt"]}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
[build-system]
|
|
59
|
+
# These are the assumed default build requirements from pip:
|
|
60
|
+
# https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
|
|
61
|
+
requires = ["setuptools>=53.0.0"]
|
|
62
|
+
|
|
63
|
+
# ------------------------------------------------------------------------------
|
|
64
|
+
# Other tools
|
|
65
|
+
# ------------------------------------------------------------------------------
|
|
66
|
+
[tool.autoflake]
|
|
67
|
+
# https://pypi.org/project/pyproject-autoflake/
|
|
68
|
+
in-place = true
|
|
69
|
+
# Use '# noqa: F401' to ignore a removal
|
|
70
|
+
remove-all-unused-imports = true
|
|
71
|
+
ignore-init-module-imports = true
|
|
72
|
+
remove-duplicate-keys = true
|
|
73
|
+
remove-unused-variables = true
|
|
74
|
+
ignore-pass-after-docstring = true
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
[tool.black]
|
|
78
|
+
line-length = 120
|
|
79
|
+
target_version = ["py310", "py311", "py312", "py313", "py314"]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
[tool.bumpversion]
|
|
83
|
+
current_version = "0.0.0"
|
|
84
|
+
parse = """(?x)
|
|
85
|
+
(?P<major>0|[1-9]\\d*)\\.
|
|
86
|
+
(?P<minor>0|[1-9]\\d*)\\.
|
|
87
|
+
(?P<patch>0|[1-9]\\d*)
|
|
88
|
+
(?:
|
|
89
|
+
- # dash separator for pre-release section
|
|
90
|
+
(?P<seg_l>alpha|beta|rc|post) # pre-release label
|
|
91
|
+
(?:(?P<seg_n>0|[1-9]\\d*)) # pre-release version number
|
|
92
|
+
)? # pre-release section is optional
|
|
93
|
+
"""
|
|
94
|
+
search = "{current_version}"
|
|
95
|
+
replace = "{new_version}"
|
|
96
|
+
regex = false
|
|
97
|
+
ignore_missing_version = false
|
|
98
|
+
ignore_missing_files = false
|
|
99
|
+
tag = true
|
|
100
|
+
sign_tags = true
|
|
101
|
+
tag_name = "{new_version}"
|
|
102
|
+
tag_message = "Bump version from {current_version} to {new_version}"
|
|
103
|
+
allow_dirty = false
|
|
104
|
+
commit = true
|
|
105
|
+
message = "Release version {new_version} (previous: {current_version})"
|
|
106
|
+
moveable_tags = []
|
|
107
|
+
commit_args = ""
|
|
108
|
+
setup_hooks = []
|
|
109
|
+
pre_commit_hooks = [
|
|
110
|
+
"precommit run --all",
|
|
111
|
+
]
|
|
112
|
+
post_commit_hooks = []
|
|
113
|
+
|
|
114
|
+
serialize = [
|
|
115
|
+
"{major}.{minor}.{patch}-{seg_l}{seg_n}",
|
|
116
|
+
"{major}.{minor}.{patch}",
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
[tool.bumpversion.parts.seg_l]
|
|
120
|
+
values = [ "alpha", "beta", "rc", "post"]
|
|
121
|
+
optional_value = "post"
|
|
122
|
+
|
|
123
|
+
[tool.bumpversion.parts.seg_n]
|
|
124
|
+
first_value = "1"
|
|
125
|
+
|
|
126
|
+
[[tool.bumpversion.files]]
|
|
127
|
+
filename = ".answers.yml"
|
|
128
|
+
|
|
129
|
+
[[tool.bumpversion.files]]
|
|
130
|
+
filename = "pyproject.toml"
|
|
131
|
+
|
|
132
|
+
[[tool.bumpversion.files]]
|
|
133
|
+
filename = "src/constants.py"
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
[tool.codespell]
|
|
137
|
+
# https://github.com/codespell-project/codespell/blob/main/README.rst
|
|
138
|
+
#
|
|
139
|
+
# Dictionary is updated when codespell is updated, nevertheless, it can
|
|
140
|
+
# be found here: .venv/lib/python3.*/site-packages/codespell_lib/data/dictionary.txt
|
|
141
|
+
skip = "*.pyc,.cache,.git,.tox,.venv,public"
|
|
142
|
+
builtin = "clear,informal,rare,names"
|
|
143
|
+
ignore-words = "support/codespell.exclude"
|
|
144
|
+
ignore-multiline-regex = "# codespell: off\n.*# codespell: on\n"
|
|
145
|
+
check-filenames = ""
|
|
146
|
+
|
|
147
|
+
[tool.coverage.run]
|
|
148
|
+
branch = true
|
|
149
|
+
parallel = true
|
|
150
|
+
omit = [
|
|
151
|
+
"bin/*",
|
|
152
|
+
"docs/*",
|
|
153
|
+
"examples/*",
|
|
154
|
+
"tests/*",
|
|
155
|
+
]
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
[tool.coverage.report]
|
|
159
|
+
# pragma: no cover: disable coverage for a line
|
|
160
|
+
# pragma: no cover: start|stop: disable coverage for a block
|
|
161
|
+
# pragma: exclude file: disable coverage for a file
|
|
162
|
+
show_missing = true
|
|
163
|
+
exclude_lines = [
|
|
164
|
+
"@abc.abstractmethod",
|
|
165
|
+
"@abc.abstractproperty",
|
|
166
|
+
"_typeshed",
|
|
167
|
+
"except ImportError",
|
|
168
|
+
"if False",
|
|
169
|
+
"if __name__ == .__main__.:",
|
|
170
|
+
"lambda: None",
|
|
171
|
+
"pragma: no cover",
|
|
172
|
+
"raise NotImplemented",
|
|
173
|
+
"raise NotImplementedError",
|
|
174
|
+
"return NotImplemented",
|
|
175
|
+
"t.TYPE_CHECKING",
|
|
176
|
+
]
|
|
177
|
+
exclude_also = [
|
|
178
|
+
'no cover: start(?s:.)*?no cover: stop',
|
|
179
|
+
'\A(?s:.*# pragma: exclude file.*)\Z',
|
|
180
|
+
]
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
[tool.isort]
|
|
184
|
+
# https://pycqa.github.io/isort/docs/configuration/options.html
|
|
185
|
+
profile = "black"
|
|
186
|
+
line_length = 120
|
|
187
|
+
atomic = true
|
|
188
|
+
include_trailing_comma = true
|
|
189
|
+
skip_gitignore = true
|
|
190
|
+
use_parentheses = true
|
|
191
|
+
known_local_folder = "tests"
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
[tool.mypy]
|
|
195
|
+
# https://mypy.readthedocs.io/en/stable/config_file.html
|
|
196
|
+
pretty = true
|
|
197
|
+
strict = true
|
|
198
|
+
|
|
199
|
+
implicit_optional = true
|
|
200
|
+
ignore_missing_imports = true
|
|
201
|
+
|
|
202
|
+
warn_return_any = true
|
|
203
|
+
warn_unused_configs = true
|
|
204
|
+
|
|
205
|
+
disallow_untyped_calls = false
|
|
206
|
+
|
|
207
|
+
exclude = [
|
|
208
|
+
'^bin\/.*',
|
|
209
|
+
'^docs\/.*',
|
|
210
|
+
'^setup.py$',
|
|
211
|
+
'^tests\/.*',
|
|
212
|
+
]
|
|
213
|
+
|
|
214
|
+
[tool.nitpick]
|
|
215
|
+
style = [
|
|
216
|
+
# Ensure this project is up-to-date with template.
|
|
217
|
+
"https://gitlab.com/cappysan/scaffolds/python-template/-/raw/main/nitpick/scaffold-tpl-version-check.toml",
|
|
218
|
+
#
|
|
219
|
+
"https://gitlab.com/cappysan/nitpick/-/raw/main/resources/nitpick.toml",
|
|
220
|
+
"https://gitlab.com/cappysan/nitpick/-/raw/main/resources/pre-commit.toml",
|
|
221
|
+
]
|
|
222
|
+
ignore_styles = []
|
|
223
|
+
|
|
224
|
+
[tool.pylint.main]
|
|
225
|
+
|
|
226
|
+
[tool.pylint.reports]
|
|
227
|
+
# Deactivate the evaluation score.
|
|
228
|
+
score = false
|
|
229
|
+
|
|
230
|
+
[tool.pylint.exceptions]
|
|
231
|
+
# Exceptions that will emit a warning when caught.
|
|
232
|
+
overgeneral-exceptions = "builtins.BaseException"
|
|
233
|
+
|
|
234
|
+
[tool.pylint."messages control"]
|
|
235
|
+
# Disable the message, report, category or checker with the given id(s). You can
|
|
236
|
+
# either give multiple identifiers separated by comma (,) or put this option
|
|
237
|
+
# multiple times (only on the command line, not in the configuration file where
|
|
238
|
+
# it should appear only once). You can also use "--disable=all" to disable
|
|
239
|
+
# everything first and then re-enable specific checks. For example, if you want
|
|
240
|
+
# to run only the similarities checker, you can use "--disable=all
|
|
241
|
+
# --enable=similarities". If you want to run only the classes checker, but have
|
|
242
|
+
# no Warning level messages displayed, use "--disable=all --enable=classes
|
|
243
|
+
# --disable=W".
|
|
244
|
+
disable = [
|
|
245
|
+
"raw-checker-failed",
|
|
246
|
+
"bad-inline-option",
|
|
247
|
+
"locally-disabled",
|
|
248
|
+
"file-ignored",
|
|
249
|
+
"suppressed-message",
|
|
250
|
+
"useless-suppression",
|
|
251
|
+
"deprecated-pragma",
|
|
252
|
+
"use-symbolic-message-instead",
|
|
253
|
+
# defaults above, custom below
|
|
254
|
+
"chained-comparison", # disabled, less readable by habit
|
|
255
|
+
"duplicate-code", # disabled, false positives
|
|
256
|
+
"fixme", # disabled, can be properly handled manually
|
|
257
|
+
"line-too-long", # disabled, we use black so lines over 120 are intended
|
|
258
|
+
"logging-fstring-interpolation", # disabled, benefit outweighs cost
|
|
259
|
+
"missing-class-docstring", # disabled, only relevant with sphinx
|
|
260
|
+
"missing-function-docstring", # disabled, only relevant with sphinx
|
|
261
|
+
"missing-kwoa", # disabled, false positives
|
|
262
|
+
"missing-module-docstring", # disabled, only relevant with sphinx
|
|
263
|
+
"no-member", # disabled, false positives
|
|
264
|
+
"too-few-public-methods", # disabled, human knows best
|
|
265
|
+
"too-many-arguments", # disabled, human knows best
|
|
266
|
+
"too-many-branches", # disabled, human knows best
|
|
267
|
+
"too-many-instance-attributes", # disabled, human knows best
|
|
268
|
+
"too-many-locals", # disabled, human knows best
|
|
269
|
+
"too-many-statements", # disabled, human knows best
|
|
270
|
+
"ungrouped-imports", # disabled, we use isort so this is only voluntary
|
|
271
|
+
"wrong-import-order", # disabled, we use isort so this is only voluntary
|
|
272
|
+
# local to this project:
|
|
273
|
+
]
|
|
274
|
+
|
|
275
|
+
# Enable the message, report, category or checker with the given id(s). You can
|
|
276
|
+
# either give multiple identifier separated by comma (,) or put this option
|
|
277
|
+
# multiple time (only on the command line, not in the configuration file where it
|
|
278
|
+
# should appear only once). See also the "--disable" option for examples.
|
|
279
|
+
enable = ["c-extension-no-member"]
|
|
280
|
+
|
|
281
|
+
[tool.pylint.basic]
|
|
282
|
+
# If variable isn't whitelisted here, it'll trigger an 'invalid-name' error
|
|
283
|
+
good-names = [
|
|
284
|
+
"i",
|
|
285
|
+
"j",
|
|
286
|
+
"k",
|
|
287
|
+
"ex",
|
|
288
|
+
"Run",
|
|
289
|
+
"_",
|
|
290
|
+
# defaults above, custom below
|
|
291
|
+
"app", # application
|
|
292
|
+
"db", # database
|
|
293
|
+
"fd", # file descriptor
|
|
294
|
+
"fn", # function (reserved word)
|
|
295
|
+
"rv", # frequently used as 'retval', aka 'return value'
|
|
296
|
+
"v", # as in `for k, v in {}.items()`
|
|
297
|
+
"x", # frequently used in lambdas, more precise than i, j
|
|
298
|
+
"pk", # used as primary key for API
|
|
299
|
+
# local to this project:
|
|
300
|
+
]
|
|
301
|
+
|
|
302
|
+
# Good variable names regexes, separated by a comma. If names match any regex,
|
|
303
|
+
# they will always be accepted
|
|
304
|
+
good-names-rgxs = "^_?(CONST_|K_)[A-Z0-9][_A-Z0-9]*$"
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
[tool.pytest.ini_options]
|
|
308
|
+
markers = [
|
|
309
|
+
"live: connects to internet resource (unselect with '-m \"not live\"')",
|
|
310
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# pylint: disable=redefined-outer-name
|
|
3
|
+
#
|
|
4
|
+
import os
|
|
5
|
+
import shutil
|
|
6
|
+
import subprocess
|
|
7
|
+
import tempfile
|
|
8
|
+
import typing as t
|
|
9
|
+
|
|
10
|
+
from setuptools import setup
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
import tomlib
|
|
14
|
+
except ModuleNotFoundError:
|
|
15
|
+
try:
|
|
16
|
+
import tomllib as tomlib
|
|
17
|
+
except ModuleNotFoundError:
|
|
18
|
+
import tomli as tomlib
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class AutoRestoreFile:
|
|
22
|
+
def __init__(self, src: str, dst: str):
|
|
23
|
+
self.src = src
|
|
24
|
+
self.dst = dst
|
|
25
|
+
|
|
26
|
+
def __enter__(self) -> None:
|
|
27
|
+
shutil.copyfile(self.src, self.dst)
|
|
28
|
+
|
|
29
|
+
def __exit__(self, _exc_type: t.Any, _exc_value: t.Any, _exc_traceback: t.Any) -> None:
|
|
30
|
+
shutil.copyfile(self.dst, self.src)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def load_requirements() -> list[str]:
|
|
34
|
+
with open("requirements.txt", encoding="UTF-8") as fd:
|
|
35
|
+
requirements = fd.read().splitlines()
|
|
36
|
+
requirements = [x for x in requirements if x and not x.startswith("--")]
|
|
37
|
+
return requirements
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def save_requirements(requirements: list[str]) -> None:
|
|
41
|
+
with open("requirements.txt", mode="w", encoding="UTF-8") as fd:
|
|
42
|
+
fd.writelines([f"{x}\n" for x in requirements])
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def push_requirements() -> None:
|
|
46
|
+
# requirements.txt support flags such as "--index", remove
|
|
47
|
+
# them before we continue
|
|
48
|
+
requirements = load_requirements()
|
|
49
|
+
save_requirements(requirements)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def freeze_requirements() -> None:
|
|
53
|
+
# If pyproject specifies creating script files, then
|
|
54
|
+
# compile a static version of the dependencies.
|
|
55
|
+
|
|
56
|
+
# Does the pyproject.toml have a "project.scripts"?
|
|
57
|
+
config = os.path.dirname(__file__) + "/pyproject.toml"
|
|
58
|
+
with open(config, mode="rb") as fd:
|
|
59
|
+
pyproject = tomlib.load(fd)
|
|
60
|
+
|
|
61
|
+
if not pyproject["project"].get("scripts"):
|
|
62
|
+
return
|
|
63
|
+
|
|
64
|
+
cmdline = "uv pip compile requirements.txt --format requirements.txt -o requirements.txt"
|
|
65
|
+
retval = subprocess.run(cmdline, shell=True, check=True, capture_output=True)
|
|
66
|
+
retval.check_returncode()
|
|
67
|
+
|
|
68
|
+
# Make a copy as a `constraints.txt` file so it can be used optionally for dev
|
|
69
|
+
shutil.copyfile("requirements.txt", "constraints.txt")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
with tempfile.NamedTemporaryFile() as tmpfile:
|
|
73
|
+
with AutoRestoreFile("requirements.txt", tmpfile.name):
|
|
74
|
+
push_requirements()
|
|
75
|
+
freeze_requirements()
|
|
76
|
+
setup()
|