diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 37180e9283c9bcc3a11ce8a883e6c84329bdb479..b66cdf80fbd2fed370d6c05797e1b50935911bf8 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -5,12 +5,6 @@ name: CI Tests -on: - push: - branches: [main] - pull_request: - branches: [main] - jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/unit.yaml b/.github/workflows/unit.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a83f60b6badf5fc775bfa88647c3f3ceef295315 --- /dev/null +++ b/.github/workflows/unit.yaml @@ -0,0 +1,18 @@ +name: Unit tests + +on: + workflow_call: + push: + branches: + - main + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + - uses: pre-commit/action@v3.0.0 diff --git a/.gitignore b/.gitignore index 9ea802ae4ed1ba9cb6d9d10ab3f8ef18655f0f9d..efa407c35ff028586b7ef5456c537971fefa5cea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,13 @@ -# used for pyenv -.python-version -### Python template # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] +*$py.class # C extensions *.so # Distribution / packaging .Python -env/ build/ develop-eggs/ dist/ @@ -22,9 +19,12 @@ 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 @@ -39,12 +39,17 @@ pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ +.nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml -test.db +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ # Translations *.mo @@ -52,94 +57,106 @@ test.db # 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/ - -### VirtualEnv template -# Virtualenv -# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ -.Python -[Bb]in -[Ii]nclude -[Ll]ib -[Ss]cripts -pyvenv.cfg -pip-selfcheck.json +# 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/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# 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/ - -### IPythonNotebook template -# Temporary data -.ipynb_checkpoints/ - - -### JetBrains template -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm - -*.iml - -## Directory-based project format: -.idea/ -.vscode +# Spyder project settings +.spyderproject .spyproject -# if you remove the above rule, at least ignore the following: - -# User-specific stuff: -# .idea/workspace.xml -# .idea/tasks.xml -# .idea/dictionaries - -# Sensitive or high-churn files: -# .idea/dataSources.ids -# .idea/dataSources.xml -# .idea/sqlDataSources.xml -# .idea/dynamic.xml -# .idea/uiDesigner.xml - -## File-based project format: -*.ipr -*.iws - -## Plugin-specific files: - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties - -### OSX template -.DS_Store -.AppleDouble -.LSOverride +# Rope project settings +.ropeproject -# Thumbnails -._* +# mkdocs documentation +/site +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json -### SublimeText template -# cache files for sublime text -*.tmlanguage.cache -*.tmPreferences.cache -*.stTheme.cache +# Pyre type checker +.pyre/ -# workspace files are user-specific -*.sublime-workspace +# pytype static type analyzer +.pytype/ -# project files should be checked into the repository, unless a significant -# proportion of contributors will probably not be using SublimeText -# *.sublime-project +# Cython debug symbols +cython_debug/ -# sftp configuration file -sftp-config.json +# 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/ \ No newline at end of file diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 0000000000000000000000000000000000000000..28a711209bfdaa30a4510e73c3754703cc0dac93 --- /dev/null +++ b/noxfile.py @@ -0,0 +1,15 @@ +"""All the process that can be run using nox. + +The nox run are build in isolated environment that will be stored in .nox. to force the venv update, remove the .nox/xxx folder. +""" + +import nox + +nox.options.sessions = ["lint"] + + +@nox.session(reuse_venv=True) +def lint(session): + """Apply the pre-commits.""" + session.install("pre-commit") + session.run("pre-commit", "run", "--all-files", *session.posargs)