-
Notifications
You must be signed in to change notification settings - Fork 1
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
0 parents
commit 2579e8f
Showing
11 changed files
with
844 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// cspell Settings (https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell#cspelljson) | ||
{ | ||
"version": "0.2", | ||
"language": "en", | ||
// list of words to always be considered correct (may need additions later) | ||
"words": [ | ||
"pipx", | ||
"pytest", | ||
"pylint", | ||
"taskipy", | ||
"markdownlint", | ||
"pyproject", | ||
"virtualenvs", | ||
"git", | ||
"gitignore", | ||
"github" | ||
], | ||
"ignorePaths": [ | ||
".github/**", | ||
".venv/**" | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- TODO: Replace the title below --> | ||
# Your Title | ||
|
||
## Description | ||
|
||
<!-- TODO: Write a description of the proposed changes --> | ||
|
||
### Type of Change | ||
|
||
<!-- TODO: Fill in the brackets with an `x` next to all types that apply to the proposed changes --> | ||
- [ ] Feature | ||
- [ ] Bug fix | ||
- [ ] Documentation | ||
|
||
## Contributors | ||
|
||
<!-- TODO: Add your GitHub username below and the GitHub usernames of all other contributors to the proposed changes --> | ||
- @ | ||
|
||
## Reminder | ||
|
||
All GitHub Actions should be in a passing state before any pull request is merged. |
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# This GitHub Actions workflow contains two jobs: | ||
# -- First, Lint uses the latest Ubuntu image and Python 3.9 to check | ||
# the code and writing for defects, using the Poetry lint task | ||
# | ||
# -- Second, Test uses a strategy matrix to test the code with different | ||
# Python versions and determine code coverage, using the Poetry test task | ||
|
||
name: Lint and Test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Setup Python 3.9 | ||
uses: actions/setup-python@v2 | ||
id: setup-python | ||
with: | ||
python-version: 3.9 | ||
- name: Install Poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: 1.1.12 | ||
- name: Setup Poetry | ||
run: | | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
poetry env info | ||
- name: Install dependencies | ||
run: poetry install --no-interaction --no-ansi | ||
- name: Lint code | ||
run: poetry run task lint | ||
- name: Lint markdown | ||
uses: DavidAnson/markdownlint-cli2-action@v4 | ||
- name: Check spelling | ||
uses: zwaldowski/cspell-action@v1 | ||
with: | ||
paths: "*.md" | ||
config: .github/cspell.json | ||
|
||
test: | ||
name: Test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ["3.8", "3.9", "3.10"] | ||
env: | ||
OS: ${{ matrix.os }} | ||
PYTHON: ${{ matrix.python-version }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Setup Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: 1.1.12 | ||
- name: Setup Poetry | ||
run: | | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
poetry env info | ||
- name: Install dependencies | ||
run: poetry install --no-interaction --no-ansi | ||
- name: Execute tests | ||
run: poetry run task test |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
.cache | ||
.pytest_cache/ | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# Environment | ||
.venv | ||
|
||
# Temporary files | ||
*~ | ||
*.swp |
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# project-template | ||
|
||
Simple Python project template with basic CI (Continuous Integration) and | ||
developer support infrastructure. The GitHub Actions workflow executes | ||
[pytest](https://pytest.org/) (with | ||
[coverage](https://pypi.org/project/pytest-cov/)) and | ||
[pylint](https://pylint.org/) using the Poetry configuration, and checks | ||
markdown with [markdownlint](https://github.com/DavidAnson/markdownlint) and | ||
spelling with [cspell](https://cspell.org/). | ||
|
||
## Requirements | ||
|
||
- [Python](https://realpython.com/installing-python/) | ||
- [Pipx](https://pypa.github.io/pipx/installation/) | ||
- [Poetry](https://python-poetry.org/docs/#installing-with-pipx) | ||
|
||
## Usage | ||
|
||
### Installing Python dependencies | ||
|
||
After cloning this project, you will likely want to instruct Poetry to create a | ||
virtual environment and install the Python packages (like pytest and pylint) | ||
listed in `pyproject.toml`. You also likely want to configure Poetry to create | ||
that virtual environment in your local project folder, so that text editors like | ||
Visual Studio Code can find the environment and provide code completion. | ||
|
||
To configure Poetry to create a virtual environment in your local project folder | ||
(only needed once per system): | ||
|
||
```bash | ||
poetry config virtualenvs.create true | ||
poetry config virtualenvs.in-project true | ||
``` | ||
|
||
To install Python dependencies: | ||
|
||
```bash | ||
poetry install | ||
``` | ||
|
||
### Running tasks | ||
|
||
This project uses the [taskipy](https://github.com/illBeRoy/taskipy) task runner | ||
to simplify testing and linting. You can see the actual commands run when tasks | ||
are executed under the `[tool.taskipy.tasks]` header in `pyproject.toml`. | ||
|
||
- **Test** your code with `poetry run task test` | ||
- **Lint** your code with `poetry run task lint` | ||
|
||
### Writing code | ||
|
||
This project provides a basic "hello world" example package named `hello`. When | ||
using this template, you should replace or rename this package (and mentions of | ||
it in `pyproject.toml`) with your own package. |
Empty file.
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"""This module implements the ability to greet users by name.""" | ||
|
||
def greet(name): | ||
"""Greet a user by name.""" | ||
greeting = f"Hello, {name}!" | ||
print(greeting) | ||
|
||
|
||
if __name__ == "__main__": | ||
greet("World") |
Oops, something went wrong.