pyscaffoldext.pre_commit_ruff package

Subpackages

Submodules

pyscaffoldext.pre_commit_ruff.extension module

Add pre-commit-ruff extension.

class pyscaffoldext.pre_commit_ruff.extension.PreCommitRuff(name: str | None = None)[source]

Bases: Extension

Generate pre-commit configuration file for Ruff (includes –pre-commit).

activate(actions: list[Callable[[Dict[str, str | None | Callable[[Dict[str, Any]], str | None] | Template | Tuple[str | None | Callable[[Dict[str, Any]], str | None] | Template, Callable[[Path, str | None, Dict[str, Any]], Path | None]] | dict], Dict[str, Any]], Tuple[Dict[str, str | None | Callable[[Dict[str, Any]], str | None] | Template | Tuple[str | None | Callable[[Dict[str, Any]], str | None] | Template, Callable[[Path, str | None, Dict[str, Any]], Path | None]] | dict], Dict[str, Any]]]]) list[Callable[[Dict[str, str | None | Callable[[Dict[str, Any]], str | None] | Template | Tuple[str | None | Callable[[Dict[str, Any]], str | None] | Template, Callable[[Path, str | None, Dict[str, Any]], Path | None]] | dict], Dict[str, Any]], Tuple[Dict[str, str | None | Callable[[Dict[str, Any]], str | None] | Template | Tuple[str | None | Callable[[Dict[str, Any]], str | None] | Template, Callable[[Path, str | None, Dict[str, Any]], Path | None]] | dict], Dict[str, Any]]]][source]

Activates See pyscaffold.extension.Extension.activate.

Parameters:

actions (list) – list of actions to perform

Returns:

updated list of actions

Return type:

list

augment_cli(parser: ArgumentParser)[source]

Augments the command-line interface parser.

See augment_cli.

pyscaffoldext.pre_commit_ruff.extension.add_files(struct: Dict[str, str | None | Callable[[Dict[str, Any]], str | None] | Template | Tuple[str | None | Callable[[Dict[str, Any]], str | None] | Template, Callable[[Path, str | None, Dict[str, Any]], Path | None]] | dict], opts: Dict[str, Any]) Tuple[Dict[str, str | None | Callable[[Dict[str, Any]], str | None] | Template | Tuple[str | None | Callable[[Dict[str, Any]], str | None] | Template, Callable[[Path, str | None, Dict[str, Any]], Path | None]] | dict], Dict[str, Any]][source]

Replace .pre-commit-config.yaml. Update setup.cfg and pyproject.toml.

Add mypy section to setup.cfg. Remove flake8 section from setup.cfg. Ruff replaces flake8.

Add ruff configuration to pyproject.toml.

pyscaffoldext.pre_commit_ruff.extension.add_setupcfg(setupcfg: ConfigUpdater, opts) ConfigUpdater[source]

Add section(s) to setup.cfg.

pyscaffoldext.pre_commit_ruff.extension.modify_pyproject(opts: Dict[str, Any], content: str | None | Callable[[Dict[str, Any]], str | None] | Template, file_op: Callable[[Path, str | None, Dict[str, Any]], Path | None]) Tuple[str | None | Callable[[Dict[str, Any]], str | None] | Template, Callable[[Path, str | None, Dict[str, Any]], Path | None]][source]

Add Ruff configuration to pyproject.toml.

pyscaffoldext.pre_commit_ruff.extension.modify_setupcfg(definition: str | None | Callable[[Dict[str, Any]], str | None] | Template | Tuple[str | None | Callable[[Dict[str, Any]], str | None] | Template, Callable[[Path, str | None, Dict[str, Any]], Path | None]] | dict, opts: Dict[str, Any]) Tuple[str | None | Callable[[Dict[str, Any]], str | None] | Template, Callable[[Path, str | None, Dict[str, Any]], Path | None]][source]

Modify setup.cfg to add template settings before it is written.

See pyscaffold.operations.

Module contents

Extend PyScaffold with –pre-commit-ruff.