-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,368 additions
and
1,356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# See here for image contents: https://github.com/devcontainers/images/blob/main/src/python/.devcontainer/Dockerfile | ||
|
||
# [Choice] Python version (use -bookworm or -bullseye variants on local arm64/Apple Silicon): 3, 3.12, 3.11, 3.10, 3.9, 3.8, 3-bookworm, 3.12-bookworm, 3.11-bookworm, 3.10-bookworm, 3.9-bookworm, 3.8-bookworm, 3-bullseye, 3.12-bullseye, 3.11-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3-buster, 3.12-buster, 3.11-buster, 3.10-buster, 3.9-buster, 3.8-buster | ||
ARG VARIANT=3-bookworm | ||
FROM mcr.microsoft.com/devcontainers/python:1-${VARIANT} | ||
|
||
# Temporary: Upgrade python packages due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-40897 | ||
# They are installed by the base image (python) which does not have the patch. | ||
RUN python3 -m pip install --upgrade setuptools | ||
|
||
# Install poetry | ||
RUN pip install --upgrade pip | ||
|
||
ENV PATH "/etc/poetry/bin:$PATH" | ||
RUN curl -sSLk https://install.python-poetry.org | POETRY_HOME=/etc/poetry python - \ | ||
&& poetry completions bash >> ~/.bash_completion \ | ||
&& poetry config virtualenvs.create false \ | ||
&& poetry self add "poetry-dynamic-versioning[plugin]" | ||
# See here for image contents: https://github.com/devcontainers/images/blob/main/src/python/.devcontainer/Dockerfile | ||
|
||
# [Choice] Python version (use -bookworm or -bullseye variants on local arm64/Apple Silicon): 3, 3.12, 3.11, 3.10, 3.9, 3.8, 3-bookworm, 3.12-bookworm, 3.11-bookworm, 3.10-bookworm, 3.9-bookworm, 3.8-bookworm, 3-bullseye, 3.12-bullseye, 3.11-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3-buster, 3.12-buster, 3.11-buster, 3.10-buster, 3.9-buster, 3.8-buster | ||
ARG VARIANT=3-bookworm | ||
FROM mcr.microsoft.com/devcontainers/python:1-${VARIANT} | ||
|
||
# Temporary: Upgrade python packages due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-40897 | ||
# They are installed by the base image (python) which does not have the patch. | ||
RUN python3 -m pip install --upgrade setuptools | ||
|
||
# Install poetry | ||
RUN pip install --upgrade pip | ||
|
||
ENV PATH "/etc/poetry/bin:$PATH" | ||
RUN curl -sSLk https://install.python-poetry.org | POETRY_HOME=/etc/poetry python - \ | ||
&& poetry completions bash >> ~/.bash_completion \ | ||
&& poetry config virtualenvs.create false \ | ||
&& poetry self add "poetry-dynamic-versioning[plugin]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
MIT License | ||
Copyright (c) 2024 twsl | ||
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, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
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. | ||
MIT License | ||
|
||
Copyright (c) 2024 twsl | ||
|
||
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, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,119 @@ | ||
# Python Project Template | ||
|
||
[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-border.json)](https://github.com/copier-org/copier) | ||
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/) | ||
[![linting: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) | ||
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](.pre-commit-config.yaml) | ||
[![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/) | ||
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit) | ||
[![vulnerability: safety](https://img.shields.io/badge/vulnerability-safety-yellow.svg)](https://github.com/pyupio/safety) | ||
[![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/twsl/python-project-template/releases) | ||
[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE) | ||
|
||
|
||
A generic python project template based on [`copier`](https://copier.readthedocs.io/en/stable/) for my data science focused projects. | ||
|
||
## TL;DR | ||
|
||
```bash | ||
copier copy --trust git+https://github.com/twsl/python-project-template path/to/destination | ||
``` | ||
|
||
## Features | ||
|
||
### Development features | ||
|
||
- Supports `Python 3.8` and higher. | ||
- [`Poetry`](https://python-poetry.org/) as a dependencies manager. See configuration in `pyproject.toml`. | ||
- Automatic codestyle with [`ruff`](https://github.com/astral-sh/ruff). | ||
- Ready-to-use [`pre-commit`](https://pre-commit.com/) hooks with code-formatting. | ||
- Type checks with [`pyright`](https://github.com/microsoft/pyright). | ||
- Security checks with [`safety`](https://github.com/pyupio/safety) and [`bandit`](https://github.com/PyCQA/bandit). | ||
- Testing with [`pytest`](https://docs.pytest.org/en/latest/). | ||
- Ready-to-use `.editorconfig` and `.gitignore`. | ||
- Ready-to-use [`Devcontainer`](https://containers.dev/). | ||
|
||
### Deployment features | ||
|
||
- `GitHub` integration: Ready-to-use **Pull Requests templates** and several **Issue templates** | ||
- `Github Actions` with predefined workflows. | ||
- Everything is already set up for security checks, codestyle checks, code formatting, testing, linting, docker builds | ||
- Always up-to-date dependencies with [`@dependabot`](https://dependabot.com/). | ||
- Automatic release notes with [`Release Drafter`](https://github.com/marketplace/actions/release-drafter). | ||
- Documentation with [`MkDocs`](https://www.mkdocs.org/) or [`Sphinx`](https://www.sphinx-doc.org/en/master/). | ||
|
||
### Open source community features | ||
|
||
- Files such as: `LICENSE`, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, and `SECURITY.md` are generated automatically. | ||
- [Semantic Versions](https://semver.org/) specification with [`Release Drafter`](https://github.com/marketplace/actions/release-drafter). | ||
|
||
## How to use it | ||
|
||
### Installation | ||
|
||
To begin using the template consider updating [`copier`](https://copier.readthedocs.io/en/stable/): | ||
|
||
```bash | ||
pip install --upgrade copier | ||
``` | ||
|
||
Then, you can copy the template to your destination folder: | ||
|
||
```bash | ||
copier copy --trust git+https://github.com/twsl/python-project-template path/to/destination | ||
``` | ||
|
||
### Update | ||
|
||
You can update the template in your destination folder with: | ||
|
||
```bash | ||
copier update --trust path/to/destination | ||
``` | ||
|
||
### Variables | ||
|
||
The template uses the following variables to customize the project: | ||
|
||
| **Parameter** | **Default value** | | ||
| ---------------------------------- | ------------------------------------------------ | | ||
| `custom_install` | `customized` | | ||
| `project_name` | `example_project` | | ||
| `project_description` | `` | | ||
| `primary_branch` | `main` | | ||
| `author_username` | `` | | ||
| `author_email` | `{{ author_username }}@users.noreply.github.com` | | ||
| `repository_provider` | `github.com` | | ||
| `repository_namespace` | `{{ author_username }}` | | ||
| `repository_name` | `{{ project_name }}` | | ||
| `copyright_holder` | `{{ author_username }}` | | ||
| `copyright_holder_email` | `{{ author_email }}` | | ||
| `copyright_year` | `2024` | | ||
| `copyright_license` | `MIT` | | ||
| `python_version` | `3.11` | | ||
| `python_package_distribution_name` | `{{ project_name }}` | | ||
| `python_package_import_name` | `{{ project_name }}` | | ||
| `python_package_command_line_name` | `{{ project_name }}` | | ||
| `line_ending` | `lf` | | ||
| `use_precommit` | `true` | | ||
| `include_docs` | `true` | | ||
| `include_notebooks` | `true` | | ||
| `include_databricks` | `true` | | ||
| `include_copilot` | `true` | | ||
| `github_runner_python_version` | `3.11` | | ||
| `github_runner` | `ubuntu-latest` | | ||
| `github_runner_onprem` | `small` | | ||
| `github_rate_limit` | `false` | | ||
| `include_sample_code` | `false` | | ||
| `self_signed` | `false` | | ||
|
||
All input values will be saved in the `.copier-answers.yml` | ||
|
||
## Credits | ||
|
||
I just combined multiple templates to create this one, therefore all credits belong to the following projects: | ||
|
||
- [poetry-copier](https://github.com/lukin0110/poetry-copier) | ||
- [python-project-template](https://github.com/lincc-frameworks/python-project-template) | ||
- [copier-poetry](https://github.com/pawamoy/copier-poetry) | ||
- [python-package-template](https://github.com/TezRomacH/python-package-template) | ||
# Python Project Template | ||
|
||
[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-border.json)](https://github.com/copier-org/copier) | ||
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/) | ||
[![linting: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) | ||
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](.pre-commit-config.yaml) | ||
[![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/) | ||
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit) | ||
[![vulnerability: safety](https://img.shields.io/badge/vulnerability-safety-yellow.svg)](https://github.com/pyupio/safety) | ||
[![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/twsl/python-project-template/releases) | ||
[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE) | ||
|
||
|
||
A generic python project template based on [`copier`](https://copier.readthedocs.io/en/stable/) for my data science focused projects. | ||
|
||
## TL;DR | ||
|
||
```bash | ||
copier copy --trust git+https://github.com/twsl/python-project-template path/to/destination | ||
``` | ||
|
||
## Features | ||
|
||
### Development features | ||
|
||
- Supports `Python 3.8` and higher. | ||
- [`Poetry`](https://python-poetry.org/) as a dependencies manager. See configuration in `pyproject.toml`. | ||
- Automatic codestyle with [`ruff`](https://github.com/astral-sh/ruff). | ||
- Ready-to-use [`pre-commit`](https://pre-commit.com/) hooks with code-formatting. | ||
- Type checks with [`pyright`](https://github.com/microsoft/pyright). | ||
- Security checks with [`safety`](https://github.com/pyupio/safety) and [`bandit`](https://github.com/PyCQA/bandit). | ||
- Testing with [`pytest`](https://docs.pytest.org/en/latest/). | ||
- Ready-to-use `.editorconfig` and `.gitignore`. | ||
- Ready-to-use [`Devcontainer`](https://containers.dev/). | ||
|
||
### Deployment features | ||
|
||
- `GitHub` integration: Ready-to-use **Pull Requests templates** and several **Issue templates** | ||
- `Github Actions` with predefined workflows. | ||
- Everything is already set up for security checks, codestyle checks, code formatting, testing, linting, docker builds | ||
- Always up-to-date dependencies with [`@dependabot`](https://dependabot.com/). | ||
- Automatic release notes with [`Release Drafter`](https://github.com/marketplace/actions/release-drafter). | ||
- Documentation with [`MkDocs`](https://www.mkdocs.org/) or [`Sphinx`](https://www.sphinx-doc.org/en/master/). | ||
|
||
### Open source community features | ||
|
||
- Files such as: `LICENSE`, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, and `SECURITY.md` are generated automatically. | ||
- [Semantic Versions](https://semver.org/) specification with [`Release Drafter`](https://github.com/marketplace/actions/release-drafter). | ||
|
||
## How to use it | ||
|
||
### Installation | ||
|
||
To begin using the template consider updating [`copier`](https://copier.readthedocs.io/en/stable/): | ||
|
||
```bash | ||
pip install --upgrade copier | ||
``` | ||
|
||
Then, you can copy the template to your destination folder: | ||
|
||
```bash | ||
copier copy --trust git+https://github.com/twsl/python-project-template path/to/destination | ||
``` | ||
|
||
### Update | ||
|
||
You can update the template in your destination folder with: | ||
|
||
```bash | ||
copier update --trust path/to/destination | ||
``` | ||
|
||
### Variables | ||
|
||
The template uses the following variables to customize the project: | ||
|
||
| **Parameter** | **Default value** | | ||
| ---------------------------------- | ------------------------------------------------ | | ||
| `custom_install` | `customized` | | ||
| `project_name` | `example_project` | | ||
| `project_description` | `` | | ||
| `primary_branch` | `main` | | ||
| `author_username` | `` | | ||
| `author_email` | `{{ author_username }}@users.noreply.github.com` | | ||
| `repository_provider` | `github.com` | | ||
| `repository_namespace` | `{{ author_username }}` | | ||
| `repository_name` | `{{ project_name }}` | | ||
| `copyright_holder` | `{{ author_username }}` | | ||
| `copyright_holder_email` | `{{ author_email }}` | | ||
| `copyright_year` | `2024` | | ||
| `copyright_license` | `MIT` | | ||
| `python_version` | `3.11` | | ||
| `python_package_distribution_name` | `{{ project_name }}` | | ||
| `python_package_import_name` | `{{ project_name }}` | | ||
| `python_package_command_line_name` | `{{ project_name }}` | | ||
| `line_ending` | `lf` | | ||
| `use_precommit` | `true` | | ||
| `include_docs` | `true` | | ||
| `include_notebooks` | `true` | | ||
| `include_databricks` | `true` | | ||
| `include_copilot` | `true` | | ||
| `github_runner_python_version` | `3.11` | | ||
| `github_runner` | `ubuntu-latest` | | ||
| `github_runner_onprem` | `small` | | ||
| `github_rate_limit` | `false` | | ||
| `include_sample_code` | `false` | | ||
| `self_signed` | `false` | | ||
|
||
All input values will be saved in the `.copier-answers.yml` | ||
|
||
## Credits | ||
|
||
I just combined multiple templates to create this one, therefore all credits belong to the following projects: | ||
|
||
- [poetry-copier](https://github.com/lukin0110/poetry-copier) | ||
- [python-project-template](https://github.com/lincc-frameworks/python-project-template) | ||
- [copier-poetry](https://github.com/pawamoy/copier-poetry) | ||
- [python-package-template](https://github.com/TezRomacH/python-package-template) |
Oops, something went wrong.