-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjustfile
95 lines (77 loc) · 2.63 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
dev_venv := ".dev-venv"
python := dev_venv + "/bin/python"
pip := dev_venv + "/bin/pip"
black := dev_venv + "/bin/black"
bumpversion := dev_venv + "/bin/bumpversion"
# Serve the dev environment
_serve airflow_version: _check_docker_compose
docker-compose -p {{airflow_version}} -f docker-compose_dev_{{airflow_version}}.yaml up --force-recreate --build --remove-orphans
# Stop and remove all containers
_clear_containers airflow_version: _check_docker_compose
docker-compose -f docker-compose_dev_{{airflow_version}}.yaml rm --stop --force -v
# Serve the dev environment for Airflow 1
serve_airflow1: (_serve 'airflow1')
# Serve the dev environment for Airflow 2
serve_airflow2: (_serve 'airflow2')
# Stop and remove all containers
clear_containers: (_clear_containers 'airflow1') (_clear_containers 'airflow2')
_check_docker_compose:
#!/usr/bin/env bash
if ! [ -x "$(command -v docker-compose)" ]; then
echo 'Install a Docker engine, probably at https://docs.docker.com/install/'
exit 1
fi
# Remove all build, test, coverage and Python artifacts
clean: clean_build clean_pyc clean_test
# Remove build artifacts
clean_build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
# Remove Python file artifacts
clean_pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
# Remove test and coverage artifacts
clean_test:
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
# Package and upload a release
release: create_dev_venv dist
{{python}} -m twine upload dist/*
# Build source and wheel package
dist: create_dev_venv clean
{{python}} setup.py sdist
{{python}} setup.py bdist_wheel
ls -l dist
# Install the package to the active Python's site-packages
install: create_dev_venv clean
{{python}} setup.py install
# Format python code base with Black
format-black +opts='': create_dev_venv
{{black}} . {{opts}}
# Create a dev venv if not exist
create_dev_venv:
#!/usr/bin/env bash
if ! [ -d "./{{dev_venv}}" ]
then
echo "Creating a new development virtual env: {{dev_venv}} ..."
python -m venv {{dev_venv}}
echo "Installing development librairies ..."
{{pip}} install -r ./requirements_dev.txt
fi
# Delete dev venv
cleanup_dev_venv:
rm -rf {{dev_venv}}
rm -rf .mypy_cache
# Delete dev venv then recreate it
update_dev_venv: cleanup_dev_venv create_dev_venv
# Part is either "major", "minor", or "patch"
bump_version part: create_dev_venv
{{bumpversion}} {{part}}