Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add various functions #1

Merged
merged 33 commits into from
Sep 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ exclude =
ignore =
# FIXME
T100,
T101,
# shadowing a python builtin -> quite useful for function parameters
A002,
# class attribute named after a python builtin
A003,
# missing trailing comma
Expand Down
5 changes: 4 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ repos:
rev: v1.9.0
hooks:
- id: python-no-log-warn

- repo: https://github.com/guilatrova/tryceratops
rev: v1.1.0
hooks:
- id: tryceratops
# typing
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971
Expand Down
45 changes: 31 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,54 @@
SHELL := /bin/bash
.PHONY : all

SOURCE_CODE = src
SOURCE_CODE_MAIN = src/silex
SOURCE_CODE_TEST = src/tests
SOURCE_CODE_TEST_BDD = src/tests/bdd
COVERAGE_FAIL_UNDER = 90

########
# CORE #
########

# commands specific to your project such as starting a web server

########
# DEV #
########

help:
cat Makefile

# run all checks
pre_commit_force:
pre-commit run --all-files

format_code:
python -m black src
python -m isort --profile black src
# format code
fmt:
python -m black $(SOURCE_CODE)
python -m isort --profile black $(SOURCE_CODE)

# run all tests
test: test_static test_coverage

test_bdd:
python -m behave src/tests/bdd
python -m behave $(SOURCE_CODE_TEST_BDD)

test_bdd_wip:
python -m behave src/tests/bdd --no-capture --wip
python -m behave $(SOURCE_CODE_TEST_BDD) --no-capture --wip --color

test_static:
python -m black --check src
python -m isort --profile black --check src
python -m flake8 src
python -m bandit -r src/silex --exclude src/tests
python -m safety check
python -m mypy src --exclude src/tests --explicit-package-bases --namespace-packages --ignore-missing-imports --show-error-codes
python -m black --check $(SOURCE_CODE)
python -m isort --profile black --check $(SOURCE_CODE)
python -m flake8 $(SOURCE_CODE)
python -m bandit -r $(SOURCE_CODE_MAIN) --exclude $(SOURCE_CODE_TEST)
# python -m safety check # licensed for non-commercial use or provide your API key with --key
python -m mypy $(SOURCE_CODE) --exclude $(SOURCE_CODE_TEST) --explicit-package-bases --namespace-packages --ignore-missing-imports --show-error-codes

test_coverage:
python -m coverage run --source=src/silex -m pytest --disable-pytest-warnings -x -s src/silex --doctest-modules
python -m coverage run --source=src/silex --append -m behave src/tests/bdd
python -m coverage report --show-missing --fail-under=95
python -m coverage run --source=$(SOURCE_CODE_MAIN) -m pytest --disable-pytest-warnings -x -s $(SOURCE_CODE_MAIN) --doctest-modules
python -m coverage run --source=$(SOURCE_CODE_MAIN) --append -m behave $(SOURCE_CODE_TEST_BDD)
python -m coverage report --show-missing --fail-under=$(COVERAGE_FAIL_UNDER)
python -m coverage html -d coverage_html
python -m coverage xml -o coverage-reports/coverage-ci.xml
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# Silex

[![Python](https://img.shields.io/badge/Python3.8-Python?style=for-the-badge&logo=Python)](https://www.python.org/downloads/release/python-380/)
![Apache Spark](https://img.shields.io/static/v1?style=for-the-badge&message=Apache+Spark&color=E25A1C&logo=Apache+Spark&logoColor=FFFFFF&label=)
[![Manager: Poetry](https://img.shields.io/badge/Manager-Poetry-blue?style=for-the-badge)](https://python-poetry.org/)
[![Test: BDD](https://img.shields.io/badge/Test-BDD-critical?style=for-the-badge)](https://github.com/behave/behave)
[![Test: Doctest](https://img.shields.io/badge/Test-Doctest-success?style=for-the-badge)](https://docs.python.org/3/library/doctest.html)

[![Linter](https://img.shields.io/badge/Codestyle-Black-black?style=for-the-badge)](https://github.com/psf/black)
[![Code style: Black](https://img.shields.io/badge/Codestyle-Black-black?style=for-the-badge)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=for-the-badge&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Linter: Flake8](https://img.shields.io/badge/Linter-Flake8-black?style=for-the-badge)](https://github.com/PyCQA/flake8)
[![try/except style: tryceratops](https://img.shields.io/badge/try%2Fexcept%20style-tryceratops%20%F0%9F%A6%96%E2%9C%A8-black?style=for-the-badge)](https://github.com/guilatrova/tryceratops)

Silex adds more sparks to your project!
[![Typing: MyPy](https://img.shields.io/badge/Typing-MyPy-blue?style=for-the-badge)](https://github.com/python/mypy)
[![Security: Bandit](https://img.shields.io/badge/Security-Bandit-critical?style=for-the-badge)](https://github.com/PyCQA/bandit)


[![Git: Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&style=for-the-badge&logoColor=white)](https://pre-commit.com/)
[![Git: Conventional](https://img.shields.io/badge/Git-conventional-ff69b4?style=for-the-badge)](https://www.conventionalcommits.org)
[![Version: Semantic](https://img.shields.io/badge/Version-Semantic-black?style=for-the-badge)](https://semver.org/)

![Apache Spark](https://img.shields.io/static/v1?style=for-the-badge&message=Apache+Spark+%20+3&color=E25A1C&logo=Apache+Spark&logoColor=FFFFFF&label=)

## TLDR

Expand All @@ -16,11 +29,13 @@ Silex is a Data Engineering library to extend PySpark.
### Pre-requisites

- Python 3.8 or above
- Spark 3.2 or above
- Spark 3 or above

### Installation

`# TODO`
```shell
# TODO
```

### Usage

Expand All @@ -34,18 +49,11 @@ Silex is a Data Engineering library to extend PySpark.
# install poetry and python 3.8, using pyenv for instance

cd silex
poetry install
poetry env use path/to/python3.8 # e.g. ~/.pyenv/versions/3.8.12/bin/python
poetry shell
poetry install
pre-commit install

make help
# or open Makefile to learn about available commands for development
```

We use:

- [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
- [git pre-commit](https://pre-commit.com/) to increase code quality before committing
- `Squashed Pull Request` or `Rebased Pull Request` (not too many commits)
- [doc-tests](https://docs.python.org/3/library/doctest.html) for simple or pure functions
- Behavior-driven development (BDD) using [behave](https://github.com/behave/behave) for non-doc-tests
75 changes: 0 additions & 75 deletions docs/private_repositories.md

This file was deleted.

Loading