Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .template.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Autogenerated - DO NOT EDIT
# Parameters of the project as generated from template
_commit: 3bb6f60
_commit: 33b991b
_src_path: gh:kraysent/python-template
project_name: db_app
25 changes: 21 additions & 4 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ install-dev:
uv sync --all-extras

check:
@output=$$(copier check-update --answers-file .template.yaml 2>&1) || true; \
if echo "$$output" | grep -q "up-to-date"; then \
true; \
elif echo "$$output" | grep -q "New template version"; then \
echo "Template update available, run make update-template"; \
else \
echo "$$output"; \
fi
@find . \
-name "*.py" \
-not -path "./.venv/*" \
Expand All @@ -17,6 +25,10 @@ check:
@uvx ruff check \
--quiet \
--config=pyproject.toml
@uv run pytest \
--quiet \
--config-file=pyproject.toml \
tests/env_test.py tests/unit

fix:
@uvx ruff format \
Expand All @@ -32,6 +44,15 @@ build:
docker build . \
--platform linux/arm64

new-branch:
@read -p "Branch name: " branch_name && \
branch_name=$${branch_name// /-} && \
base=$$(git remote show origin | sed -n '/HEAD branch/s/.*: //p') && \
echo "Selecting $$base branch as default" && \
git fetch origin $$base && \
git checkout -b $$branch_name origin/$$base && \
git push -u origin $$branch_name

update-template:
copier update \
--skip-answered \
Expand Down Expand Up @@ -96,10 +117,6 @@ cleanup:
## Testing

# pytest is used to run unittest test cases
test: check
uv run pytest --config-file=pyproject.toml tests/env_test.py
uv run pytest --config-file=pyproject.toml tests/unit

test-all: check
@uv run pytest \
--config-file=pyproject.toml \
Expand Down
16 changes: 10 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ test = [
"testcontainers-postgres>=0.0.1rc1",
]

[tool.pytest.ini_options]
pythonpath = ["."]
addopts = "-W ignore::DeprecationWarning"
testpaths = ["tests"]

[tool.ruff]
line-length = 120
src = ["."]

[tool.ruff.format]
docstring-code-format = true
Expand Down Expand Up @@ -86,18 +92,16 @@ select = [
"PLE",
"FLY",
"NPY201",
"ARG001"
"ARG001",
"PLC0415",
"S101",
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"F403", # ignore star imports warning in __init__ files
]

[tool.pytest.ini_options]
pythonpath = ["."]
addopts = "-W ignore::DeprecationWarning"
testpaths = ["tests"]
"tests/**" = ["S101"]

[[tool.mypy.overrides]]
module = "astropy.*"
Expand Down
11 changes: 0 additions & 11 deletions tests/env_test.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
import sys
import unittest

from parameterized import parameterized

import app.commands.adminapi.command as adminapi
import app.commands.dataapi.command as dataapi

MINIMAL_PYTHON_VERSION = (3, 10)


class TestEnvironment(unittest.TestCase):
def test_python_version(self):
self.assertGreaterEqual(
sys.version_info,
MINIMAL_PYTHON_VERSION,
msg=f"You are using Python with version {'.'.join(map(str, sys.version_info))}"
f"while minimally supported version is {'.'.join(map(str, MINIMAL_PYTHON_VERSION))}",
)

@parameterized.expand(
[
("configs/dev/adminapi.yaml"),
Expand Down
Loading