diff --git a/CHANGES.md b/CHANGES.md index 78d87c8..c4595fe 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,9 @@ ## 0.8 (unreleased) -- Nothing changed yet. +- Removed old `test.yml`. +- Documented `--no-cov` for vscode when debugging inside tests. +- Fixed exclusion of tests/ files in the distribution. ## 0.7 (2025-09-16) diff --git a/django/{{ cookiecutter.project_name }}/.github/workflows/test.yml b/django/{{ cookiecutter.project_name }}/.github/workflows/test.yml deleted file mode 120000 index fb494e7..0000000 --- a/django/{{ cookiecutter.project_name }}/.github/workflows/test.yml +++ /dev/null @@ -1 +0,0 @@ -../../../../{{ cookiecutter.project_name }}/.github/workflows/test.yml \ No newline at end of file diff --git a/symlink_into_django_template.py b/symlink_into_django_template.py index 29060e0..372ac29 100644 --- a/symlink_into_django_template.py +++ b/symlink_into_django_template.py @@ -40,8 +40,17 @@ def create_symlinks(filenames: list[str]) -> bool: return changed_something +def check_for_dead_symlinks(): + for root, dirs, files in Path("django").walk(): + d = Path(root) # d = directory + for f in files: # f = file + if not (d / f).exists(): + print(f"BROKEN symlink '{d / f}'") + + if __name__ == "__main__": changed_something = create_symlinks(python_files()) if changed_something: # Exit with error code: that way we can be run as check in a github action. sys.exit("Some symlinks were created") + check_for_dead_symlinks() diff --git a/uv.lock b/uv.lock index 431f5e1..87de778 100644 --- a/uv.lock +++ b/uv.lock @@ -138,7 +138,7 @@ wheels = [ [[package]] name = "cookiecutter-python-template" -version = "0.7.dev0" +version = "0.8.dev0" source = { virtual = "." } dependencies = [ { name = "cookiecutter" }, diff --git a/{{ cookiecutter.project_name }}/.github/workflows/nens-meta.yml b/{{ cookiecutter.project_name }}/.github/workflows/nens-meta.yml index 601c868..393c149 100644 --- a/{{ cookiecutter.project_name }}/.github/workflows/nens-meta.yml +++ b/{{ cookiecutter.project_name }}/.github/workflows/nens-meta.yml @@ -22,9 +22,9 @@ jobs: name: nens-meta runs-on: "ubuntu-latest" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: 3.12 - uses: pre-commit/action@v3.0.1 diff --git a/{{ cookiecutter.project_name }}/.github/workflows/test.yml b/{{ cookiecutter.project_name }}/.github/workflows/test.yml deleted file mode 100644 index bd16ac3..0000000 --- a/{{ cookiecutter.project_name }}/.github/workflows/test.yml +++ /dev/null @@ -1,44 +0,0 @@ -{% raw -%}name: Linux - -# Run on PR requests. And on master itself. -on: - push: - branches: - - master - pull_request: - -jobs: - TestLinux: - name: Linux, Python ${{ matrix.python }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - # 2022 - - python: "3.10" - pins: "" - # 2023 - - python: "3.11" - pins: "" - # 2023 - - python: "3.12" - pins: "" - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - - - name: Install python dependencies - run: | - pip install --disable-pip-version-check --upgrade pip setuptools - pip install -e .[test] ${{ matrix.pins }} - pip list - - - name: Run tests - run: pytest --cov -{% endraw -%} diff --git a/{{ cookiecutter.project_name }}/MANIFEST.in b/{{ cookiecutter.project_name }}/MANIFEST.in index 326e7d0..6cbc083 100644 --- a/{{ cookiecutter.project_name }}/MANIFEST.in +++ b/{{ cookiecutter.project_name }}/MANIFEST.in @@ -1,3 +1,3 @@ # setuptools_scm automatically includes all git-managed files. You can include/exclude # extra files here. -exclude tests/ +recursive-exclude tests/ diff --git a/{{ cookiecutter.project_name }}/README.md b/{{ cookiecutter.project_name }}/README.md index 17a016a..0de4233 100644 --- a/{{ cookiecutter.project_name }}/README.md +++ b/{{ cookiecutter.project_name }}/README.md @@ -11,11 +11,11 @@ See [nens-meta's documentation](https://nens-meta.readthedocs.io) for an explana The standard commands apply: - $ uv sync - $ uv run pytest - $ uv run python # You can also activate the virtualenv in .venv - $ pre-commit run --all # You can also do 'pre-commit install' - $ uv add some-dependency + uv sync # Yes, add 'uv.lock' to git afterwards! + uv run pytest + uv run python # You can also activate the virtualenv in .venv + pre-commit run --all # You can also do 'pre-commit install' + uv add some-dependency `uv` replaces pip/venv/requirement.txt/pip-tools. `pre-commit` does basic formatting. @@ -36,11 +36,18 @@ If you need a new dependency (like `requests`), add it in Note: "public" means "don't put customer data or sample data with real persons' addresses on github"! -- Follow the steps you then see (from "git init" to "git push origin main") - and your code will be online. +- Push your project to github (note: the current instructions on github only add the README, but we want to add all files): + + git init + git add -A + git commit -m "Generated with cookiecutter" + git branch -M main + git remote add origin https://github.com/nens/{{ cookiecutter.project_name }}.git + # git remote add origin git@github.com:nens/{{ cookiecutter.project_name }}.git # If you use ssh + git push -u origin main - Go to - https://github.com/nens/>{{ cookiecutter.project_name }}/settings/collaboration + https://github.com/nens/{{ cookiecutter.project_name }}/settings/access and add the teams with write access (you might have to ask someone with admin rights (like Reinout) to do it). diff --git a/{{ cookiecutter.project_name }}/pyproject.toml b/{{ cookiecutter.project_name }}/pyproject.toml index 31ecddf..0280198 100644 --- a/{{ cookiecutter.project_name }}/pyproject.toml +++ b/{{ cookiecutter.project_name }}/pyproject.toml @@ -23,6 +23,8 @@ homepage = "https://github.com/nens/{{ cookiecutter.project_name }}" [tool.pytest.ini_options] addopts = "--cov --cov-fail-under=80" +# Debugging tests in vscode? Run pytest with "--no-cov", see +# https://pytest-cov.readthedocs.io/en/latest/debuggers.html [tool.zest-releaser] release = false @@ -47,4 +49,6 @@ venvPath = "." venv = ".venv" [dependency-groups] +# The "dev" group is automatically installed by uv. When using pip, +# do something like "pip install -e . --group test". dev = ["pytest>=8.4.2", "pytest-cov>=6.3.0", "pytest-sugar>=1.1.1"]