Commit 23d4640d authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

Replace Black with Ruff for Python formatting

parent 1744c28d
Loading
Loading
Loading
Loading
+1
Changes for .gitignore: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,5 +2,6 @@
__pycache__/
*.py[cod]
.pytest_cache/
.ruff_cache/
dist/
*.egg-info/
+6 −6
Changes for Makefile: 6 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -33,13 +33,13 @@ test: ## Run integration tests against an automatically managed temporary server
test-live: ## Run tests against an existing server configured with CIRCE_* variables
	$(UV) run --locked pytest test.py $(TEST_ARGS)

format: ## Format Python sources, tests and scripts with Black
	$(UV) run --locked black circe test.py scripts
format: ## Format Python sources, tests and scripts with Ruff
	$(UV) run --locked ruff format circe test.py scripts

format-check: ## Check Python formatting without changing files
	$(UV) run --locked black --check circe test.py scripts
	$(UV) run --locked ruff format --check circe test.py scripts

check: lock-check test ## Check the lockfile and run integration tests
check: lock-check format-check test ## Check the lockfile, formatting and integration tests

serve: ## Start the HTTP server (accepts CIRCE_ARGS and CIRCE_* variables)
	$(UV) run --locked --no-dev circe serve $(CIRCE_ARGS)
@@ -50,5 +50,5 @@ workers: ## Start transformation workers (accepts CIRCE_ARGS and CIRCE_* variabl
run: ## Start the HTTP server and workers (accepts CIRCE_ARGS and CIRCE_* variables)
	$(UV) run --locked --no-dev circe run $(CIRCE_ARGS)

clean: ## Remove distribution artifacts and the local pytest cache
	rm -rf dist .pytest_cache
clean: ## Remove distribution artifacts and local pytest and Ruff caches
	rm -rf dist .pytest_cache .ruff_cache
+2 −2
Changes for README.md: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -140,10 +140,10 @@ uv doit être installé au préalable. Les principales commandes sont:
    make setup-prod    # dépendances du service uniquement
    make build         # distributions source et wheel dans dist/
    make test          # tests avec un serveur temporaire isolé
    make check         # vérification du verrou et tests
    make check         # vérification du verrou, du formatage et tests
    make run           # service HTTP et workers

`make format` applique Black et `make format-check` vérifie le formatage.
`make format` applique le formateur Ruff et `make format-check` vérifie le formatage.
`make lock` actualise `uv.lock` après modification des dépendances.
Les variables `UV`, `TEST_ARGS` et `CIRCE_ARGS` sont configurables, par exemple:

+14 −5
Changes for circe/__init__.py: 14 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -292,7 +292,9 @@ if CONFIG["CIRCE_ENABLE_WEB_UI"]:
            response.add_cookie("sess", signed.decode("UTF-8"))
            response.cookies.get_cookie("sess").httponly = True
            response.cookies.get_cookie("sess").samesite = "Strict"
            response.cookies.get_cookie("sess").secure = CONFIG["CIRCE_WEB_UI_SECURE_COOKIE"]
            response.cookies.get_cookie("sess").secure = CONFIG[
                "CIRCE_WEB_UI_SECURE_COOKIE"
            ]
            return response

    @server.route("/upload/", methods=["POST", "GET"])
@@ -393,7 +395,16 @@ def serve(
    """
    _check_port(host, port)
    working_directory = os.getcwd()
    app_args = ["sanic", "circe.server","-H", str(host), "-w", str(workers), "-p", str(port)]
    app_args = [
        "sanic",
        "circe.server",
        "-H",
        str(host),
        "-w",
        str(workers),
        "-p",
        str(port),
    ]
    if debug:
        app_args.append("--dev")
    if access_log:
@@ -507,9 +518,7 @@ def make_api_access(
    return """Access granted to {}
uuid    : {}
secret: {}
    """.format(
        title, app_uuid.hex, secret
    )
    """.format(title, app_uuid.hex, secret)


def list_api_access():
+1 −1
Changes for pyproject.toml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ dependencies = [
]

[dependency-groups]
dev = ["black", "circe-client-CERTIC", "pytest"]
dev = ["ruff", "circe-client-CERTIC", "pytest"]

[project.scripts]
circe = "circe.__main__:run_cli"
Loading