Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

feat: python package #10

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
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
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "✨ Python"

on:
workflow_dispatch:

jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
#environment: publish
permissions:
contents: read
id-token: write
steps:
- name: Checkout the repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Set up Python 3.12
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: 3.12

- name: Build with Poetry
run: |
pip3 install poetry
poetry build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # v1.8.11
with:
packages-dir: dist/
print-hash: true
32 changes: 16 additions & 16 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
- "dev-requirements.txt"
- ".github/workflows/python.yml"
push:
branches:
- main
paths:
- "**.py"

Expand All @@ -23,11 +25,9 @@ jobs:
matrix:
os: [ubuntu-latest]
supported-python-version: ["3.9", "3.10", "3.11", "3.12"]
best_effort-python-version: ["3.7"]
name: Testing on Python ${{ matrix.supported-python-version }}
continue-on-error: true


runs-on: ${{ matrix.os }}

steps:
Expand All @@ -43,45 +43,45 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r dev-requirements.txt
pip3 install poetry
poetry install

- name: Lint check with Ruff
run: |
if [ ${{ matrix.supported-python-version }} == 3.7 ]; then
ruff check $(git ls-files '*.py') --target-version=py37
poetry run ruff check $(git ls-files '*.py') --target-version=py37
fi
if [ ${{ matrix.supported-python-version }} == 3.8 ]; then
ruff check $(git ls-files '*.py') --target-version=py38
poetry run ruff check $(git ls-files '*.py') --target-version=py38
fi
if [ ${{ matrix.supported-python-version }} == 3.9 ]; then
ruff check $(git ls-files '*.py') --target-version=py39
poetry run ruff check $(git ls-files '*.py') --target-version=py39
fi
if [ ${{ matrix.supported-python-version }} == 3.10 ]; then
ruff check $(git ls-files '*.py') --target-version=py310
poetry run ruff check $(git ls-files '*.py') --target-version=py310
fi
if [ ${{ matrix.supported-python-version }} == 3.11 ]; then
ruff check $(git ls-files '*.py') --target-version=py311
poetry run ruff check $(git ls-files '*.py') --target-version=py311
fi
if [ ${{ matrix.supported-python-version }} == 3.12 ]; then
ruff check $(git ls-files '*.py') --target-version=py312
poetry run ruff check $(git ls-files '*.py') --target-version=py312
fi

- name: Static analysis with MyPy
run: |
mypy $(git ls-files '*.py') --python-version ${{ matrix.supported-python-version }}
poetry run mypy $(git ls-files '*.py') --python-version ${{ matrix.supported-python-version }}

- name: Testing with Pytest
run: |
pytest
poetry run pytest

analyse-best_effort:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
base-python-version: ["3.11"]
best_effort-python-version: ["3.7", "3.8"]
best_effort-python-version: ["3.8"]
name: Static analysis on Python ${{ matrix.best_effort-python-version }}
continue-on-error: true

Expand All @@ -100,9 +100,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r dev-requirements.txt
pip install poetry
poetry install

- name: Static analysis with MyPy
run: |
mypy $(git ls-files '*.py') --python-version ${{ matrix.best_effort-python-version }}
poetry run mypy $(git ls-files '*.py') --python-version ${{ matrix.best_effort-python-version }}
169 changes: 11 additions & 158 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,164 +1,17 @@
# Input / Output files
input/
output/
# visual studio code
.vscode/

# Byte-compiled / optimized / DLL files
# python
venv/
virtualenv/
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
.pytest_cache/
.mypy_cache/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
# lib/ # We use this
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
docs/build_*
dist/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# misc
.DS_Store
8 changes: 0 additions & 8 deletions .trunk/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions .trunk/configs/.markdownlint.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions .trunk/configs/ruff.toml

This file was deleted.

32 changes: 0 additions & 32 deletions .trunk/trunk.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions .vscode/extensions.json

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Thanks for consider contributing.
### `> Python`

> [!IMPORTANT]
> This guide assume that you already installed Python 3.10 or higher and pytest.
> This guide assume that you already installed Python 3.9 or higher and pytest.

Developing the script:

Expand Down
Loading