This commit is contained in:
Adam Skotarczak 2025-04-25 13:50:08 +02:00
parent 526995cb24
commit 861bd39bfb
9 changed files with 136 additions and 31 deletions

View File

@ -7,4 +7,4 @@ LOGLEVEL=INFO
# Pfad zum log z.B log/template.log (relativ und absolut beachten!)
# Pfad ist ausgehend vom Ort der run.py und Verzeichnisse werden automatisch erstellt.
# DEFAULT: log/template.log
LOGFILE=log/template.log
LOGFILE=log/bootstrap.log

View File

@ -1,9 +1,15 @@
# CHANGELOG - Python Template
- [CHANGELOG - Python Template](#changelog---python-template)
- [2025-04-25 - Commit v1.0.2](#2025-04-25---commit-v102)
- [2025-04-24 - Commit v1.0.1](#2025-04-24---commit-v101)
- [2025-04-22 - Release v1.0.0](#2025-04-22---release-v100)
## 2025-04-25 - Commit v1.0.2
- **Hinzugefügt:**
- [x] LICENSE hinzugefügt und Projekt unter MIT gestellt.
## 2025-04-24 - Commit v1.0.1
- **Geändert:**

79
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,79 @@
# Contributing to this Project
First off, thank you for taking the time to contribute! :tada: Following these guidelines helps to maintain a healthy project and fair environment for everyone.
- [Contributing to this Project](#contributing-to-this-project)
- [How Can I Contribute?](#how-can-i-contribute)
- [Reporting Issues](#reporting-issues)
- [Submitting Changes (Pull Requests)](#submitting-changes-pull-requests)
- [Code of Conduct](#code-of-conduct)
- [Contributor License and Attribution](#contributor-license-and-attribution)
- [License Agreement](#license-agreement)
- [Attribution \& Credits](#attribution--credits)
- [Development Guidelines](#development-guidelines)
- [Communication](#communication)
## How Can I Contribute?
### Reporting Issues
If you find a bug or have a suggestion, please open an issue in the GitHub tracker. Provide as much detail as possible:
- **Bug Reports:** Include OS/Environment, steps to reproduce, and expected vs. actual behavior.
- **Enhancement Requests:** Explain *why* the feature would be useful and how you envision it.
Be respectful and constructive in your reports. We welcome feedback!
### Submitting Changes (Pull Requests)
1. **Fork the repository** and create a new branch for your feature or bugfix.
2. **Write clear commit messages:** Describe *what* and *why* in the commit message. Please do not remove existing author attribution in the code/comments.
3. **Follow code style guidelines:** Keep code consistent with the style of the project (indentation, naming, etc.). Run `npm run lint` (or relevant tools) to catch formatting issues.
4. **Include tests** if applicable. We strive for good test coverage. Add unit tests for new functionality or bug fixes when possible.
5. **Update documentation:** If you add or change a public API or behavior, update the README or any relevant docs.
6. **Open a Pull Request:** Go to your fork and open a PR to the `develop` (or appropriate) branch. Fill out the PR template, summarizing your changes and referencing any issue fixed (e.g., “Closes #123”).
Once your PR is submitted:
- Ensure CI checks pass (tests, lint). The project maintainers will review your changes.
- Be responsive to feedback: we may ask for adjustments or clarifications. This is part of making sure the contribution meets project standards.
### Code of Conduct
By contributing, you agree to uphold a respectful and welcoming environment. Harassment of any kind is not tolerated. Be kind in interactions and patient in discussions. (See `CODE_OF_CONDUCT.md` for details.)
## Contributor License and Attribution
### License Agreement
All contributions to this project are made under the same MIT License (with attribution requirement) that covers the repository. By submitting a pull request, you agree that your contributions will be licensed under **MIT License (with Adam Skotarczaks attribution clause)**, and that you have the right to contribute the code (either you wrote it or its appropriately licensed).
If youre not okay with that, please refrain from contributing, or contact the maintainers to discuss alternatives.
### Attribution & Credits
We believe in giving credit where its due:
- **Maintaining author notice:** Do not remove or alter existing author credits in files. For example, if a source file contains a header with the original authors name, keep that intact.
- **Changelog mention:** Significant contributions will be noted in the changelog/release notes with the contributors name.
- **Contributors list:** After your first contribution is merged, youre welcome to add your name to the `AUTHORS.md` (or we will add it) to be recognized among the project contributors.
- **Citing the project:** If you use this project in your own work, wed appreciate a shout-out (per the licenses attribution clause). This is not a hard requirement for contributors, but a polite reminder aligned with our projects fairness ethos.
## Development Guidelines
To set up a local development environment:
- **Prerequisites:** Youll need Node.js 14+ and npm.
- **Install Dependencies:** Run `npm install` after cloning.
- **Running Tests:** Run `npm test` to execute the test suite.
- **Build:** Use `npm run build` to compile the project (output in `/dist`).
Please ensure all tests pass before submitting a PR. If youre adding a new feature, include tests for it.
## Communication
If you have any questions or need clarification, feel free to open an issue or discuss in our Slack channel (link in README). Maintainers (including Adam Skotarczak, the project creator) or community members will do their best to help.
We aim to be fair and transparent in all decisions. If you feel your contribution or issue is being overlooked, politely ping us. We value every contributors input and effort.
Lastly, **thank you for contributing**! By working together, we can improve this project for everyone. We appreciate your time, energy, and support in making this project better while giving proper credit to all involved.

23
LICENSE Normal file
View File

@ -0,0 +1,23 @@
MIT License with Attribution Requirement
Copyright (c) 2025 Adam Skotarczak <adam@skotarczak.net>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, subject to the following conditions:
1. The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
2. **Attribution Requirement**: Any public use or distribution of this Software,
modified or unmodified, must include a clear and visible attribution to the original author:
**Adam Skotarczak <adam@skotarczak.net>**
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -16,7 +16,7 @@ Außerdem bietet es ein portables Start-Template für Python-Anwendungen mit fol
Das Template ist durchdacht, pragmatisch und stark auf Entwicklerkomfort ausgelegt.
Es bietet eine sehr gute Grundlage für Projekte aller Art insbesondere CLI-Tools, kleine Services und lokale Anwendungen. Die automatische Einrichtung der virtuellen Umgebung hebt es funktional deutlich von Standard-Vorlagen ab.
**Was dieses template __nicht__ ist:**
**Was dieses template **nicht** ist:**
- [ ] [pep-518](https://peps.python.org/pep-0518/)-konform 🚫
@ -26,13 +26,13 @@ Einfach deinen Code in main.py werfen, bei Bedarf requirements.txt anpassen, run
---
## 🔜 Inhalt der Readme
## 📑 Inhalt der Readme
- [Python Bootstrap-Template mit `.venv`- und `.env` Support](#python-bootstrap-template-mit-venv--und-env-support)
- [🔜 Inhalt der Readme](#-inhalt-der-readme)
- [📑 Inhalt der Readme](#-inhalt-der-readme)
- [🔧 Projektstruktur](#-projektstruktur)
- [🚀 Erste Schritte](#-erste-schritte)
- [Beim ersten Start passiert:](#beim-ersten-start-passiert)
- [Beim ersten Start passiert](#beim-ersten-start-passiert)
- [📦 Abhängigkeiten](#-abhängigkeiten)
- [⚙️ .env-Datei (optional)](#-env-datei-optional)
- [📜 Beispielausgabe](#-beispielausgabe)
@ -90,7 +90,7 @@ Einfach deinen Code in main.py werfen, bei Bedarf requirements.txt anpassen, run
python run.py
```
### Beim ersten Start passiert:
### Beim ersten Start passiert
1. `.venv` wird erstellt (wenn noch nicht vorhanden)
2. `requirements.txt` wird installiert
@ -249,4 +249,4 @@ Durch den Einsatz der <.vscode/task.json> für VS-Code, kannst du in VS-Code mit
## 📁 Lizenz
MIT frei verwendbar in eigenen Projekten.
MIT [LICENSE](./LICENSE) frei verwendbar bei Namensnennung in eigenen Projekten.

View File

@ -1 +1,2 @@
1.0.1
1.0.2

View File

@ -41,12 +41,12 @@ def get_logger(name: str) -> logging.Logger:
formatter = logging.Formatter("[%(asctime)s] %(levelname)s %(name)s: %(message)s")
# Konsole
# Console-Log
console_handler = logging.StreamHandler()
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
# Datei (optional)
# Datei-Log (optional)
if LOGFILE:
logfile_path = Path(LOGFILE)

View File

@ -14,11 +14,23 @@ from app.logging_utils import get_logger
log = get_logger(__name__)
# Ab hier eigener Code:
def logtest():
"""
wirft testweise alle Logvarianten aus.
"""
print(f"\n[IFO] 📰 Loglevel aus .env: {os.getenv('LOGFILE')}\n")
log.info("Template ready.")
log.debug("Dies ist eine Debug-Meldung.")
log.warning("Dies ist eine Warnung.")
log.error("Dies ist eine Fehlermeldung.")
log.critical("Dies ist eine kritische Meldung.")
def main():
"""
Hier liegen die Dateien für die primäre Logik der Anwendung
Diese Information hier stammt aus der datei ./app/__init__.py
Die main() wird automatisch als einzige Funktion von der run.py aufgerufen.
"""
# Hole APP_MODE aus der .env
mode = os.getenv("APP_MODE", "DEVEL")
@ -27,15 +39,6 @@ def main():
print(f"[APP] 🚀 Starte Anwendung im Modus: {mode}")
print("[APP] 📦 -= Hello, world! =-")
def logtest():
"""
wirft testweise alle Logvarianten aus.
"""
print(f"\n[IFO] 📰 Loglevel: aus .env: {os.getenv('LOGFILE')}\n")
log.info("Template ready.")
log.debug("Dies ist eine Debug-Meldung.")
log.warning("Dies ist eine Warnung.")
log.error("Dies ist eine Fehlermeldung.")
log.critical("Dies ist eine kritische Meldung.")
logtest()
exit(0)

7
run.py
View File

@ -11,8 +11,6 @@ Sorgt dafür, dass beim ersten Start automatisch:
Erst danach wird die .env geladen und die App gestartet.
"""
import os
from app.bootstrap import ensure_venv
if __name__ == "__main__":
@ -31,9 +29,4 @@ if __name__ == "__main__":
# Ab hier deine Funktionen aufrufen:
from app.main import main
main()
from app.main import logtest
logtest()