Skip to content

Commit b6df47b

Browse files
committed
update env and linting
1 parent 89cde13 commit b6df47b

27 files changed

+2288
-1845
lines changed

.flake8

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[flake8]
2+
max-line-length = 120
3+
exclude = */payloads_for_tests.py
4+
per-file-ignores =
5+
code/api/__init__.py:E402,F401
6+
code/api/mapping/__init__.py:E402,F401
7+
code/api/transformations/__init__.py:E402,F401

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM alpine:3.14
22
LABEL maintainer="Ian Redden <iaredden@cisco.com>"
33

4-
ENV PIP_IGNORE_INSTALLED 1
4+
ENV PIP_IGNORE_INSTALLED=1
55

66
# install packages we need
77
RUN apk update && apk add --no-cache musl-dev openssl-dev gcc py3-configobj \

Makefile

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
NAME_SHORT:="tr-05-meraki-mx"
2+
NAME:=ciscosecurity/$(NAME_SHORT)
3+
PORT:="9090"
4+
PLATFORM=--platform linux/amd64,linux/arm64
5+
VERSION:=$(shell jq '.VERSION' code/container_settings.json | tr -d '"')
6+
7+
all: env stop build test scout
8+
9+
run: # app locally
10+
cd code; python -m app; cd -
11+
12+
# Docker
13+
build: stop
14+
docker buildx build $(PLATFORM) -t $(NAME):$(VERSION) -t $(NAME):latest .
15+
start: build
16+
docker run -dp $(PORT):$(PORT) --name $(NAME_SHORT) $(NAME):$(VERSION)
17+
stop:
18+
docker stop $(NAME_SHORT); docker rm $(NAME_SHORT); true
19+
release: build
20+
docker login
21+
docker image push --all-tags $(NAME)
22+
23+
# Tools
24+
env:
25+
pip install --no-cache-dir --upgrade pipenv && pipenv install --dev
26+
black:
27+
black code/ -l 120 -t py311 --exclude=payloads_for_tests.py
28+
lint: black
29+
flake8 code/
30+
31+
# Tests
32+
check: lint
33+
curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --
34+
docker scout cves $(NAME) --only-fixed
35+
pip-audit
36+
test: lint
37+
cd code; coverage run --source api/ -m pytest --verbose tests/unit/ && coverage report --fail-under=80; cd -
38+
test_lf: lint
39+
cd code; coverage run --source api/ -m pytest --verbose -vv --lf tests/unit/ && coverage report -m --fail-under=80; cd -
40+

Pipfile

+9-7
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@ verify_ssl = true
44
name = "pypi"
55

66
[packages]
7-
cryptography = "==39.0.2"
8-
Flask = "==2.2.3"
9-
marshmallow = "==3.19.0"
10-
requests = "==2.28.2"
7+
cryptography = "==44.0.2"
8+
Flask = "==3.1.0"
9+
marshmallow = "==3.25.1"
10+
requests = "==2.32.3"
1111
PyJWT = "==2.6.0"
1212
meraki-sdk = "==1.5.0"
1313
meraki = "==1.32.1"
1414

1515
[dev-packages]
16-
flake8 = "==6.0.0"
17-
coverage = "==7.2.1"
18-
pytest = "==7.2.2"
16+
black = "==25.1.0"
17+
coverage = "==7.6.12"
18+
flake8 = "==7.1.2"
19+
pip-audit = "==2.8.0"
20+
pytest = "==8.3.5"
1921

2022
[requires]

Pipfile.lock

+1,374-756
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)