diff --git a/.flake8 b/.flake8 index 1d1c7f5..01e81a0 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,6 @@ # vim: ft=cfg [flake8] +max-line-length = 88 max-complexity = 7 docstring-convention=google diff --git a/Makefile b/Makefile index 1d0b397..342d180 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ PYTHON := python3 VENV := .venv # Minimum % coverage for tests to succeed MIN_COV := 50 -SRC := setup.py app tests +SRC := setup.py config_skeleton tests # =====GENERAL===== @@ -34,18 +34,19 @@ venv: $(VENV)/bin/activate ## Formatting & linting ### Format the codebase using black format: venv - @ '$(VENV)'/bin/black $(SRC) @ '$(VENV)'/bin/isort $(SRC) + @ '$(VENV)'/bin/black $(SRC) .PHONY: format ### Lint using black & flake8 lint: venv @ '$(VENV)'/bin/flake8 $(SRC) @ '$(VENV)'/bin/black --check $(SRC) + @ '$(VENV)'/bin/isort --check $(SRC) .PHONY: lint ## Testing test: venv - @ '$(VENV)'/bin/pytest --cov=app --cov-fail-under='$(MIN_COV)' tests/ + @ '$(VENV)'/bin/pytest --cov=config_skeleton --cov-fail-under='$(MIN_COV)' tests/ .PHONY: test diff --git a/app/__init__.py b/app/__init__.py deleted file mode 100644 index ef4e454..0000000 --- a/app/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Main module for the app.""" diff --git a/config_skeleton/__init__.py b/config_skeleton/__init__.py new file mode 100644 index 0000000..74c7c22 --- /dev/null +++ b/config_skeleton/__init__.py @@ -0,0 +1,11 @@ +"""Main module for the app.""" +from .exceptions import InvalidKeyError, InvalidValueError, MissingKeyError +from .skeleton import merge, merge_with_skeleton + +__all__ = [ + "InvalidKeyError", + "InvalidValueError", + "MissingKeyError", + "merge", + "merge_with_skeleton", +] diff --git a/app/exceptions.py b/config_skeleton/exceptions.py similarity index 97% rename from app/exceptions.py rename to config_skeleton/exceptions.py index 34ff26e..af3c97c 100644 --- a/app/exceptions.py +++ b/config_skeleton/exceptions.py @@ -48,8 +48,7 @@ class InvalidValueError(Exception): actual: name of the actual type """ self.message = ( - f"Invalid value for key {key}: expected {expected}, " - f"got {actual}" + f"Invalid value for key {key}: expected {expected}, " f"got {actual}" ) super().__init__() diff --git a/app/skeleton.py b/config_skeleton/skeleton.py similarity index 95% rename from app/skeleton.py rename to config_skeleton/skeleton.py index e591a5b..2c9cd20 100644 --- a/app/skeleton.py +++ b/config_skeleton/skeleton.py @@ -37,9 +37,7 @@ def merge(*dicts: [Dict]) -> Dict: if type(value) == dict: # Merge the two sub-dictionaries output[key] = ( - merge(output[key], value) - if type(output.get(key)) == dict - else value + merge(output[key], value) if type(output.get(key)) == dict else value ) else: diff --git a/pyproject.toml b/pyproject.toml index a973db2..b63d6d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,9 +2,6 @@ requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" -[tool.black] -line-length = 79 - [tool.isort] profile = "black" multi_line_output = 3 diff --git a/setup.cfg b/setup.cfg index 3748eb5..e687c30 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ name = config-skeleton version = 0.0.1 [options] -packages = app +packages = config_skeleton install_requires = [options.extras_require] diff --git a/tests/test_dict_merge.py b/tests/test_dict_merge.py index 2da81bf..ea7f5de 100644 --- a/tests/test_dict_merge.py +++ b/tests/test_dict_merge.py @@ -1,5 +1,5 @@ """Tests for the skeleton module.""" -from app.skeleton import merge +from config_skeleton import merge def test_merge_empty(): diff --git a/tests/test_skeleton.py b/tests/test_skeleton.py index a0d0128..e6f41d8 100644 --- a/tests/test_skeleton.py +++ b/tests/test_skeleton.py @@ -1,8 +1,7 @@ """Tests wether the skeleton merge works.""" import pytest -from app.exceptions import InvalidKeyError, MissingKeyError -from app.skeleton import merge_with_skeleton +from config_skeleton import InvalidKeyError, MissingKeyError, merge_with_skeleton def test_single_invalid_key():