Skip to content

Commit

Permalink
Improve bulk dependency update
Browse files Browse the repository at this point in the history
Now requirements.in is generated from Pipfile section `[packages]`. A
new pipenv script command `update_requirements` has been created to
simplify bulk dependency updates.

Also split the tox environments which are used in docker and directly on
the host to avoid permission issues.

Signed-off-by: Simon Gerber <simon.gerber@vshn.ch>
  • Loading branch information
simu committed Feb 14, 2020
1 parent 349ed96 commit 56e61fb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Pipfile
Expand Up @@ -23,4 +23,5 @@ build_kapitan_helm_binding = "./tools/build_kapitan_helm_binding.sh"
autopep = "autopep8 --in-place --aggressive --recursive --verbose ./"
local_reveal = "./tools/reveal.sh"
compile = "kapitan compile -J . dependencies/ --refs-path ./catalog/refs"
test = "docker run -it --rm -v $PWD:/src:ro -v $PWD/.tox:/app/.tox docker.io/painless/tox"
test = "docker run -it --rm -v $PWD:/src:ro -v $PWD/.dtox:/app/.tox docker.io/painless/tox"
update_requirements = "tox -e requirements"
16 changes: 16 additions & 0 deletions tools/requirements-from-pipfile.py
@@ -0,0 +1,16 @@
import configparser


def main():
pipfile = configparser.ConfigParser()
pipfile.read('Pipfile')
for pkg in pipfile['packages']:
version = pipfile['packages'][pkg].strip('"')
if version == '*':
print(pkg)
else:
print(f"{pkg}{version}")


if __name__ == "__main__":
main()
5 changes: 3 additions & 2 deletions tox.ini
Expand Up @@ -62,16 +62,17 @@ deps =
pip-tools
pipenv
commands =
pip-compile --output-file=requirements.txt requirements.in --upgrade
pipenv update
python tools/requirements-from-pipfile.py > requirements.in
pip-compile --output-file=requirements.txt requirements.in --upgrade

[testenv:safety]
description = Check for vulnerable dependencies
deps = safety
commands = safety check -r requirements.txt --bare

[bandit]
exclude = .cache,.git,.tox,build,dist,docs,tests
exclude = .cache,.git,.dtox,.tox,build,dist,docs,tests
targets = .

[flake8]
Expand Down

0 comments on commit 56e61fb

Please sign in to comment.