From 127ea1c11fffde23866c86e218a493f699929adf Mon Sep 17 00:00:00 2001 From: tsmorz Date: Wed, 26 Nov 2025 14:48:06 +0100 Subject: [PATCH 1/8] add cookiecutter.json --- cookiecutter.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 cookiecutter.json diff --git a/cookiecutter.json b/cookiecutter.json new file mode 100644 index 0000000..57dc966 --- /dev/null +++ b/cookiecutter.json @@ -0,0 +1,11 @@ +{ + "repo_name": "template-python", + "module_name": "change_me", + "package_name": "{{ cookiecutter.repo_name }}", + "org_name": "TUM-Aries-Lab", + "description": "Basic description for the repo.", + "author_name": "Tony Smoragiewicz", + "author_email": "tony.smoragiewicz@tum.de", + "python_version": "3.12", + "version": "0.0.1" +} From 5112008380be3c92405f81cfd087c9a452037304 Mon Sep 17 00:00:00 2001 From: Tony Smoragiewicz <83112082+Tsmorz@users.noreply.github.com> Date: Wed, 26 Nov 2025 17:25:03 +0100 Subject: [PATCH 2/8] Create repo_tree.py --- repo_tree.py | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 repo_tree.py diff --git a/repo_tree.py b/repo_tree.py new file mode 100644 index 0000000..3f35260 --- /dev/null +++ b/repo_tree.py @@ -0,0 +1,144 @@ +#!/usr/bin/env python3 +"""Generate a Markdown tree of the project directory. + +Usage: + python repo_tree.py + python repo_tree.py --update-readme +""" + +from __future__ import annotations + +import argparse +import fnmatch +from pathlib import Path + +from loguru import logger + +START_MARKER = "" +END_MARKER = "" + +# Manual ignores are still allowed +MANUAL_IGNORE = { + ".git", + ".venv", + "__pycache__", + ".mypy_cache", + ".pytest_cache", + ".ruff_cache", + ".DS_Store", + "data", + "simulink", + ".github", +} + + +def load_gitignore_patterns(path: Path) -> list[str]: + """Load patterns from .gitignore.""" + gitignore = path / ".gitignore" + if not gitignore.exists(): + return [] + + patterns: list[str] = [] + for line in gitignore.read_text().splitlines(): + line_str = line.strip() + if not line_str or line_str.startswith("#"): + continue + patterns.append(line_str) + return patterns + + +def is_ignored(path: Path, patterns: list[str]) -> bool: + """Return True if path matches any ignore pattern. + + Supports: + - literal names + - wildcard patterns + - directory patterns (e.g. logs/) + """ + name = path.name + + # Manual ignores first + if name in MANUAL_IGNORE: + return True + + for pattern in patterns: + # Directory ignore + if pattern.endswith("/") and path.is_dir(): + if fnmatch.fnmatch(name + "/", pattern): + return True + + # File/directory wildcard + if fnmatch.fnmatch(name, pattern): + return True + + return False + + +def build_tree(path: Path, patterns: list[str], prefix: str = "") -> list[str]: + """Recursively build a tree representation.""" + entries = sorted( + [p for p in path.iterdir() if not is_ignored(p, patterns)], + key=lambda x: (x.is_file(), x.name), + ) + + lines: list[str] = [] + + for i, entry in enumerate(entries): + connector = "└── " if i == len(entries) - 1 else "├── " + + lines.append(f"{prefix}{connector}{entry.name}") + + if entry.is_dir(): + extension = " " if i == len(entries) - 1 else "│ " + lines.extend(build_tree(entry, patterns, prefix + extension)) + + return lines + + +def generate_markdown_tree() -> str: + """Return the full markdown tree as a formatted code block.""" + root = Path(".").resolve() + + gitignore_patterns = load_gitignore_patterns(root) + tree_lines = build_tree(root, gitignore_patterns) + tree_text = "\n".join(tree_lines) + + return f"```\n{tree_text}\n```" + + +def update_readme_block(readme_path: Path) -> None: + """Replace the section between markers with the generated tree.""" + readme = readme_path.read_text().splitlines() + + if START_MARKER not in readme or END_MARKER not in readme: + raise RuntimeError( + f"README.md must contain '{START_MARKER}' and '{END_MARKER}' markers." + ) + + start = readme.index(START_MARKER) + 1 + end = readme.index(END_MARKER) + + tree = generate_markdown_tree().splitlines() + + new_readme = readme[:start] + tree + readme[end:] + readme_path.write_text("\n".join(new_readme)) + + logger.success( + "✅ README updated with latest repo tree (gitignored files excluded)." + ) + + +def main() -> None: + """Create a Markdown tree of the project directory.""" + parser = argparse.ArgumentParser() + parser.add_argument("--update-readme", action="store_true") + args = parser.parse_args() + + if args.update_readme: + update_readme_block(Path("README.md")) + else: + logger.info(generate_markdown_tree()) + + +if __name__ == "__main__": + main() From 7d8bb019757833b3726dcc3fc8165898158885b2 Mon Sep 17 00:00:00 2001 From: Tony Smoragiewicz <83112082+Tsmorz@users.noreply.github.com> Date: Wed, 26 Nov 2025 17:26:31 +0100 Subject: [PATCH 3/8] Update Makefile with tree command --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 83b5c82..7db7421 100644 --- a/Makefile +++ b/Makefile @@ -46,3 +46,6 @@ docker: app: uv run python -m change_me + +tree: + uv run python repo_tree.py --update-readme From 68beb3ad515760af23827623b0a8c734f22fb092 Mon Sep 17 00:00:00 2001 From: Tony Smoragiewicz <83112082+Tsmorz@users.noreply.github.com> Date: Wed, 26 Nov 2025 17:27:12 +0100 Subject: [PATCH 4/8] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index aadca7f..6d654db 100644 --- a/README.md +++ b/README.md @@ -54,3 +54,7 @@ if __name__ == "__main__": ```bash uv run python -m change_me ``` + +## Structure + + From 51eb9ea4dc270b7c5a7b7896bcf090d16e49f1a3 Mon Sep 17 00:00:00 2001 From: Tony Smoragiewicz <83112082+Tsmorz@users.noreply.github.com> Date: Wed, 26 Nov 2025 17:27:59 +0100 Subject: [PATCH 5/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6d654db..c282131 100644 --- a/README.md +++ b/README.md @@ -56,5 +56,6 @@ uv run python -m change_me ``` ## Structure +The following tree shows the important permament files. From d65d2af27982432648b87bbe2c7c96193a7ca9db Mon Sep 17 00:00:00 2001 From: tsmorz Date: Thu, 27 Nov 2025 00:45:50 +0100 Subject: [PATCH 6/8] update readme with tree --- README.md | 27 ++++++++++++++++++++++++++- src/change_me/config/__init__.py | 1 - 2 files changed, 26 insertions(+), 2 deletions(-) delete mode 100644 src/change_me/config/__init__.py diff --git a/README.md b/README.md index c282131..3a8c6db 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,31 @@ uv run python -m change_me ``` ## Structure -The following tree shows the important permament files. +The following tree shows the important permanent files. +``` +├── src +│ └── change_me +│ ├── __init__.py +│ ├── __main__.py +│ ├── definitions.py +│ └── utils.py +├── tests +│ ├── __init__.py +│ ├── conftest.py +│ ├── main_test.py +│ └── utils_test.py +├── .dockerignore +├── .gitignore +├── .pre-commit-config.yaml +├── .python-version +├── CONTRIBUTING.md +├── Dockerfile +├── LICENSE +├── Makefile +├── README.md +├── pyproject.toml +├── repo_tree.py +└── uv.lock +``` diff --git a/src/change_me/config/__init__.py b/src/change_me/config/__init__.py deleted file mode 100644 index a22f654..0000000 --- a/src/change_me/config/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Sample doc string.""" From bbb5381a8365cb09877f4e18ebb4bff30be2bf81 Mon Sep 17 00:00:00 2001 From: tsmorz Date: Thu, 27 Nov 2025 10:10:47 +0100 Subject: [PATCH 7/8] update with cookiecutter --- cookiecutter.json | 6 +- .../.dockerignore | 0 .../ISSUE_TEMPLATE/feature_request.md | 0 .../.github}/PULL_REQUEST_TEMPLATE.md | 0 .../.github}/workflows/ci.yml | 2 + .../.github}/workflows/docker.yml | 35 ++-- {{ cookiecutter.repo_name }}/.gitignore | 172 ++++++++++++++++++ .../.pre-commit-config.yaml | 0 .../.python-version | 0 .../CONTRIBUTING.md | 0 .../Dockerfile | 2 +- .../LICENSE | 0 .../Makefile | 6 +- .../README.md | 31 +++- .../pyproject.toml | 2 +- .../repo_tree.py | 0 .../__init__.py | 0 .../__main__.py | 3 +- .../definitions.py | 0 .../{{ cookiecutter.module_name }}}/utils.py | 3 +- .../tests}/__init__.py | 0 .../tests}/conftest.py | 0 .../tests}/main_test.py | 2 +- .../tests}/utils_test.py | 4 +- .../uv.lock | 0 25 files changed, 230 insertions(+), 38 deletions(-) rename .dockerignore => {{ cookiecutter.repo_name }}/.dockerignore (100%) rename {.github => {{ cookiecutter.repo_name }}/.github}/ISSUE_TEMPLATE/feature_request.md (100%) rename {.github => {{ cookiecutter.repo_name }}/.github}/PULL_REQUEST_TEMPLATE.md (100%) rename {.github => {{ cookiecutter.repo_name }}/.github}/workflows/ci.yml (99%) rename {.github => {{ cookiecutter.repo_name }}/.github}/workflows/docker.yml (72%) create mode 100644 {{ cookiecutter.repo_name }}/.gitignore rename .pre-commit-config.yaml => {{ cookiecutter.repo_name }}/.pre-commit-config.yaml (100%) rename .python-version => {{ cookiecutter.repo_name }}/.python-version (100%) rename CONTRIBUTING.md => {{ cookiecutter.repo_name }}/CONTRIBUTING.md (100%) rename Dockerfile => {{ cookiecutter.repo_name }}/Dockerfile (95%) rename LICENSE => {{ cookiecutter.repo_name }}/LICENSE (100%) rename Makefile => {{ cookiecutter.repo_name }}/Makefile (82%) rename README.md => {{ cookiecutter.repo_name }}/README.md (65%) rename pyproject.toml => {{ cookiecutter.repo_name }}/pyproject.toml (96%) rename repo_tree.py => {{ cookiecutter.repo_name }}/repo_tree.py (100%) rename {src/change_me => {{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}}/__init__.py (100%) rename {src/change_me => {{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}}/__main__.py (99%) rename {src/change_me => {{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}}/definitions.py (100%) rename {src/change_me => {{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}}/utils.py (99%) rename {tests => {{ cookiecutter.repo_name }}/tests}/__init__.py (100%) rename {tests => {{ cookiecutter.repo_name }}/tests}/conftest.py (100%) rename {tests => {{ cookiecutter.repo_name }}/tests}/main_test.py (65%) rename {tests => {{ cookiecutter.repo_name }}/tests}/utils_test.py (81%) rename uv.lock => {{ cookiecutter.repo_name }}/uv.lock (100%) diff --git a/cookiecutter.json b/cookiecutter.json index 57dc966..7f0c496 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,7 +1,7 @@ { - "repo_name": "template-python", - "module_name": "change_me", - "package_name": "{{ cookiecutter.repo_name }}", + "repo_name": "temp-python", + "module_name": "new-repo", + "package_name": "new_repo", "org_name": "TUM-Aries-Lab", "description": "Basic description for the repo.", "author_name": "Tony Smoragiewicz", diff --git a/.dockerignore b/{{ cookiecutter.repo_name }}/.dockerignore similarity index 100% rename from .dockerignore rename to {{ cookiecutter.repo_name }}/.dockerignore diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/{{ cookiecutter.repo_name }}/.github/ISSUE_TEMPLATE/feature_request.md similarity index 100% rename from .github/ISSUE_TEMPLATE/feature_request.md rename to {{ cookiecutter.repo_name }}/.github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/{{ cookiecutter.repo_name }}/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from .github/PULL_REQUEST_TEMPLATE.md rename to {{ cookiecutter.repo_name }}/.github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/workflows/ci.yml b/{{ cookiecutter.repo_name }}/.github/workflows/ci.yml similarity index 99% rename from .github/workflows/ci.yml rename to {{ cookiecutter.repo_name }}/.github/workflows/ci.yml index d3cae79..334acc5 100644 --- a/.github/workflows/ci.yml +++ b/{{ cookiecutter.repo_name }}/.github/workflows/ci.yml @@ -1,3 +1,4 @@ +{% raw %} name: CI on: @@ -119,3 +120,4 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: ./coverage.xml +{% endraw %} diff --git a/.github/workflows/docker.yml b/{{ cookiecutter.repo_name }}/.github/workflows/docker.yml similarity index 72% rename from .github/workflows/docker.yml rename to {{ cookiecutter.repo_name }}/.github/workflows/docker.yml index dad113a..edf8dfe 100644 --- a/.github/workflows/docker.yml +++ b/{{ cookiecutter.repo_name }}/.github/workflows/docker.yml @@ -1,3 +1,4 @@ +{% raw %} name: Docker Build & Publish on: @@ -17,8 +18,7 @@ permissions: env: REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} # may include uppercase (we'll normalize) - # Flip this to "true" if you want multi-arch on all branches + IMAGE_NAME: ${{ github.repository }} MULTIARCH_ON_BRANCHES: "false" concurrency: @@ -45,7 +45,6 @@ jobs: - name: Set up Buildx uses: docker/setup-buildx-action@v3 - # Only set up QEMU when we actually need arm64 (main or tag builds) - name: Set up QEMU (for arm64) if: env.IS_MAIN == 'true' || env.IS_TAG == 'true' || env.MULTIARCH_ON_BRANCHES == 'true' uses: docker/setup-qemu-action@v3 @@ -69,7 +68,6 @@ jobs: echo "latest_tag=latest" >> "$GITHUB_OUTPUT" fi - # Fast path for branches: single-arch build, cache, don't push - name: Build (branch) — fast single-arch, no push if: env.IS_MAIN != 'true' && env.IS_TAG != 'true' && env.MULTIARCH_ON_BRANCHES != 'true' uses: docker/build-push-action@v6 @@ -77,7 +75,7 @@ jobs: context: . file: ./Dockerfile push: false - load: true # so we can run the smoke test + load: true platforms: linux/amd64 cache-from: type=gha cache-to: type=gha,mode=max @@ -85,7 +83,6 @@ jobs: tags: | ${{ env.REGISTRY }}/${{ steps.repo.outputs.image_name_lc }}:${{ steps.meta.outputs.sha_tag }} - # Publish path for main/tags: multi-arch build + push (with cache) - name: Build & push (multi-arch) if: env.IS_MAIN == 'true' || env.IS_TAG == 'true' || env.MULTIARCH_ON_BRANCHES == 'true' uses: docker/build-push-action@v6 @@ -99,21 +96,33 @@ jobs: provenance: false tags: | ${{ env.REGISTRY }}/${{ steps.repo.outputs.image_name_lc }}:${{ steps.meta.outputs.sha_tag }} - ${{ steps.meta.outputs.version_tag && format('{0}/{1}:{2}', env.REGISTRY, steps.repo.outputs.image_name_lc, steps.meta.outputs.version_tag) || '' }} - ${{ steps.meta.outputs.latest_tag && format('{0}/{1}:{2}', env.REGISTRY, steps.repo.outputs.image_name_lc, steps.meta.outputs.latest_tag) || '' }} +{% endraw %} + {% raw %}${{ steps.meta.outputs.version_tag }}{% endraw %}{{ "" if not cookiecutter.module_name else "" }} +{% raw %} + {% endraw %} + {% raw %}${{ steps.meta.outputs.latest_tag }}{% endraw %}{{ "" if not cookiecutter.module_name else "" }} +{% raw %} - # Smoke test: use the local image for branch builds, or pull the pushed one for main/tags - name: Smoke test (branch image) if: env.IS_MAIN != 'true' && env.IS_TAG != 'true' && env.MULTIARCH_ON_BRANCHES != 'true' run: | IMAGE="${{ env.REGISTRY }}/${{ steps.repo.outputs.image_name_lc }}:${{ steps.meta.outputs.sha_tag }}" - echo "Smoke testing local image ${IMAGE}" - docker run --rm "$IMAGE" python -c "import change_me, sys; print('✅ import ok:', getattr(change_me,'__version__','?'), 'on', sys.version)" +{% endraw %} + python - << 'EOF' +import {{ cookiecutter.module_name }}, sys +print("✅ import ok:", getattr({{ cookiecutter.module_name }}, "__version__", "?"), "on", sys.version) +EOF +{% raw %} - name: Smoke test (pushed image) if: env.IS_MAIN == 'true' || env.IS_TAG == 'true' || env.MULTIARCH_ON_BRANCHES == 'true' run: | IMAGE="${{ env.REGISTRY }}/${{ steps.repo.outputs.image_name_lc }}:${{ steps.meta.outputs.sha_tag }}" - echo "Smoke testing pushed image ${IMAGE}" docker pull "$IMAGE" - docker run --rm "$IMAGE" python -c "import change_me, sys; print('✅ import ok:', getattr(change_me,'__version__','?'), 'on', sys.version)" +{% endraw %} + python - << 'EOF' +import {{ cookiecutter.module_name }}, sys +print("✅ import ok:", getattr({{ cookiecutter.module_name }}, "__version__", "?"), "on", sys.version) +EOF +{% raw %} +{% endraw %} diff --git a/{{ cookiecutter.repo_name }}/.gitignore b/{{ cookiecutter.repo_name }}/.gitignore new file mode 100644 index 0000000..88760d5 --- /dev/null +++ b/{{ cookiecutter.repo_name }}/.gitignore @@ -0,0 +1,172 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +../.coverage +.coveragerc +.coverage +coverage.xml +.cache +nosetests.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +.idea +.idea? +.DS_Store +.DS_Store? + +# pixi environments +.pixi +*.egg-info + +/logs/log_* diff --git a/.pre-commit-config.yaml b/{{ cookiecutter.repo_name }}/.pre-commit-config.yaml similarity index 100% rename from .pre-commit-config.yaml rename to {{ cookiecutter.repo_name }}/.pre-commit-config.yaml diff --git a/.python-version b/{{ cookiecutter.repo_name }}/.python-version similarity index 100% rename from .python-version rename to {{ cookiecutter.repo_name }}/.python-version diff --git a/CONTRIBUTING.md b/{{ cookiecutter.repo_name }}/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to {{ cookiecutter.repo_name }}/CONTRIBUTING.md diff --git a/Dockerfile b/{{ cookiecutter.repo_name }}/Dockerfile similarity index 95% rename from Dockerfile rename to {{ cookiecutter.repo_name }}/Dockerfile index e8fc42d..e46753d 100644 --- a/Dockerfile +++ b/{{ cookiecutter.repo_name }}/Dockerfile @@ -6,7 +6,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 # Select the package and version at build time -ARG PKG=change_me +ARG PKG={{ cookiecutter.module_name }} ARG VER=latest ENV PKG=${PKG} VER=${VER} diff --git a/LICENSE b/{{ cookiecutter.repo_name }}/LICENSE similarity index 100% rename from LICENSE rename to {{ cookiecutter.repo_name }}/LICENSE diff --git a/Makefile b/{{ cookiecutter.repo_name }}/Makefile similarity index 82% rename from Makefile rename to {{ cookiecutter.repo_name }}/Makefile index 7db7421..bf5ce85 100644 --- a/Makefile +++ b/{{ cookiecutter.repo_name }}/Makefile @@ -41,11 +41,11 @@ update-deep: make update docker: - docker build --no-cache -f Dockerfile -t change_me-smoke . - docker run --rm change_me-smoke + docker build --no-cache -f Dockerfile -t {{ cookiecutter.module_name }}-smoke . + docker run --rm {{ cookiecutter.module_name }}-smoke app: - uv run python -m change_me + uv run python -m {{ cookiecutter.module_name }} tree: uv run python repo_tree.py --update-readme diff --git a/README.md b/{{ cookiecutter.repo_name }}/README.md similarity index 65% rename from README.md rename to {{ cookiecutter.repo_name }}/README.md index 3a8c6db..1712acb 100644 --- a/README.md +++ b/{{ cookiecutter.repo_name }}/README.md @@ -1,19 +1,30 @@ -# template-python -[![Coverage Status](https://coveralls.io/repos/github/TUM-Aries-Lab/template-python/badge.svg?branch=main)](https://coveralls.io/github/TUM-Aries-Lab/template-python?branch=main) -![Docker Image CI](https://github.com/TUM-Aries-Lab/template-python/actions/workflows/ci.yml/badge.svg) +# {{ cookiecutter.repo_name }} + +[![Coverage Status](https://coveralls.io/repos/github/TUM-Aries-Lab/{{ cookiecutter.repo_name }}/badge.svg?branch=main)](https://coveralls.io/github/TUM-Aries-Lab/{{ cookiecutter.repo_name }}?branch=main) +![Docker Image CI](https://github.com/TUM-Aries-Lab/{{ cookiecutter.repo_name }}/actions/workflows/ci.yml/badge.svg) Simple README.md for a Python project template. -Do ***NOT*** clone this repository. Please use it as a template instead. This readme is just here to serve as a template for you to get started faster. +Do ***NOT*** clone this repository. +Please use it as a template instead—this README is meant to help you get started quickly. + +# Names Changes +After adjusting the names in `cookiecutter.json` move into the repo and run: +```bash +cookiecutter . +``` +--- ## Install -To install the library run: + +To install the library from PyPI: + ```bash -uv pip install change-me==latest +uv pip install {{ cookiecutter.repo_name | replace('-', '_') }}==latest ``` OR ```bash -uv add git+https://github.com/TUM-Aries-Lab/change-me.git@ # need credentials +uv add git+https://github.com/TUM-Aries-Lab/{{ cookiecutter.repo_name }}.git@ # needs credentials ``` ## Development @@ -40,7 +51,7 @@ The package can then be found at: https://pypi.org/project/change-me from loguru import logger -from change_me import definitions +from {{ cookiecutter.module_name }} import definitions def main() -> None: """Run a simple demonstration.""" @@ -52,7 +63,7 @@ if __name__ == "__main__": ## Program Usage ```bash -uv run python -m change_me +uv run python -m {{ cookiecutter.module_name }} ``` ## Structure @@ -60,7 +71,7 @@ The following tree shows the important permanent files. ``` ├── src -│ └── change_me +│ └── {{ cookiecutter.module_name }} │ ├── __init__.py │ ├── __main__.py │ ├── definitions.py diff --git a/pyproject.toml b/{{ cookiecutter.repo_name }}/pyproject.toml similarity index 96% rename from pyproject.toml rename to {{ cookiecutter.repo_name }}/pyproject.toml index f7d5319..b36f60e 100644 --- a/pyproject.toml +++ b/{{ cookiecutter.repo_name }}/pyproject.toml @@ -21,7 +21,7 @@ dev = [ ] [project.urls] -homepage = "https://github.com/TUM-Aries-Lab/template-python" +homepage = "https://github.com/TUM-Aries-Lab/{{ cookiecutter.repo_name }}" [tool.ruff] line-length = 88 diff --git a/repo_tree.py b/{{ cookiecutter.repo_name }}/repo_tree.py similarity index 100% rename from repo_tree.py rename to {{ cookiecutter.repo_name }}/repo_tree.py diff --git a/src/change_me/__init__.py b/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}/__init__.py similarity index 100% rename from src/change_me/__init__.py rename to {{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}/__init__.py diff --git a/src/change_me/__main__.py b/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}/__main__.py similarity index 99% rename from src/change_me/__main__.py rename to {{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}/__main__.py index 35682d6..1ff6893 100644 --- a/src/change_me/__main__.py +++ b/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}/__main__.py @@ -2,10 +2,9 @@ import argparse -from loguru import logger - from change_me.definitions import DEFAULT_LOG_LEVEL, LogLevel from change_me.utils import setup_logger +from loguru import logger def main( diff --git a/src/change_me/definitions.py b/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}/definitions.py similarity index 100% rename from src/change_me/definitions.py rename to {{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}/definitions.py diff --git a/src/change_me/utils.py b/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}/utils.py similarity index 99% rename from src/change_me/utils.py rename to {{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}/utils.py index 9fd9e27..6b8c6fa 100644 --- a/src/change_me/utils.py +++ b/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.module_name }}/utils.py @@ -4,8 +4,6 @@ from datetime import datetime from pathlib import Path -from loguru import logger - from change_me.definitions import ( DATE_FORMAT, DEFAULT_LOG_FILENAME, @@ -13,6 +11,7 @@ ENCODING, LOG_DIR, ) +from loguru import logger def create_timestamped_filepath(suffix: str, output_dir: Path, prefix: str) -> Path: diff --git a/tests/__init__.py b/{{ cookiecutter.repo_name }}/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to {{ cookiecutter.repo_name }}/tests/__init__.py diff --git a/tests/conftest.py b/{{ cookiecutter.repo_name }}/tests/conftest.py similarity index 100% rename from tests/conftest.py rename to {{ cookiecutter.repo_name }}/tests/conftest.py diff --git a/tests/main_test.py b/{{ cookiecutter.repo_name }}/tests/main_test.py similarity index 65% rename from tests/main_test.py rename to {{ cookiecutter.repo_name }}/tests/main_test.py index 2984a22..1c57d35 100644 --- a/tests/main_test.py +++ b/{{ cookiecutter.repo_name }}/tests/main_test.py @@ -1,6 +1,6 @@ """Test the main program.""" -from change_me.__main__ import main +from {{ cookiecutter.module_name }}.__main__ import main def test_main(): diff --git a/tests/utils_test.py b/{{ cookiecutter.repo_name }}/tests/utils_test.py similarity index 81% rename from tests/utils_test.py rename to {{ cookiecutter.repo_name }}/tests/utils_test.py index 8da207f..5262015 100644 --- a/tests/utils_test.py +++ b/{{ cookiecutter.repo_name }}/tests/utils_test.py @@ -3,8 +3,8 @@ from pathlib import Path from tempfile import TemporaryDirectory -from change_me.definitions import LogLevel -from change_me.utils import setup_logger +from {{ cookiecutter.module_name }}.definitions import LogLevel +from {{ cookiecutter.module_name }}.utils import setup_logger def test_logger_init() -> None: diff --git a/uv.lock b/{{ cookiecutter.repo_name }}/uv.lock similarity index 100% rename from uv.lock rename to {{ cookiecutter.repo_name }}/uv.lock From cfa4fef4257a8af41d1656a56e1f7e5ba67fe170 Mon Sep 17 00:00:00 2001 From: tsmorz Date: Thu, 27 Nov 2025 10:23:18 +0100 Subject: [PATCH 8/8] add readme --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4213f51 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Template-Python + +Do ***NOT*** clone this repository. Please use it as a template instead—this README is meant to help you get started quickly. + +The file cookiecutter.json has the following contents: +``` +{ + "repo_name": "temp-python", + "module_name": "new-repo", + "package_name": "new_repo", + "org_name": "TUM-Aries-Lab", + "description": "Basic description for the repo.", + "author_name": "Tony Smoragiewicz", + "author_email": "tony.smoragiewicz@tum.de", + "python_version": "3.12", + "version": "0.0.1" +} +``` + +## Steps +1. Make the necessary names changes in `cookiecutter.json` and then run: +2. ` cookiecutter . # This will create a new repo with the correct names in place.` +3. You can then delete everything but the code in your newly generated folder. +4. Commit your new changes. \ No newline at end of file