Skip to content

Commit

Permalink
Merge pull request #2 from brunorosilva/add-tests
Browse files Browse the repository at this point in the history
Add tests and CICD
  • Loading branch information
brunorosilva authored Apr 12, 2022
2 parents 6676155 + 74a22e2 commit b2b9a3b
Show file tree
Hide file tree
Showing 19 changed files with 1,864 additions and 830 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/plotly_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Plotly Calplot CI
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install Poetry
uses: dschep/[email protected]

- name: Cache Poetry virtualenv
uses: actions/cache@v1
id: cache
with:
path: ~/.virtualenvs
key: poetry-$
restore-keys: |
poetry-$
- name: Install dependencies
run: poetry install

- name: Run formatter
run: make lint

- name: Run checks
run: make checks

163 changes: 162 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,165 @@
drafts/.ipynb_checkpoints/Untitled-checkpoint.ipynb
drafts/Untitled.ipynb
*.pyc
__pycache__
__pycache__


# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

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

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

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

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

# End of https://www.toptal.com/developers/gitignore/api/python
.DS_Store
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ pt_example:
@poetry run python3 examples/plotly_fig_show.py

lint:
black .
isort .
@poetry run black .
@poetry run isort .

install:
@curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
@poetry install

checks:
@poetry run flake8 .
@poetry run vulture .
@poetry run poetry check
@poetry run black .
@poetry run mypy plotly_calplot
@poetry run mypy ./tests/**.py
@poetry run pytest tests/
@poetry run poetry check

pypi_deploy:
@poetry build
@poetry publish
4 changes: 3 additions & 1 deletion plotly_calplot/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .calplot import calplot
from .calplot import calplot # noqa: F401

__version__ = "0.0.2"
Loading

0 comments on commit b2b9a3b

Please sign in to comment.