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

Commit

Permalink
Switch to poetry & black (#49)
Browse files Browse the repository at this point in the history
* Pipenv -> poetry

* format code with black

* fix types for mypy

* ignore mypy cache

* use poetry
  • Loading branch information
hjacobs authored Dec 23, 2019
1 parent 48dd6a8 commit 775595f
Show file tree
Hide file tree
Showing 28 changed files with 1,704 additions and 819 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length=240
ignore=E722,W503
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ dist/
*.bak
htmlcov/
.pytest_cache/
.vscode
.vscode
.mypy_cache
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
dist: xenial
dist: bionic
sudo: yes
language: python
python:
- "3.7"
services:
- docker
install:
- pip install pipenv
- pipenv install --dev
- pip install poetry
script:
- make test docker
after_success:
Expand Down
22 changes: 13 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
FROM python:3.7-alpine3.10
MAINTAINER Henning Jacobs <henning@jacobs1.de>
FROM python:3.8-slim

WORKDIR /

COPY Pipfile.lock /
COPY pipenv-install.py /
RUN pip3 install poetry

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

FROM python:3.7-alpine3.10
RUN poetry config virtualenvs.create false && \
poetry install --no-interaction --no-dev --no-ansi

FROM python:3.8-slim

WORKDIR /

COPY --from=0 /usr/local/lib/python3.7/site-packages /usr/local/lib/python3.7/site-packages
# copy pre-built packages to this image
COPY --from=0 /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages

# now copy the actual code we will execute (poetry install above was just for dependencies)
COPY kube_janitor /kube_janitor

ARG VERSION=dev

RUN sed -i "s/__version__ = .*/__version__ = '${VERSION}'/" /kube_janitor/__init__.py

ENTRYPOINT ["python3", "-m", "kube_janitor"]
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ TAG ?= $(VERSION)

default: docker

test:
pipenv run flake8
pipenv run coverage run --source=kube_janitor -m py.test
pipenv run coverage report
.PHONY: install
install:
poetry install

test: install
poetry run flake8
poetry run black --check kube_janitor
poetry run mypy --ignore-missing-imports kube_janitor
poetry run coverage run --source=kube_janitor -m py.test -v
poetry run coverage report

docker:
docker build --build-arg "VERSION=$(VERSION)" -t "$(IMAGE):$(TAG)" .
Expand Down
18 changes: 0 additions & 18 deletions Pipfile

This file was deleted.

Loading

0 comments on commit 775595f

Please sign in to comment.