python-package-folder 0.1.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.
- python_package_folder-0.1.0/.copier-answers.yml +9 -0
- python_package_folder-0.1.0/.cursor/rules/general.mdc +72 -0
- python_package_folder-0.1.0/.cursor/rules/python.mdc +290 -0
- python_package_folder-0.1.0/.github/workflows/ci.yml +63 -0
- python_package_folder-0.1.0/.github/workflows/publish.yml +44 -0
- python_package_folder-0.1.0/.gitignore +183 -0
- python_package_folder-0.1.0/.vscode/settings.json +7 -0
- python_package_folder-0.1.0/LICENSE +21 -0
- python_package_folder-0.1.0/Makefile +43 -0
- python_package_folder-0.1.0/PKG-INFO +544 -0
- python_package_folder-0.1.0/README.md +524 -0
- python_package_folder-0.1.0/development.md +101 -0
- python_package_folder-0.1.0/installation.md +27 -0
- python_package_folder-0.1.0/publishing.md +71 -0
- python_package_folder-0.1.0/pyproject.toml +173 -0
- python_package_folder-0.1.0/src/python_package_folder/__init__.py +19 -0
- python_package_folder-0.1.0/src/python_package_folder/__main__.py +13 -0
- python_package_folder-0.1.0/src/python_package_folder/analyzer.py +313 -0
- python_package_folder-0.1.0/src/python_package_folder/finder.py +188 -0
- python_package_folder-0.1.0/src/python_package_folder/manager.py +388 -0
- python_package_folder-0.1.0/src/python_package_folder/publisher.py +246 -0
- python_package_folder-0.1.0/src/python_package_folder/py.typed +0 -0
- python_package_folder-0.1.0/src/python_package_folder/python_package_folder.py +151 -0
- python_package_folder-0.1.0/src/python_package_folder/types.py +66 -0
- python_package_folder-0.1.0/src/python_package_folder/version.py +255 -0
- python_package_folder-0.1.0/tests/folder_structure/some_globals.py +1 -0
- python_package_folder-0.1.0/tests/folder_structure/subfolder_to_build/some_function.py +15 -0
- python_package_folder-0.1.0/tests/folder_structure/utility_folder/some_utility.py +2 -0
- python_package_folder-0.1.0/tests/test_build_with_external_deps.py +429 -0
- python_package_folder-0.1.0/tests/tests.py +7 -0
- python_package_folder-0.1.0/uv.lock +231 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Changes here will be overwritten by Copier. Do not edit manually.
|
|
2
|
+
_commit: v0.2.19
|
|
3
|
+
_src_path: gh:jlevy/simple-modern-uv
|
|
4
|
+
package_author_email: work@alelom.com
|
|
5
|
+
package_author_name: Alessio Lombardi
|
|
6
|
+
package_description: ''
|
|
7
|
+
package_github_org: alelom
|
|
8
|
+
package_module: python_package_folder
|
|
9
|
+
package_name: python-package-folder
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: General Guidelines
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
# Assistant Rules
|
|
7
|
+
|
|
8
|
+
**Your fundamental responsibility:** Remember you are a senior engineer and have a
|
|
9
|
+
serious responsibility to be clear, factual, think step by step and be systematic,
|
|
10
|
+
express expert opinion, and make use of the user’s attention wisely.
|
|
11
|
+
|
|
12
|
+
**Rules must be followed:** It is your responsibility to carefully read these rules as
|
|
13
|
+
well as Python or other language-specific rules included here.
|
|
14
|
+
|
|
15
|
+
Therefore:
|
|
16
|
+
|
|
17
|
+
- Be concise. State answers or responses directly, without extra commentary.
|
|
18
|
+
Or (if it is clear) directly do what is asked.
|
|
19
|
+
|
|
20
|
+
- If instructions are unclear or there are two or more ways to fulfill the request that
|
|
21
|
+
are substantially different, make a tentative plan (or offer options) and ask for
|
|
22
|
+
confirmation.
|
|
23
|
+
|
|
24
|
+
- If you can think of a much better approach that the user requests, be sure to mention
|
|
25
|
+
it. It’s your responsibility to suggest approaches that lead to better, simpler
|
|
26
|
+
solutions.
|
|
27
|
+
|
|
28
|
+
- Give thoughtful opinions on better/worse approaches, but NEVER say “great idea!”
|
|
29
|
+
or “good job” or other compliments, encouragement, or non-essential banter.
|
|
30
|
+
Your job is to give expert opinions and to solve problems, not to motivate the user.
|
|
31
|
+
|
|
32
|
+
- Avoid gratuitous enthusiasm or generalizations.
|
|
33
|
+
Use thoughtful comparisons like saying which code is “cleaner” but don’t congratulate
|
|
34
|
+
yourself. Avoid subjective descriptions.
|
|
35
|
+
For example, don’t say “I’ve meticulously improved the code and it is in great shape!”
|
|
36
|
+
That is useless generalization.
|
|
37
|
+
Instead, specifically say what you’ve done, e.g., "I’ve added types, including
|
|
38
|
+
generics, to all the methods in `Foo` and fixed all linter errors."
|
|
39
|
+
|
|
40
|
+
# General Coding Guidelines
|
|
41
|
+
|
|
42
|
+
## Using Comments
|
|
43
|
+
|
|
44
|
+
- Keep all comments concise and clear and suitable for inclusion in final production.
|
|
45
|
+
|
|
46
|
+
- DO use comments whenever the intent of a given piece of code is subtle or confusing or
|
|
47
|
+
avoids a bug or is not obvious from the code itself.
|
|
48
|
+
|
|
49
|
+
- DO NOT repeat in comments what is obvious from the names of functions or variables or
|
|
50
|
+
types.
|
|
51
|
+
|
|
52
|
+
- DO NOT include comments that reflect what you did, such as “Added this function” as
|
|
53
|
+
this is meaningless to anyone reading the code later.
|
|
54
|
+
(Instead, describe in your message to the user any other contextual information.)
|
|
55
|
+
|
|
56
|
+
- DO NOT use fancy or needlessly decorated headings like “===== MIGRATION TOOLS =====”
|
|
57
|
+
in comments
|
|
58
|
+
|
|
59
|
+
- DO NOT number steps in comments.
|
|
60
|
+
These are hard to maintain if the code changes.
|
|
61
|
+
NEVER DO THIS: “// Step 3: Fetch the data from the cache”\
|
|
62
|
+
This is fine: “// Now fetch the data from the cache”
|
|
63
|
+
|
|
64
|
+
- DO NOT use emojis or special unicode characters like ① or • or – or — in comments.
|
|
65
|
+
|
|
66
|
+
- Use emojis in output if it enhances the clarity and can be done consistently.
|
|
67
|
+
You may use ✔︎ and ✘ to indicate success and failure, and ∆ and ‼︎ for user-facing
|
|
68
|
+
warnings and errors, for example, but be sure to do it consistently.
|
|
69
|
+
DO NOT use emojis gratuitously in comments or output.
|
|
70
|
+
You may use then ONLY when they have clear meanings (like success or failure).
|
|
71
|
+
Unless the user says otherwise, avoid emojis and Unicode in comments as clutters the
|
|
72
|
+
output with little benefit.
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Python Coding Guidelines
|
|
3
|
+
globs: *.py,pyproject.toml
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Python Coding Guidelines
|
|
7
|
+
|
|
8
|
+
These are rules for a modern Python project using uv.
|
|
9
|
+
|
|
10
|
+
## Python Version
|
|
11
|
+
|
|
12
|
+
Write for Python 3.11-3.13. Do NOT write code to support earlier versions of Python.
|
|
13
|
+
Always use modern Python practices appropriate for Python 3.11-3.13.
|
|
14
|
+
|
|
15
|
+
Always use full type annotations, generics, and other modern practices.
|
|
16
|
+
|
|
17
|
+
## Project Setup and Developer Workflows
|
|
18
|
+
|
|
19
|
+
- Important: BE SURE you read and understand the project setup by reading the
|
|
20
|
+
pyproject.toml file and the Makefile.
|
|
21
|
+
|
|
22
|
+
- ALWAYS use uv for running all code and managing dependencies.
|
|
23
|
+
Never use direct `pip` or `python` commands.
|
|
24
|
+
|
|
25
|
+
- Use modern uv commands: `uv sync`, `uv run ...`, etc.
|
|
26
|
+
Prefer `uv add` over `uv pip install`.
|
|
27
|
+
|
|
28
|
+
- You may use the following shortcuts
|
|
29
|
+
```shell
|
|
30
|
+
|
|
31
|
+
# Install all dependencies:
|
|
32
|
+
make install
|
|
33
|
+
|
|
34
|
+
# Run linting (with ruff) and type checking (with basedpyright).
|
|
35
|
+
# Note when you run this, ruff will auto-format and sort imports, resolving any
|
|
36
|
+
# linter warnings about import ordering:
|
|
37
|
+
make lint
|
|
38
|
+
|
|
39
|
+
# Run tests:
|
|
40
|
+
make test
|
|
41
|
+
|
|
42
|
+
# Run uv sync, lint, and test in one command:
|
|
43
|
+
make
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- The usual `make test` like standard pytest does not show test output.
|
|
47
|
+
Run individual tests and see output with `uv run pytest -s some/file.py`.
|
|
48
|
+
|
|
49
|
+
- Always run `make lint` and `make test` to check your code after changes.
|
|
50
|
+
|
|
51
|
+
- You must verify there are zero linter warnings/errors or test failures before
|
|
52
|
+
considering any task complete.
|
|
53
|
+
|
|
54
|
+
## General Development Practices
|
|
55
|
+
|
|
56
|
+
- Be sure to resolve the pyright (basedpyright) linter errors as you develop and make
|
|
57
|
+
changes.
|
|
58
|
+
|
|
59
|
+
- If type checker errors are hard to resolve, you may add a comment `# pyright: ignore`
|
|
60
|
+
to disable Pyright warnings or errors but ONLY if you know they are not a real problem
|
|
61
|
+
and are difficult to fix.
|
|
62
|
+
|
|
63
|
+
- In special cases you may consider disabling it globally it in pyproject.toml but YOU
|
|
64
|
+
MUST ASK FOR CONFIRMATION from the user before globally disabling lint or type checker
|
|
65
|
+
rules.
|
|
66
|
+
|
|
67
|
+
- Never change an existing comment, pydoc, or a log statement, unless it is directly
|
|
68
|
+
fixing the issue you are changing, or the user has asked you to clean up the code.
|
|
69
|
+
Do not drop existing comments when editing code!
|
|
70
|
+
And do not delete or change logging statements.
|
|
71
|
+
|
|
72
|
+
## Coding Conventions and Imports
|
|
73
|
+
|
|
74
|
+
- Always use full, absolute imports for paths.
|
|
75
|
+
do NOT use `from .module1.module2 import ...`. Such relative paths make it hard to
|
|
76
|
+
refactor. Use `from toplevel_pkg.module1.modlule2 import ...` instead.
|
|
77
|
+
|
|
78
|
+
- Be sure to import things like `Callable` and other types from the right modules,
|
|
79
|
+
remembering that many are now in `collections.abc` or `typing_extensions`. For
|
|
80
|
+
example: `from collections.abc import Callable, Coroutine`
|
|
81
|
+
|
|
82
|
+
- Use `typing_extensions` for things like `@override` (you need to use this, and not
|
|
83
|
+
`typing` since we want to support Python 3.11).
|
|
84
|
+
|
|
85
|
+
- Add `from __future__ import annotations` on files with types whenever applicable.
|
|
86
|
+
|
|
87
|
+
- Use pathlib `Path` instead of strings.
|
|
88
|
+
Use `Path(filename).read_text()` instead of two-line `with open(...)` blocks.
|
|
89
|
+
|
|
90
|
+
- Use strif’s `atomic_output_file` context manager when writing files to ensure output
|
|
91
|
+
files are written atomically.
|
|
92
|
+
|
|
93
|
+
## Use Modern Python Practices
|
|
94
|
+
|
|
95
|
+
- ALWAYS use `@override` decorators to override methods from base classes.
|
|
96
|
+
This is a modern Python practice and helps avoid bugs.
|
|
97
|
+
|
|
98
|
+
## Testing
|
|
99
|
+
|
|
100
|
+
- For longer tests put them in a file like `tests/test_somename.py` in the `tests/`
|
|
101
|
+
directory (or `tests/module_name/test_somename.py` file for a submodule).
|
|
102
|
+
|
|
103
|
+
- For simple tests, prefer inline functions in the original code file below a `## Tests`
|
|
104
|
+
comment. This keeps the tests easy to maintain and close to the code.
|
|
105
|
+
Inline tests should NOT import pytest or pytest fixtures as we do not want runtime
|
|
106
|
+
dependency on pytest.
|
|
107
|
+
|
|
108
|
+
- DO NOT write one-off test code in extra files that are throwaway.
|
|
109
|
+
|
|
110
|
+
- DO NOT put `if __name__ == "__main__":` just for quick testing.
|
|
111
|
+
Instead use the inline function tests and run them with `uv run pytest`.
|
|
112
|
+
|
|
113
|
+
- You can run such individual tests with `uv run pytest -s src/.../path/to/test`
|
|
114
|
+
|
|
115
|
+
- Don’t add docs to assertions unless it’s not obvious what they’re checking - the
|
|
116
|
+
assertion appears in the stack trace.
|
|
117
|
+
Do NOT write `assert x == 5, "x should be 5"`. Do NOT write `assert x == 5 # Check if
|
|
118
|
+
x is 5`. That is redundant.
|
|
119
|
+
Just write `assert x == 5`.
|
|
120
|
+
|
|
121
|
+
- DO NOT write trivial or obvious tests that are evident directly from code, such as
|
|
122
|
+
assertions that confirm the value of a constant setting.
|
|
123
|
+
|
|
124
|
+
- NEVER write `assert False`. If a test reaches an unexpected branch and must fail
|
|
125
|
+
explicitly, `raise AssertionError("Some explanation")` instead.
|
|
126
|
+
This is best typical best practice in Python since assertions can be removed with
|
|
127
|
+
optimization.
|
|
128
|
+
|
|
129
|
+
- DO NOT use pytest fixtures like parameterized tests or expected exception decorators
|
|
130
|
+
unless absolutely necessary in more complex tests.
|
|
131
|
+
It is typically simpler to use simple assertions and put the checks inside the test.
|
|
132
|
+
This is also preferable because then simple tests have no explicit pytest dependencies
|
|
133
|
+
and can be placed in code anywhere.
|
|
134
|
+
|
|
135
|
+
- DO NOT write trivial tests that test something we know already works, like
|
|
136
|
+
instantiating a Pydantic object.
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
class Link(BaseModel):
|
|
140
|
+
url: str
|
|
141
|
+
title: str = None
|
|
142
|
+
|
|
143
|
+
# DO NOT write tests like this. They are trivial and only create clutter!
|
|
144
|
+
def test_link_model():
|
|
145
|
+
link = Link(url="https://example.com", title="Example")
|
|
146
|
+
assert link.url == "https://example.com"
|
|
147
|
+
assert link.title == "Example"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Types and Type Annotations
|
|
151
|
+
|
|
152
|
+
- Use modern union syntax: `str | None` instead of `Optional[str]`, `dict[str]` instead
|
|
153
|
+
of `Dict[str]`, `list[str]` instead of `List[str]`, etc.
|
|
154
|
+
|
|
155
|
+
- Never use/import `Optional` for new code.
|
|
156
|
+
|
|
157
|
+
- Use modern enums like `StrEnum` if appropriate.
|
|
158
|
+
|
|
159
|
+
- One exception to common practice on enums: If an enum has many values that are
|
|
160
|
+
strings, and they have a literal value as a string (like in a JSON protocol), it’s
|
|
161
|
+
fine to use lower_snake_case for enum values to match the actual value.
|
|
162
|
+
This is more readable than LONG_ALL_CAPS_VALUES, and you can simply set the value to
|
|
163
|
+
be the same as the name for each.
|
|
164
|
+
For example:
|
|
165
|
+
```python
|
|
166
|
+
class MediaType(Enum):
|
|
167
|
+
"""
|
|
168
|
+
Media types. For broad categories only, to determine what processing
|
|
169
|
+
is possible.
|
|
170
|
+
"""
|
|
171
|
+
|
|
172
|
+
text = "text"
|
|
173
|
+
image = "image"
|
|
174
|
+
audio = "audio"
|
|
175
|
+
video = "video"
|
|
176
|
+
webpage = "webpage"
|
|
177
|
+
binary = "binary"
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Guidelines for Literal Strings
|
|
181
|
+
|
|
182
|
+
- For multi-line strings NEVER put multi-line strings flush against the left margin.
|
|
183
|
+
ALWAYS use a `dedent()` function to make it more readable.
|
|
184
|
+
You may wish to add a `strip()` as well.
|
|
185
|
+
Example:
|
|
186
|
+
```python
|
|
187
|
+
from textwrap import dedent
|
|
188
|
+
markdown_content = dedent("""
|
|
189
|
+
# Title 1
|
|
190
|
+
Some text.
|
|
191
|
+
## Subtitle 1.1
|
|
192
|
+
More text.
|
|
193
|
+
""").strip()
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Guidelines for Comments
|
|
197
|
+
|
|
198
|
+
- Comments should be EXPLANATORY: Explain *WHY* something is done a certain way and not
|
|
199
|
+
just *what* is done.
|
|
200
|
+
|
|
201
|
+
- Comments should be CONCISE: Remove all extraneous words.
|
|
202
|
+
|
|
203
|
+
- DO NOT use comments to state obvious things or repeat what is evident from the code.
|
|
204
|
+
Here is an example of a comment that SHOULD BE REMOVED because it simply repeats the
|
|
205
|
+
code, which is distracting and adds no value:
|
|
206
|
+
```python
|
|
207
|
+
if self.failed == 0:
|
|
208
|
+
# All successful
|
|
209
|
+
return "All tasks finished successfully"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Guidelines for Docstrings
|
|
213
|
+
|
|
214
|
+
- Here is an example of the correct style for docstrings:
|
|
215
|
+
```python
|
|
216
|
+
def check_if_url(
|
|
217
|
+
text: UnresolvedLocator, only_schemes: list[str] | None = None
|
|
218
|
+
) -> ParseResult | None:
|
|
219
|
+
"""
|
|
220
|
+
Convenience function to check if a string or Path is a URL and if so return
|
|
221
|
+
the `urlparse.ParseResult`.
|
|
222
|
+
|
|
223
|
+
Also returns false for Paths, so that it's easy to use local paths and URLs
|
|
224
|
+
(`Locator`s) interchangeably. Can provide `HTTP_ONLY` or `HTTP_OR_FILE` to
|
|
225
|
+
restrict to only certain schemes.
|
|
226
|
+
"""
|
|
227
|
+
# Function body
|
|
228
|
+
|
|
229
|
+
def is_url(text: UnresolvedLocator, only_schemes: list[str] | None = None) -> bool:
|
|
230
|
+
"""
|
|
231
|
+
Check if a string is a URL. For convenience, also returns false for
|
|
232
|
+
Paths, so that it's easy to use local paths and URLs interchangeably.
|
|
233
|
+
"""
|
|
234
|
+
return check_if_url(text, only_schemes) is not None
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
- Use concise pydoc strings with triple quotes on their own lines.
|
|
238
|
+
|
|
239
|
+
- Use `backticks` around variable names and inline code excerpts.
|
|
240
|
+
|
|
241
|
+
- Use plain fences (```) around code blocks inside of pydocs.
|
|
242
|
+
|
|
243
|
+
- For classes with many methods, use a concise docstring on the class that explains all
|
|
244
|
+
the common information, and avoid repeating the same information on every method.
|
|
245
|
+
|
|
246
|
+
- Docstrings should provide context or as concisely as possible explain “why”, not
|
|
247
|
+
obvious details evident from the class names, function names, parameter names, and
|
|
248
|
+
type annotations.
|
|
249
|
+
|
|
250
|
+
- Docstrings *should* mention any key rationale or pitfalls when using the class or
|
|
251
|
+
function.
|
|
252
|
+
|
|
253
|
+
- Avoid obvious or repetitive docstrings.
|
|
254
|
+
Do NOT add pydocs that just repeat in English facts that are obvious from the function
|
|
255
|
+
name, variable name, or types.
|
|
256
|
+
That is silly and obvious and makes the code longer for no reason.
|
|
257
|
+
|
|
258
|
+
- Do NOT list args and return values if they’re obvious.
|
|
259
|
+
In the above examples, you do not need and `Arguments:` or `Returns:` section, since
|
|
260
|
+
sections as it is obvious from context.
|
|
261
|
+
do list these if there are many arguments and their meaning isn’t clear.
|
|
262
|
+
If it returns a less obvious type like a tuple, do explain in the pydoc.
|
|
263
|
+
|
|
264
|
+
- Exported/public variables, functions, or methods SHOULD have concise docstrings.
|
|
265
|
+
Internal/local variables, functions, and methods DO NOT need docstrings unless their
|
|
266
|
+
purpose is not obvious.
|
|
267
|
+
|
|
268
|
+
## General Clean Coding Practices
|
|
269
|
+
|
|
270
|
+
- Avoid writing trivial wrapper functions.
|
|
271
|
+
For example, when writing a class DO NOT blindly make delegation methods around public
|
|
272
|
+
member variables. DO NOT write methods like this:
|
|
273
|
+
```python
|
|
274
|
+
def reassemble(self) -> str:
|
|
275
|
+
"""Call the original reassemble method."""
|
|
276
|
+
return self.paragraph.reassemble()
|
|
277
|
+
```
|
|
278
|
+
In general, the user can just call the enclosed objects methods, reducing code bloat.
|
|
279
|
+
|
|
280
|
+
- If a function does not use a parameter, but it should still be present, you can use `#
|
|
281
|
+
pyright: ignore[reportUnusedParameter]` in a comment to suppress the linter warning.
|
|
282
|
+
|
|
283
|
+
## Guidelines for Backward Compatibility
|
|
284
|
+
|
|
285
|
+
- When changing code in a library or general function, if a change to an API or library
|
|
286
|
+
will break backward compatibility, MENTION THIS to the user.
|
|
287
|
+
|
|
288
|
+
- DO NOT implement additional code for backward compatiblity (such as extra methods or
|
|
289
|
+
variable aliases or comments about backward compatibility) UNLESS the user has
|
|
290
|
+
confirmed that it is necessary.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
3
|
+
|
|
4
|
+
name: CI
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
# Use ["main", "master"] for CI only on the default branch.
|
|
9
|
+
# Use ["**"] for CI on all branches.
|
|
10
|
+
branches: ["main", "master"]
|
|
11
|
+
pull_request:
|
|
12
|
+
branches: ["main", "master"]
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
# Update this as needed:
|
|
22
|
+
# Common platforms: ["ubuntu-latest", "macos-latest", "windows-latest"]
|
|
23
|
+
os: ["ubuntu-latest"]
|
|
24
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
25
|
+
|
|
26
|
+
# Linux only by default. Use ${{ matrix.os }} for other OSes.
|
|
27
|
+
runs-on: ${{ matrix.os }}
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
# Generally following uv docs:
|
|
31
|
+
# https://docs.astral.sh/uv/guides/integration/github/
|
|
32
|
+
|
|
33
|
+
- name: Checkout (official GitHub action)
|
|
34
|
+
uses: actions/checkout@v4
|
|
35
|
+
with:
|
|
36
|
+
# Important for versioning plugins:
|
|
37
|
+
fetch-depth: 0
|
|
38
|
+
|
|
39
|
+
- name: Install uv (official Astral action)
|
|
40
|
+
uses: astral-sh/setup-uv@v5
|
|
41
|
+
with:
|
|
42
|
+
# Update this as needed:
|
|
43
|
+
version: "0.9.5"
|
|
44
|
+
enable-cache: true
|
|
45
|
+
python-version: ${{ matrix.python-version }}
|
|
46
|
+
|
|
47
|
+
- name: Set up Python (using uv)
|
|
48
|
+
run: uv python install
|
|
49
|
+
|
|
50
|
+
# Alternately can use the official Python action:
|
|
51
|
+
# - name: Set up Python (using actions/setup-python)
|
|
52
|
+
# uses: actions/setup-python@v5
|
|
53
|
+
# with:
|
|
54
|
+
# python-version: ${{ matrix.python-version }}
|
|
55
|
+
|
|
56
|
+
- name: Install all dependencies
|
|
57
|
+
run: uv sync --all-extras
|
|
58
|
+
|
|
59
|
+
- name: Run linting
|
|
60
|
+
run: uv run python devtools/lint.py
|
|
61
|
+
|
|
62
|
+
- name: Run tests
|
|
63
|
+
run: uv run pytest
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch: # Enable manual trigger.
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-and-publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write # Mandatory for OIDC.
|
|
13
|
+
contents: read
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout (official GitHub action)
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
# Important for versioning plugins:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
|
|
21
|
+
- name: Install uv (official Astral action)
|
|
22
|
+
uses: astral-sh/setup-uv@v5
|
|
23
|
+
with:
|
|
24
|
+
version: "0.9.5"
|
|
25
|
+
enable-cache: true
|
|
26
|
+
python-version: "3.12"
|
|
27
|
+
|
|
28
|
+
- name: Set up Python (using uv)
|
|
29
|
+
run: uv python install
|
|
30
|
+
|
|
31
|
+
- name: Install all dependencies
|
|
32
|
+
run: uv sync --all-extras
|
|
33
|
+
|
|
34
|
+
- name: Run tests
|
|
35
|
+
run: uv run pytest
|
|
36
|
+
|
|
37
|
+
- name: Build package
|
|
38
|
+
run: uv build
|
|
39
|
+
|
|
40
|
+
- name: Publish to PyPI
|
|
41
|
+
run: uv publish --trusted-publishing always
|
|
42
|
+
# Although uv is newer and faster, the "official" publishing option is the one from PyPA,
|
|
43
|
+
# which uses twine. If desired, replace `uv publish` with:
|
|
44
|
+
# uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Generated by Makefile
|
|
2
|
+
CLAUDE.md
|
|
3
|
+
AGENTS.md
|
|
4
|
+
|
|
5
|
+
# Additions to standard GitHub .gitignore:
|
|
6
|
+
*.bak
|
|
7
|
+
*.orig
|
|
8
|
+
tmp/
|
|
9
|
+
trash/
|
|
10
|
+
attic/
|
|
11
|
+
.kash/
|
|
12
|
+
|
|
13
|
+
# Byte-compiled / optimized / DLL files
|
|
14
|
+
__pycache__/
|
|
15
|
+
*.py[cod]
|
|
16
|
+
*$py.class
|
|
17
|
+
|
|
18
|
+
# C extensions
|
|
19
|
+
*.so
|
|
20
|
+
|
|
21
|
+
# Distribution / packaging
|
|
22
|
+
.Python
|
|
23
|
+
build/
|
|
24
|
+
develop-eggs/
|
|
25
|
+
dist/
|
|
26
|
+
downloads/
|
|
27
|
+
eggs/
|
|
28
|
+
.eggs/
|
|
29
|
+
lib/
|
|
30
|
+
lib64/
|
|
31
|
+
parts/
|
|
32
|
+
sdist/
|
|
33
|
+
var/
|
|
34
|
+
wheels/
|
|
35
|
+
share/python-wheels/
|
|
36
|
+
*.egg-info/
|
|
37
|
+
.installed.cfg
|
|
38
|
+
*.egg
|
|
39
|
+
MANIFEST
|
|
40
|
+
|
|
41
|
+
# PyInstaller
|
|
42
|
+
# Usually these files are written by a python script from a template
|
|
43
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
44
|
+
*.manifest
|
|
45
|
+
*.spec
|
|
46
|
+
|
|
47
|
+
# Installer logs
|
|
48
|
+
pip-log.txt
|
|
49
|
+
pip-delete-this-directory.txt
|
|
50
|
+
|
|
51
|
+
# Unit test / coverage reports
|
|
52
|
+
htmlcov/
|
|
53
|
+
.tox/
|
|
54
|
+
.nox/
|
|
55
|
+
.coverage
|
|
56
|
+
.coverage.*
|
|
57
|
+
.cache
|
|
58
|
+
nosetests.xml
|
|
59
|
+
coverage.xml
|
|
60
|
+
*.cover
|
|
61
|
+
*.py,cover
|
|
62
|
+
.hypothesis/
|
|
63
|
+
.pytest_cache/
|
|
64
|
+
cover/
|
|
65
|
+
|
|
66
|
+
# Translations
|
|
67
|
+
*.mo
|
|
68
|
+
*.pot
|
|
69
|
+
|
|
70
|
+
# Django stuff:
|
|
71
|
+
*.log
|
|
72
|
+
local_settings.py
|
|
73
|
+
db.sqlite3
|
|
74
|
+
db.sqlite3-journal
|
|
75
|
+
|
|
76
|
+
# Flask stuff:
|
|
77
|
+
instance/
|
|
78
|
+
.webassets-cache
|
|
79
|
+
|
|
80
|
+
# Scrapy stuff:
|
|
81
|
+
.scrapy
|
|
82
|
+
|
|
83
|
+
# Sphinx documentation
|
|
84
|
+
docs/_build/
|
|
85
|
+
|
|
86
|
+
# PyBuilder
|
|
87
|
+
.pybuilder/
|
|
88
|
+
target/
|
|
89
|
+
|
|
90
|
+
# Jupyter Notebook
|
|
91
|
+
.ipynb_checkpoints
|
|
92
|
+
|
|
93
|
+
# IPython
|
|
94
|
+
profile_default/
|
|
95
|
+
ipython_config.py
|
|
96
|
+
|
|
97
|
+
# pyenv
|
|
98
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
99
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
100
|
+
# .python-version
|
|
101
|
+
|
|
102
|
+
# pipenv
|
|
103
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
104
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
105
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
106
|
+
# install all needed dependencies.
|
|
107
|
+
#Pipfile.lock
|
|
108
|
+
|
|
109
|
+
# UV
|
|
110
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
111
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
112
|
+
# commonly ignored for libraries.
|
|
113
|
+
#uv.lock
|
|
114
|
+
|
|
115
|
+
# poetry
|
|
116
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
117
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
118
|
+
# commonly ignored for libraries.
|
|
119
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
120
|
+
#poetry.lock
|
|
121
|
+
|
|
122
|
+
# pdm
|
|
123
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
124
|
+
#pdm.lock
|
|
125
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
126
|
+
# in version control.
|
|
127
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
128
|
+
.pdm.toml
|
|
129
|
+
.pdm-python
|
|
130
|
+
.pdm-build/
|
|
131
|
+
|
|
132
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
133
|
+
__pypackages__/
|
|
134
|
+
|
|
135
|
+
# Celery stuff
|
|
136
|
+
celerybeat-schedule
|
|
137
|
+
celerybeat.pid
|
|
138
|
+
|
|
139
|
+
# SageMath parsed files
|
|
140
|
+
*.sage.py
|
|
141
|
+
|
|
142
|
+
# Environments
|
|
143
|
+
.env
|
|
144
|
+
.venv
|
|
145
|
+
env/
|
|
146
|
+
venv/
|
|
147
|
+
ENV/
|
|
148
|
+
env.bak/
|
|
149
|
+
venv.bak/
|
|
150
|
+
|
|
151
|
+
# Spyder project settings
|
|
152
|
+
.spyderproject
|
|
153
|
+
.spyproject
|
|
154
|
+
|
|
155
|
+
# Rope project settings
|
|
156
|
+
.ropeproject
|
|
157
|
+
|
|
158
|
+
# mkdocs documentation
|
|
159
|
+
/site
|
|
160
|
+
|
|
161
|
+
# mypy
|
|
162
|
+
.mypy_cache/
|
|
163
|
+
.dmypy.json
|
|
164
|
+
dmypy.json
|
|
165
|
+
|
|
166
|
+
# Pyre type checker
|
|
167
|
+
.pyre/
|
|
168
|
+
|
|
169
|
+
# pytype static type analyzer
|
|
170
|
+
.pytype/
|
|
171
|
+
|
|
172
|
+
# Cython debug symbols
|
|
173
|
+
cython_debug/
|
|
174
|
+
|
|
175
|
+
# PyCharm
|
|
176
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
177
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
178
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
179
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
180
|
+
#.idea/
|
|
181
|
+
|
|
182
|
+
# PyPI configuration file
|
|
183
|
+
.pypirc
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Alessio Lombardi
|
|
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.
|