diff --git a/.template.yaml b/.template.yaml index a023b440..f8c8b1fc 100644 --- a/.template.yaml +++ b/.template.yaml @@ -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 diff --git a/makefile b/makefile index 6be17313..e20ac83d 100644 --- a/makefile +++ b/makefile @@ -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/*" \ @@ -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 \ @@ -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 \ @@ -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 \ diff --git a/pyproject.toml b/pyproject.toml index eef2dc31..dd1d7610 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 @@ -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.*" diff --git a/tests/env_test.py b/tests/env_test.py index 935bf596..1e67ef58 100644 --- a/tests/env_test.py +++ b/tests/env_test.py @@ -1,4 +1,3 @@ -import sys import unittest from parameterized import parameterized @@ -6,18 +5,8 @@ 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"),