-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
109 lines (90 loc) · 2.53 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
96
97
98
99
100
101
102
103
104
105
106
107
108
set shell := ["/usr/bin/bash", "-c"]
PIP := "uv pip"
PACKAGE := "youtube-downloader-cli"
CMD := "youtube-downloader"
WHL := "$(find dist/ -name '*-any.whl')"
TESTPYPI_INDEX := "https://test.pypi.org/simple/"
PYPI_INDEX := "https://pypi.org/simple/"
[private]
default:
just --list
# Run main command of the package
run *ARGS:
uv run {{CMD}} {{ARGS}}
# Run linter and formatter
format:
uvx ruff check --fix
uvx ruff format
[private]
static-check:
uvx ruff check
uvx ruff format --check
# Clean & Build the package
[group('build')]
rebuild: clean build
# Build the package
[group('build')]
build: build-uv
[private]
build-uv:
uv build --refresh
# Install all dependencies for development
[group('initialize')]
init: clean init-dev install-tool
[private]
init-dev:
uv sync --refresh --extra dev --no-install-project
[private]
install-tool:
uv tool install ruff -U --refresh
uv tool install bump-my-version -U --refresh
# Clean virtualenv and build artifacts
[group('clean')]
clean:
rm -rf dist/
rm -rf .venv/
rm -rf $(find -name '*.egg-info')
rm -rf $(find -name '__pycache__')
# Upload package to TestPyPI (target=test) or PyPI (target=PyPI)
[group('pypi')]
upload target: static-check rebuild
#!/usr/bin/bash
if [[ {{target}} == "test" ]]; then
set -x ; uvx uv-publish --repository testpypi
elif [[ {{target}} == "pypi" ]]; then
set -x ; uvx uv-publish --repository pypi
fi
# Install package from TestPyPI (target=test) or PyPI (target=PyPI - default)
[group('pypi')]
install target="pypi":
#!/usr/bin/bash
if [[ {{target}} == "test" ]]; then
set -x ; uv tool install {{PACKAGE}} -U --reinstall --index {{TESTPYPI_INDEX}} --index-url {{PYPI_INDEX}}
elif [[ {{target}} == "pypi" ]]; then
set -x ; uv tool install {{PACKAGE}} -U --reinstall
fi
# Show bump version
[group('bump-version')]
show-bump:
uvx bump-my-version show-bump
# Bump version
[group('bump-version')]
bump *ARGS:
uvx bump-my-version bump {{ARGS}}
@echo "new version $(cat $(find -name VERSION))"
# Create virtualenv with package installed
[group('local-testing')]
make-testing: rebuild
#!/usr/bin/bash
source $(which virtualenvwrapper.sh)
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
echo mkvirtualenv -i {{WHL}} --clear yt-dl-cli-testing
mkvirtualenv -i {{WHL}} --clear yt-dl-cli-testing
# Remove created virtualenv
[group('local-testing')]
remove-testing:
#!/usr/bin/bash
source $(which virtualenvwrapper.sh)
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
echo rmvirtualenv yt-dl-cli-testing
rmvirtualenv yt-dl-cli-testing