Skip to content

Commit

Permalink
Pipeline added
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverZott committed Dec 4, 2024
1 parent 693caba commit d8dcd42
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 11 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Python package

on:
push:
branches:
- main
- "*"
paths-ignore:
- "docs/**"
- "tests/**"
- "README.md"
pull_request:
branches:
- main
workflow_dispatch:


jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
pip install pytest
- name: Run tests
run: pytest

- name: Run Ruff
run: ruff check --output-format=github src
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"tamasfe.even-better-toml",
"charliermarsh.ruff",
"DavidAnson.vscode-markdownlint",
"GitHub.vscode-github-actions",
]
}
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"request": "launch",
"program": "${workspaceFolder}/venv/Scripts/pytest.exe",
"args": [
"${workspaceFolder}/test"
"${workspaceFolder}/tests"
],
"console": "integratedTerminal",
"justMyCode": false
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Python Project Template

This is just a template/skeleton for a plain python project. Provides basic structure and some useful tools, e.g.
A simple template/skeleton for a plain python project. It providing basic structure and some useful tools and sample-code like

- linter / formatter / type-checker
- vs code launch/settings file
- vs code launch/tasks/settings file
- package installation example using **setuptools** package
- pytest example using **pytest** package
- github example pipeline to run unit tests

TODO:

- logging
- unit tests
- pipelines
- pre-commit hooks and configuration

## Prerequisites
Expand All @@ -21,23 +22,22 @@ Generate virtual environment and install packages.
```bash
# Create/activate/deactivate venv
python -m venv venv
.\venv\Scripts\activate
source venv/bin/activate
.\venv\Scripts\deactivate
.\venv\Scripts\activate # windows
source venv/bin/activate # linux

# Install packages with activated env and check
python -m pip install --upgrade pip
pip install --upgrade -r ./requirements.txt
pip list

# Freeze and Upgrade current packages
# Freeze / Upgrade current packages
pip freeze > pip_list.txt
pip install --upgrade --force-reinstall -r requirements.txt
```

### VS Code Extensions

In VS Code extensions view use `@recommended` to see all extensions defined in .extensions.json
In VS Code extensions view use `@recommended` to install extensions defined in .extensions.json

### .env file

Expand All @@ -63,7 +63,7 @@ Further:

Tools can be applied manualle in console or automatically in pipeline on commit/PR. Configuration for manual/local usage is done in **settings.json**. Configuration for pipeline/build-tool usage is done via **pyproject.toml**.

Use Ruff instead of flake8 (linter), black (formatter) and isort (import sorter) separately.
Ruff instead of flake8 (linter), black (formatter) and isort (import sorter) separately.

- in root foler: `python .\run_ruff.py`

Expand Down
File renamed without changes.

0 comments on commit d8dcd42

Please sign in to comment.