Skip to content

Commit

Permalink
Version 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian4cast committed Jul 4, 2022
0 parents commit 3a096ab
Show file tree
Hide file tree
Showing 38 changed files with 5,791 additions and 0 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/check-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: build

on:
push:
branches: [ main ]

pull_request:
branches: [ main ]

release:
types: [created]

jobs:
quality:
name: Lint
runs-on: ubuntu-latest
container:
image: python:3.7-slim
steps:
- uses: actions/checkout@v2
- run: pip install black flake8 pyupgrade isort mypy
- run: isort climetlab_maelstrom_power_production tests
- run: |
pyupgrade \
--py3-plus \
--py36-plus \
--py37-plus \
$(find climetlab_maelstrom_power_production tests | grep "\.py$")
- run: black --config pyproject.toml climetlab_maelstrom_power_production tests
- run: flake8 --config pyproject.toml climetlab_maelstrom_power_production tests
- run: mypy --config-file pyproject.toml climetlab_maelstrom_power_production

checks:
strategy:
fail-fast: false
matrix:
platform: ["ubuntu-latest"]
python-version: ["3.7"]
#platform: ["ubuntu-latest", "macos-latest", "windows-latest"]
#python-version: ["3.6", "3.7", "3.8", "3.9"]
name: Test
runs-on: ubuntu-latest
container:
image: fabianemmi/python-poetry:3.7-1.1.13
steps:
- uses: actions/checkout@v2
- name: Install package
run: poetry install --extras ci-tests --extras notebooks
- name: Run tests
run: |
poetry run pytest tests \
--cov=climetlab_maelstrom_power_production --cov-report term --cov-report html \
--suppress-no-test-exit-code \
--junitxml=./report/pytest.xml
- name: Run notebooks utils tests
run: |
poetry run pytest notebooks/utils
deploy:
if: ${{ github.event_name == 'release' }}
name: Upload to pypi
needs: checks
runs-on: ubuntu-latest
container:
image: fabianemmi/python-poetry:3.7-1.1.13
steps:
- uses: actions/checkout@v2
- name: Check version
run: |
export RELEASE=${GITHUB_REF##*/}
poetry version $RELEASE
export VERSION=$(poetry version -s)
echo $RELEASE
echo $VERSION
test $RELEASE = $VERSION
- name: Install dependencies
run: poetry install --no-dev
- name: Build and publish
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry publish --build \
--username $PYPI_USERNAME \
--password $PYPI_PASSWORD
129 changes: 129 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# 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/
79 changes: 79 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
default_language_version:
python: python3.7

repos:
- repo: local
hooks:
- id: jupyter-nb-clear-output
name: jupyter-nb-clear-output
files: \.ipynb$
language: system
entry: jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace
- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
hooks:
- id: pyupgrade
args: [
"--py3-plus",
"--py36-plus",
"--py37-plus",
]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
args: ["--maxkb=775"]
- id: check-builtin-literals
- id: check-docstring-first
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
args: ["--allow-multiple-documents"]
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: ["--config", "pyproject.toml"]
files: (climetlab_maelstrom_power_production|tests)
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: isort (python)
- id: isort
name: isort (cython)
types: [cython]
- id: isort
name: isort (pyi)
types: [pyi]
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
files: (climetlab_maelstrom_power_production|tests)
args: ["--config", "pyproject.toml"]
additional_dependencies: [
flake8-bandit,
flake8-blind-except,
flake8-builtins-unleashed,
flake8-bugbear,
flake8-comprehensions,
flake8-docstrings,
flake8-eradicate,
flake8-mutable,
flake8-pytest-style,
pep8-naming,
pydocstyle
]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.961
hooks:
- id: mypy
files: climetlab_maelstrom_power_production
args: ["--config-file", "pyproject.toml"]
additional_dependencies: [xarray, pandas]
Loading

0 comments on commit 3a096ab

Please sign in to comment.