Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondop committed Aug 17, 2022
1 parent a5d43ec commit c678086
Show file tree
Hide file tree
Showing 10 changed files with 827 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If the PR is unfinished, add '[DRAFT]' in your PR title, e.g., '[DRAFT] Your PR title ...'.
2. Be sure to keep the PR description updated to reflect all changes.
3. Please write your PR title to summarize what this PR proposes.
4. If applicable, include the corresponding issue number in the PR title and link it in the body.
-->

## Description

<!--
- Describe why we need the change.
- Describe what this PR changes.
If this PR resolves an issue be sure to include "Resolves #XXX" to correctly link and close the issue upon merge. Please link the JIRA issue if there is an associated one.
-->

## How was this patch tested?

<!--
If tests were added, say they were added here. Please make sure to test the changes thoroughly including negative and positive cases if possible.
If the changes were tested in any way other than unit tests, please clarify how you tested step by step (ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future).
If the changes were not tested, please explain why.
-->



## Does this require an update to the documentation?
80 changes: 80 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@


name: Delta Acceptance Testing

on:
pull_request:
push:
branches:
- main

env:
PYTHON_VERSION: 3.9.13


jobs:

analyze:
name: Lint Code
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'poetry'

- name: Install dependencies and project in dev mode
run: |
make install
- name: Lint
run: make lint-base lint-mypy

test-pipeline:
name: Run tests
runs-on: ubuntu-latest

steps:

- name: Checkout repository
uses: actions/checkout@v2

- name: Install poetry
run: |
pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'poetry'

- name: Install dependencies and project in dev mode
run: |
make install
- name: Run unit tests
run: |
make test
env:
PY_COLORS: 1

- name: Report
run: |
make report-coverage
- name: Upload code coverage result to CodeCov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
fail_ci_if_error: true
verbose: true
163 changes: 163 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# 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

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

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

# Coverage
junit
56 changes: 56 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@


POETRY_RUN := poetry run
BLUE=\033[0;34m
NC=\033[0m # No Color
PROJ='dat'

.PHONY: update install help autolint lint-mypy lint-base lint report-coverage lint-bandit lint-flake8 test

autolint: ## Autolint the code
@echo "\n${BLUE}Running autolinting...${NC}\n"
@${POETRY_RUN} autopep8 ${PROJ}/* -r -i --experimental
@${POETRY_RUN} isort ${PROJ} tests/
@${POETRY_RUN} unify -r -i ${PROJ} tests/

lint-mypy: ## Just run mypy
@echo "\n${BLUE}Running mypy...${NC}\n"
@${POETRY_RUN} mypy --show-error-codes ${PROJ}

lint-flake8: ## Run the flake8 linter
@echo "\n${BLUE}Running flake8...${NC}\n"
@${POETRY_RUN} flake8 .

lint-bandit: ## Run bandit
@echo "\n${BLUE}Running bandit...${NC}\n"
@${POETRY_RUN} bandit -r ${PROJ}

lint-base: lint-flake8 lint-bandit ## Just run the linters without autolinting

lint: autolint lint-base lint-mypy ## Autolint and code linting

install: ## Install Python Dependencies via poetry
@echo "\n${BLUE}Installing dependencies${NC}\n"
poetry install

test-only: ## Run a single test like so make test_name='tests/test_tables.py' test-only
@${POETRY_RUN} python -m pytest --durations=0 -v $(test_name)

test: ## Run all the tests with code coverage.
@echo "\n${BLUE}Running pytest with coverage...${NC}\n"
@${POETRY_RUN} coverage erase;
@${POETRY_RUN} coverage run --branch -m pytest tests \
--junitxml=junit/test-results.xml \
--doctest-modules -vv --capture=no


report-coverage: ## Report coverage
@${POETRY_RUN} coverage report
@${POETRY_RUN} coverage html
@${POETRY_RUN} coverage xml

help: ## Show this help
@egrep -h '\s##\s' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; \
{printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
Empty file added dat/__init__.py
Empty file.
Loading

0 comments on commit c678086

Please sign in to comment.