mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-04 06:32:29 -06:00
Allow to run CI checks locally
Now the developer is able to run the checks easily and locally (by following the instructions in nova3/README.md). PR #23262.
This commit is contained in:
4
src/searchengine/.gitignore
vendored
Normal file
4
src/searchengine/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
*.egg-info
|
||||
*.lock
|
||||
*.pyc
|
||||
*.pyi
|
||||
46
src/searchengine/nova3/README.md
Normal file
46
src/searchengine/nova3/README.md
Normal file
@@ -0,0 +1,46 @@
|
||||
nova3 Engine
|
||||
===
|
||||
|
||||
## Development Workflow
|
||||
|
||||
0. Prerequisite
|
||||
|
||||
* A Linux-like environment
|
||||
* [Python](https://www.python.org/) installed
|
||||
* [uv](https://docs.astral.sh/uv/) installed
|
||||
|
||||
1. Setup development environment
|
||||
|
||||
1. Setup virtual environment and dependencies
|
||||
```shell
|
||||
uv sync
|
||||
```
|
||||
|
||||
2. Activate virtual environment
|
||||
```shell
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
2. Run type check
|
||||
|
||||
```shell
|
||||
just check
|
||||
```
|
||||
|
||||
3. Run static analyzer
|
||||
|
||||
```shell
|
||||
just lint
|
||||
```
|
||||
|
||||
4. Apply formatting
|
||||
|
||||
```shell
|
||||
just format
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
* [How to write a search plugin](https://github.com/qbittorrent/search-plugins/wiki/How-to-write-a-search-plugin)
|
||||
* [just - Command runner](https://just.systems/man/en/)
|
||||
* [uv - Python package and project manager](https://docs.astral.sh/uv/)
|
||||
54
src/searchengine/nova3/justfile
Normal file
54
src/searchengine/nova3/justfile
Normal file
@@ -0,0 +1,54 @@
|
||||
PY_FILES := `find . -maxdepth 1 -type f -name '*.py' ! -name 'socks.py' -printf '%P '`
|
||||
|
||||
# Show available recipes to run
|
||||
default:
|
||||
just --list
|
||||
|
||||
# Run type check
|
||||
check files=PY_FILES: fetch_aux
|
||||
mypy \
|
||||
{{ files }}
|
||||
pyright \
|
||||
{{ files }}
|
||||
|
||||
# Byte-compile files
|
||||
build files=PY_FILES:
|
||||
python \
|
||||
-m compileall \
|
||||
{{ files }}
|
||||
|
||||
# Fetch auxiliary files
|
||||
[private]
|
||||
fetch_aux:
|
||||
#!/usr/bin/sh
|
||||
if [ ! -f 'socks.pyi' ]; then
|
||||
curl -L -o socks.pyi "https://github.com/python/typeshed/raw/refs/heads/main/stubs/PySocks/socks.pyi"
|
||||
fi
|
||||
|
||||
# Apply formatting
|
||||
format files=PY_FILES:
|
||||
pycodestyle \
|
||||
--ignore=E265,E402 \
|
||||
--max-line-length=1000 \
|
||||
--statistics \
|
||||
{{ files }}
|
||||
isort \
|
||||
--line-length 1000 \
|
||||
{{ files }}
|
||||
just \
|
||||
--fmt \
|
||||
--unstable
|
||||
|
||||
# Run static analyzer
|
||||
lint files=PY_FILES:
|
||||
pyflakes \
|
||||
{{ files }}
|
||||
bandit \
|
||||
--skip B110,B310,B314,B405 \
|
||||
{{ files }}
|
||||
|
||||
# Run tests
|
||||
test files='tests/*.py': fetch_aux
|
||||
pytest \
|
||||
--showlocals \
|
||||
{{ files }}
|
||||
25
src/searchengine/nova3/pyproject.toml
Normal file
25
src/searchengine/nova3/pyproject.toml
Normal file
@@ -0,0 +1,25 @@
|
||||
[project]
|
||||
name = "qBittorrent-search-engine"
|
||||
description = "Search engine for qBittorrent search feature"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.9"
|
||||
dynamic = ["version"]
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"bandit",
|
||||
"isort",
|
||||
"mypy",
|
||||
"pycodestyle",
|
||||
"pyflakes",
|
||||
"pyright",
|
||||
"pytest",
|
||||
"rust-just",
|
||||
]
|
||||
|
||||
[tool.mypy]
|
||||
explicit_package_bases = true
|
||||
strict = true
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["./"]
|
||||
Reference in New Issue
Block a user