Files
project-manager/project_manager/preset/default/python.toml
T

55 lines
1.7 KiB
TOML

[presets.python]
conditions = ["file(pyproject.toml)"]
[presets.python.tasks.setup.poetry]
conditions = [
"file(pyproject.toml) | get(build-system.build-backend) | equal(poetry.core.masonry.api)",
]
variables.python_version = "file(pyproject.toml) | get(project.requires-python) | search((\\d+.\\d+))"
commands = [
"poetry env use {python_version}",
"poetry install",
]
[presets.python.tasks.build.poetry]
conditions = [
"file(pyproject.toml) | get(build-system.build-backend) | equal(poetry.core.masonry.api)",
]
commands = ["poetry build"]
[presets.python.tasks.publish.poetry]
conditions = [
"file(pyproject.toml) | get(build-system.build-backend) | equal(poetry.core.masonry.api)",
"file(poetry.toml) | get(repositories)",
]
variables.python_repository = "file(poetry.toml) | get(repositories) | key(0)"
commands = ["poetry publish -r {python_repository}"]
[presets.python.tasks.test.pytest]
conditions = ["file(.venv/bin/pytest)"]
commands = [".venv/bin/python -m pytest"]
[presets.python.tasks.lint.pylint]
conditions = ["file(.venv/bin/pylint)"]
commands = [".venv/bin/pylint ./"]
[presets.python.tasks.lint.isort]
conditions = ["file(.venv/bin/isort)"]
commands = [".venv/bin/isort --profile black --check-only ./"]
[presets.python.tasks.format.isort]
conditions = ["file(.venv/bin/isort)"]
commands = [".venv/bin/isort --profile black ./"]
[presets.python.tasks.lint.black]
conditions = ["file(.venv/bin/black)"]
commands = [".venv/bin/black --check --diff ./"]
[presets.python.tasks.format.black]
conditions = ["file(.venv/bin/black)"]
commands = [".venv/bin/black ./"]
[presets.python.tasks.clean.venv]
conditions = ["file(.venv)"]
commands = ["rm -rf .venv"]