chore: Update everything
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
---
|
||||
applyTo: "*.py"
|
||||
---
|
||||
|
||||
- Do not be chatty, do not summarize the code afterwards.
|
||||
- Use `#!/usr/bin/env -S uv run --script` as the shebang line.
|
||||
- Add dependencies under the shebang line as
|
||||
|
||||
```
|
||||
# /// script
|
||||
# dependencies = [list of external dependencies as json array]
|
||||
# ///
|
||||
```
|
||||
|
||||
and keep them updated as the code changes.
|
||||
|
||||
- Keep comments to minimum
|
||||
- Use `uv` for package management.
|
||||
- Use logging instead of print statements. Use `logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s: %(message)s")` for configuration.
|
||||
- Use argparse for command-line arguments, keep argument parsing in a func called `parse_args() -> argparse.Namespace`, which gets called from `main`. Use `argparse.ArgumentDefaultsHelpFormatter` for the formatter class.
|
||||
- Use `pathlib.Path` for file operations. When the CLI args include a path, set its `type=Path`
|
||||
- Place imports at the top of the file.
|
||||
- Use httpx for HTTP requests. Do not use async.
|
||||
- Always add type annotations to function signatures, prefer built-in types, e.g. `list[str]` over `typing` module types when possible.
|
||||
- Prefer kwargs calling style for function calls, e.g. `func(arg1=value1, arg2=value2)` instead of `func(value1, value2)`.
|
||||
- Use `Path.cwd()` for the current working directory.
|
||||
- Prefer `os.getenv` over `os.environ.get` for environment variables.
|
||||
- Use `subprocess.run` for running shell commands, prefer `check=True` to raise an error on failure.
|
||||
- Use `tempfile.TemporaryDirectory()` for temporary directories.
|
||||
- Do not shorten parameter names unnecessarily, unless it's an idiomatic abbreviation.
|
||||
- Use f-strings for string formatting.
|
||||
- When calling an external command, use the long form of the arguments, e.g. `--output` instead of `-o`.
|
||||
Reference in New Issue
Block a user