Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Refactor Dockerfile - Refactor makefile - Update pipfile - Update pipfile.lock - create .flake8 file - create pyproject.toml - update test.yml from github actions - remove python 3.7 support - add python 3.9 support
- Loading branch information
1 parent
b964290
commit 7b71bb9
Showing
25 changed files
with
487 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[flake8] | ||
ignore = E203, W503, E231, E501 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
FROM python:3.7 | ||
ARG PYTHON_VERSION=3.8.16 | ||
FROM python:$PYTHON_VERSION | ||
|
||
ENV PYTHONPATH /usr/src/app/src | ||
ENV PYTHONPATH /app/src:/app/tests | ||
ENV PATH /root/.local/bin/:$PYENV_ROOT/bin/:$PATH | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY Pipfile /usr/src/app/Pipfile | ||
COPY Pipfile.lock /usr/src/app/Pipfile.lock | ||
WORKDIR /app/ | ||
COPY . /app/ | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends curl \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& pip install --upgrade pip \ | ||
&& adduser -u 1000 --gecos "" --disabled-password fever \ | ||
&& chown -R fever:fever /app | ||
RUN pip install pipenv | ||
RUN pipenv install --dev --system --verbose | ||
|
||
RUN pipenv install --dev | ||
CMD ["python"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
ifneq ($(docker),0) | ||
DOCKER_CMD := docker build -t pypendency-image . && docker run --rm -v $(PWD):/app pypendency-image | ||
endif | ||
|
||
run-tests: | ||
python -m unittest | ||
$(DOCKER_CMD) python -m unittest | ||
|
||
pipenv-lock: | ||
$(DOCKER_CMD) python -m pipenv lock | ||
|
||
format: | ||
$(DOCKER_CMD) python -m black --config=pyproject.toml src/ tests/ | ||
|
||
flake8: | ||
$(DOCKER_CMD) python -m flake8 --config=.flake8 src/ tests/ | ||
|
||
mypy: | ||
$(DOCKER_CMD) python -m mypy --config-file=pyproject.toml src/ tests/ | ||
|
||
black: | ||
$(DOCKER_CMD) python -m black --config=pyproject.toml --check src/ tests/ | ||
|
||
lint: flake8 black mypy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[tool.black] | ||
line-length = 120 | ||
target_version = ['py38', 'py39'] | ||
include = '\.pyi?$' | ||
exclude = ''' | ||
/( | ||
| \.git | ||
| \.mypy_cache | ||
| \.tox | ||
| \.venv | ||
)/ | ||
''' | ||
|
||
[tool.mypy] | ||
ignore_missing_imports = true | ||
exclude = [ | ||
'yaml' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,26 @@ | ||
class ContainerLoaderError(Exception): pass | ||
class ContainerLoaderError(Exception): | ||
pass | ||
|
||
|
||
class ResourceNotFound(ContainerLoaderError): | ||
def __init__(self, resource: str): | ||
self.resource = resource | ||
super().__init__( | ||
f"Resource {str(resource)} has not been found" | ||
) | ||
super().__init__(f"Resource {str(resource)} has not been found") | ||
|
||
|
||
class ParsingErrorOnResource(ContainerLoaderError): | ||
def __init__(self, resource: str): | ||
self.resource = resource | ||
super().__init__( | ||
f"Resource {str(resource)} can't be parsed" | ||
) | ||
super().__init__(f"Resource {str(resource)} can't be parsed") | ||
|
||
|
||
class MissingLoaderMethod(ContainerLoaderError): | ||
def __init__(self, resource: str): | ||
self.resource = resource | ||
super().__init__( | ||
f"Resource {str(resource)} requires loader method" | ||
) | ||
super().__init__(f"Resource {str(resource)} requires loader method") | ||
|
||
|
||
class PathNotAbsolute(Exception): | ||
def __init__(self, path: str): | ||
self.path = path | ||
super().__init__( | ||
f"Path is not absolute: {path}" | ||
) | ||
super().__init__(f"Path is not absolute: {path}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.