Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 move to pdm and makefile deprecation #196

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 0 additions & 92 deletions gabarit/template_api/api_project/makefile

This file was deleted.

84 changes: 69 additions & 15 deletions gabarit/template_api/api_project/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,33 @@ dependencies = [
{%- endif %}
]

[tool.setuptools.packages.find]
include = ["{{package_name}}*"]

[project.optional-dependencies]
{%- if not gabarit_package_spec %}
artifactory = ["dohq-artifactory>=0.8,<1.0"]
{%- endif %}
[tool.pdm.dev-dependencies]
dev = [
"black>=19.0",
"isort>=4.3",
"httpx>=0.23,<1.0",
"pytest>=7.0,<8.0",
"pytest-cov>=3.0,<4.0",
"pytest>=7.0",
"pytest-asyncio>=0.21.0",
"pytest-cov>=3.0",
"ruff>=0.1.5",
"mypy>=1.4.1",
"httpx" # needed by fastapi
]
test = ["httpx>=0.23,<1.0", "pytest>=7.0,<8.0", "pytest-cov>=3.0,<4.0", "mypy>=1.4.1,<1.6",]

[tool.pdm]
[tool.pdm.scripts]
lint-code = "ruff check ."
format-code = "ruff format ."
test = "pytest --cov-report term-missing"
run = "./launch.sh"
build-d = "docker build -t {{package_name}} -f Dockerfile ."
run-d = "docker container run --rm -p 5000:5000 {{package_name}}"
run-d-it = "docker container run --rm -p 5000:5000 -i -t {{package_name}}"

[project.scripts]
download-model = "{{package_name}}.model:Model.download_model"

[tool.setuptools.packages.find]
include = ["{{package_name}}*"]

[tool.pytest.ini_options]
testpaths = ["tests"]
Expand All @@ -43,8 +55,50 @@ filterwarnings = [
"ignore:IPython could not be loaded!"
]

[project.scripts]
download-model = "{{package_name}}.core.resources:Model.download_model"
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".eggs",
".git",
".ruff_cache",
".venv",
"__pypackages__",
"build",
"dist",
"venv",
]

line-length = 120
# Same as Black.
indent-width = 4

# Assume Python 3.8
target-version = "py38"

[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
"UP", # pyupgrade
]
ignore = [
"E501", # line too long
"B904", # raise from in except clause
]

[tool.ruff.per-file-ignores]
"tests/conftest.py" = ["E402"]

[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

[tool.isort]
profile = "black"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false