Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Reference workflow provided by (c) GitHub
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: example
name: Flake8 and pytest

on:
push:
Expand All @@ -11,23 +11,19 @@ on:
branches: [ master ]

jobs:
build:
pytest:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Copy scripts and data to "/tests"
run: |
cp main.py tests
cp data/example_data.csv .
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -41,4 +37,4 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest tests/tests.py
pytest -W error --durations=10 --durations-min=1.0 tests/
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ A template repository for linting, testing, GUI building and dockerizing python
## Checklist

- Replace `YOURUSERNAME` and `IMAGENAME` in `.github/workflows/docker-image.yml` [or delete file].
- Replace `example` [line 5] with an appropriate name in `.github/workflows/python-app.yml`.
- Setup the appropriate copy statements [line >29] in `.github/workflows/python-app.yml`.
- Replace test data in `data` with your own data [or delete if you don't have test data].
- Adjust `.gitattributes` according to your needs.
- Adjust `.gitignore` according to your needs.
- Setup your `CITATION.cff` according to your needs [or delete file].
- Replace dummy values in `Dockerfile` and write image instructions.
- Replace copyright name in `LICENSE`.
- Replace lines 3 - 6 and write your script in `main.py`.
- Replace lines 3 - 6 and write your gui in `gui/streamlit_app.py`.
- Replace lines 3 - 6 and write tests in `tests/tests.py`.
- Replace lines 10 - 13 and write your script in `main.py`.
- Replace lines 10 - 13 and write your gui in `gui/streamlit_app.py`.
- Replace lines 3 - 6 and write tests in `tests/test_main.py`.
- Add your requirements to `requirements.txt`.
- Document your script with [Sphinx](https://www.sphinx-doc.org/):
- Install Sphinx and the [PyData](https://github.com/pydata/pydata-sphinx-theme) theme: `pip install sphinx pydata-sphinx-theme`.
Expand Down
1 change: 1 addition & 0 deletions gui/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
1 change: 1 addition & 0 deletions gui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# README
9 changes: 9 additions & 0 deletions gui/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[project]
name = "GUI"
version = "0.0.1"
description = "GUI"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"streamlit>=1.49.0",
]
7 changes: 7 additions & 0 deletions gui/streamlit_app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/usr/bin/env python3
#
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "streamlit",
# ]
# ///

# SCRIPT NAME GUI
# 2024 (c) Micha Johannes Birklbauer
Expand Down
7 changes: 7 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/usr/bin/env python3
#
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "pandas",
# ]
# ///

# SCRIPT NAME
# 2024 (c) Micha Johannes Birklbauer
Expand Down
3 changes: 2 additions & 1 deletion pyrightconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
],

"exclude": [
"**/__pycache__"
"**/__pycache__",
"**/.venv"
],

"pythonVersion": "3.7",
Expand Down
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
minversion = 6.0
pythonpath = .
testpaths =
tests
7 changes: 7 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"

# Enable auto-formatting of code examples in docstrings.
docstring-code-format = true

# Set the line length limit used when formatting code snippets in
# docstrings.
docstring-code-line-length = "dynamic"
2 changes: 1 addition & 1 deletion tests/tests.py → tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def test1():
import pandas as pd

df = pd.read_csv("example_data.csv")
df = pd.read_csv("data/example_data.csv")

from main import my_product

Expand Down