Skip to content

Commit

Permalink
adds project skeleton and initial dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolfix committed Jan 3, 2023
0 parents commit 8bffd6f
Show file tree
Hide file tree
Showing 8 changed files with 2,364 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.idea
.direnv
.mypy_cache
.pytest_cache
htmlcov
.coverage
__pycache__
.eggs
.egg-info
_storage
_test_storage
Dockerfile
.md
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# do not look above
root = true

[*]
end_of_line = lf
insert_final_newline = false
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4
max_line_length = 200

[{Makefile,**.mk}]
# Use tabs for indentation (Makefiles require tabs)
indent_style = tab

[*.{yaml,yml,js,md}]
indent_size = 2
137 changes: 137 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@

# temp requirements generated by poetry
_gen_requirements*.txt
_storage
**/_storage
_test_storage
**/_test_storage
_secrets/
_backup_storage/
experiments/*
# !experiments/
# !experiments/pipeline/
# !experiments/pipeline/*
secrets.toml
*.session.sql

# 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/
**/*.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/
**/.coverage
**/.coverage.*
**/.cache
**/nosetests.xml
**/coverage.xml
**/*.cover
**/.hypothesis/
**/.pytest_cache/
**/htmlcov/

# Translations
**/*.mo
**/*.pot

# Django stuff:
**/*.log
**/.static_storage/
**/.media/
**/local_settings.py

# Flask stuff:
**/instance/
**/.webassets-cache

# Scrapy stuff:
**/.scrapy

# Sphinx documentation
**/docs/_build/

# PyBuilder
**/target/

# Jupyter Notebook
**/.ipynb_checkpoints

# pyenv
**/.python-version

# celery beat schedule file
**/celerybeat-schedule

# SageMath parsed files
**/*.sage.py

# Environments
**/.env
**/.venv
**/env/
**/venv/
**/ENV/
**/env.bak/
**/venv.bak/
**/.direnv

# Spyder project settings
**/.spyderproject
**/.spyproject

# Rope project settings
**/.ropeproject

# mkdocs documentation
**/site

# mypy
**/.mypy_cache/

# jetbrains cache
**/.idea

# VS Code
**/.vscode

# MAC OS X
**/.DS_Store
.DS_Store

# temp
tmp
**/tmp
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.PHONY: install-poetry has-poetry dev lint test
.SILENT:has-poetry

help:
@echo "make"
@echo " install-poetry"
@echo " installs newest poetry version"
@echo " dev"
@echo " prepares development env"
@echo " lint"
@echo " runs flake and mypy on pipelines that are typed"
@echo " test"
@echo " tests all the components including destinations"

install-poetry:
ifneq ($(VIRTUAL_ENV),)
$(error you cannot be under virtual environment $(VIRTUAL_ENV))
endif
curl -sSL https://install.python-poetry.org | python3 -

has-poetry:
poetry --version

dev: has-poetry
poetry install

lint:
./check-package.sh
poetry run mypy --config-file mypy.ini pipelines/chess
poetry run flake8 --max-line-length=200 pipelines
poetry run flake8 --max-line-length=200 tests
29 changes: 29 additions & 0 deletions check-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -e
set -u

shopt -s dotglob
shopt -s nullglob
# verifies if python packages have proper structure
# find all directories not containing __init__
error=
while IFS= read -r d; do
myarray=(`find $d -maxdepth 1 -name "*.py"`)
if [ ${#myarray[@]} -gt 0 ]; then
if [[ $@ == *--fix* ]]; then
echo Will create "$d/__init__.py"
touch "$d/__init__.py"
else
echo Folder "$d" lacks __init__.py file
error="yes"
fi
fi
done < <(find . -mindepth 1 -not -path "./docs/website*" -type d -regex "^./[^.^_].*" '!' -exec test -e "{}/__init__.py" ';' -print)

if [ -z $error ]; then
exit 0
fi

# error in package
exit 1
20 changes: 20 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[mypy]
python_version=3.8
ignore_missing_imports=true
strict_optional=false
warn_redundant_casts=true
# disallow_any_explicit=true
disallow_any_generics=true
disallow_untyped_defs=true
check_untyped_defs=true
warn_return_any=true
namespace_packages=true
warn_unused_ignores=true


;disallow_any_generics=false
;disallow_untyped_defs=false
;warn_return_any=false

[mypy-tests.*]
; ignore_errors=true
Loading

0 comments on commit 8bffd6f

Please sign in to comment.