Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mousa Zeid Baker committed Dec 13, 2022
0 parents commit 0a48f00
Show file tree
Hide file tree
Showing 22 changed files with 3,047 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Workflow to release our package

name: Release
on:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
steps:
- name: Release
id: release
uses: google-github-actions/release-please-action@v3
with:
# https://github.com/google-github-actions/release-please-action#configuration
release-type: python
changelog-types: >
[
{"type": "build", "section": "🏗️ Build System", "hidden": true},
{"type": "chore", "section": "🧹 Miscellaneous Chores", "hidden": true},
{"type": "ci", "section": "👷 Continuous Integration", "hidden": true},
{"type": "docs", "section": "📝 Documentation"},
{"type": "feat", "section": "🚀 Features"},
{"type": "fix", "section": "🐛 Bug Fixes"},
{"type": "perf", "section": "⚡ Performance Improvements"},
{"type": "refactor", "section": "♻️ Code Refactoring", "hidden": true},
{"type": "revert", "section": "⏪️ Reverts"},
{"type": "style", "section": "💄 Styles", "hidden": true},
{"type": "test", "section": "✅ Tests", "hidden": true}
]
include-v-in-tag: false
publish:
name: Publish
runs-on: ubuntu-latest
needs: release
# only run when a new release is created
if: ${{ needs.release.outputs.release_created }}
strategy:
fail-fast: true
matrix:
environment: [ testpypi, pypi ]
environment: ${{ matrix.environment }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.2.1

- name: Build
run: poetry build

- name: Publish testpypi
if: ${{ matrix.environment=='testpypi' }}
env:
POETRY_REPOSITORIES_TESTPYPI_URL: https://test.pypi.org/legacy/
POETRY_HTTP_BASIC_TESTPYPI_USERNAME: __token__
POETRY_HTTP_BASIC_TESTPYPI_PASSWORD: ${{secrets.TESTPYPI_API_TOKEN}}
run: poetry publish --repository testpypi

- name: Publish pypi
if: ${{ matrix.environment=='pypi' }}
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: __token__
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{secrets.PYPI_API_TOKEN}}
run: poetry publish
50 changes: 50 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow to test our package

name: Test

on:
pull_request:
branches:
- '*'

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.3.0

- name: Install dependencies
run: poetry install

- name: Lint
run: |
source $(poetry env info --path)/bin/activate
pre-commit install --install-hooks
pre-commit run --all-files
pre-commit run commitizen-branch --hook-stage push
- name: Test
run: |
source $(poetry env info --path)/bin/activate
pytest tests -vv
poetry up --help
- name: Build
run: poetry build
132 changes: 132 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
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/

# 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
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.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

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__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/

# IntelliJ’s project specific settings files
.idea
46 changes: 46 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# https://pre-commit.com/#pre-commit-configyaml---top-level
default_stages:
- commit
default_install_hook_types:
- pre-commit
- commit-msg
- pre-push
exclude: pypoetry
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace # https://github.com/pre-commit/pre-commit-hooks/tree/v4.3.0#trailing-whitespace
- id: end-of-file-fixer # https://github.com/pre-commit/pre-commit-hooks/tree/v4.3.0#end-of-file-fixer
- id: check-json # https://github.com/pre-commit/pre-commit-hooks/tree/v4.3.0#check-json
- id: check-yaml # https://github.com/pre-commit/pre-commit-hooks/tree/v4.3.0#check-yaml
- id: check-toml # https://github.com/pre-commit/pre-commit-hooks/tree/v4.3.0#check-toml
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies:
- flake8-black
- flake8-isort
- repo: https://github.com/commitizen-tools/commitizen
rev: v2.37.1
hooks:
- id: commitizen
stages:
- commit-msg
- id: commitizen-branch
stages:
- push
args:
- --rev-range
- origin/master..HEAD
always_run: true
pass_filenames: false
Loading

0 comments on commit 0a48f00

Please sign in to comment.