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

Commit

Permalink
poetry & black (#121)
Browse files Browse the repository at this point in the history
* use poetry instead of Pipenv

* format code with black

* install poetry on Travis

* add flake8 config to ignore conflicts with black
  • Loading branch information
hjacobs authored Dec 20, 2019
1 parent 542ea53 commit 70a6220
Show file tree
Hide file tree
Showing 18 changed files with 1,452 additions and 900 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
ignore=E203,E722,W503
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ python:
services:
- docker
install:
- pip install pipenv
- pipenv install --dev
- pip3 install poetry
- make install
script:
- make test docker
after_success:
Expand Down
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
FROM python:3.7-alpine3.10
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 --from=0 /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages

COPY kube_resource_report /kube_resource_report

Expand Down
20 changes: 15 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@ TAG ?= $(VERSION)

default: docker

test:
pipenv run flake8
pipenv run mypy --ignore-missing-imports kube_resource_report/
pipenv run coverage run --source=kube_resource_report -m py.test
pipenv run coverage report
.PHONY:
install:
poetry install

.PHONY:
lint: install
poetry run black --check kube_resource_report tests
poetry run flake8
poetry run mypy --ignore-missing-imports kube_resource_report/

.PHONY:
test: install lint
poetry run coverage run --source=kube_resource_report -m py.test
poetry run coverage report

docker:
docker build --build-arg "VERSION=$(VERSION)" -t "$(IMAGE):$(TAG)" .
Expand All @@ -23,6 +32,7 @@ push: docker

.PHONY: version
version:
poetry version $(VERSION)
sed -i 's,$(IMAGE):[0-9.]*,$(IMAGE):$(TAG),g' README.rst deploy/*.yaml
sed -i 's,version: v[0-9.]*,version: v$(VERSION),g' deploy/*.yaml
sed -i 's,tag: "[0-9.]*",tag: "$(VERSION)",g' chart/*/values.yaml
Expand Down
29 changes: 0 additions & 29 deletions Pipfile

This file was deleted.

Loading

0 comments on commit 70a6220

Please sign in to comment.