Skip to content
This repository was archived by the owner on Oct 3, 2020. It is now read-only.

Commit 775595f

Browse files
authored
Switch to poetry & black (#49)
* Pipenv -> poetry * format code with black * fix types for mypy * ignore mypy cache * use poetry
1 parent 48dd6a8 commit 775595f

28 files changed

+1704
-819
lines changed

.flake8

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length=240
3+
ignore=E722,W503

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ dist/
1010
*.bak
1111
htmlcov/
1212
.pytest_cache/
13-
.vscode
13+
.vscode
14+
.mypy_cache

.travis.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
dist: xenial
1+
dist: bionic
22
sudo: yes
33
language: python
44
python:
55
- "3.7"
66
services:
77
- docker
88
install:
9-
- pip install pipenv
10-
- pipenv install --dev
9+
- pip install poetry
1110
script:
1211
- make test docker
1312
after_success:

Dockerfile

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
1-
FROM python:3.7-alpine3.10
2-
MAINTAINER Henning Jacobs <[email protected]>
1+
FROM python:3.8-slim
32

43
WORKDIR /
54

6-
COPY Pipfile.lock /
7-
COPY pipenv-install.py /
5+
RUN pip3 install poetry
86

9-
RUN /pipenv-install.py && \
10-
rm -fr /usr/local/lib/python3.7/site-packages/pip && \
11-
rm -fr /usr/local/lib/python3.7/site-packages/setuptools
7+
COPY poetry.lock /
8+
COPY pyproject.toml /
129

13-
FROM python:3.7-alpine3.10
10+
RUN poetry config virtualenvs.create false && \
11+
poetry install --no-interaction --no-dev --no-ansi
12+
13+
FROM python:3.8-slim
1414

1515
WORKDIR /
1616

17-
COPY --from=0 /usr/local/lib/python3.7/site-packages /usr/local/lib/python3.7/site-packages
17+
# copy pre-built packages to this image
18+
COPY --from=0 /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
19+
20+
# now copy the actual code we will execute (poetry install above was just for dependencies)
1821
COPY kube_janitor /kube_janitor
1922

2023
ARG VERSION=dev
24+
2125
RUN sed -i "s/__version__ = .*/__version__ = '${VERSION}'/" /kube_janitor/__init__.py
2226

2327
ENTRYPOINT ["python3", "-m", "kube_janitor"]

Makefile

+10-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@ TAG ?= $(VERSION)
66

77
default: docker
88

9-
test:
10-
pipenv run flake8
11-
pipenv run coverage run --source=kube_janitor -m py.test
12-
pipenv run coverage report
9+
.PHONY: install
10+
install:
11+
poetry install
12+
13+
test: install
14+
poetry run flake8
15+
poetry run black --check kube_janitor
16+
poetry run mypy --ignore-missing-imports kube_janitor
17+
poetry run coverage run --source=kube_janitor -m py.test -v
18+
poetry run coverage report
1319

1420
docker:
1521
docker build --build-arg "VERSION=$(VERSION)" -t "$(IMAGE):$(TAG)" .

Pipfile

-18
This file was deleted.

0 commit comments

Comments
 (0)