Skip to content

Commit d7e66f5

Browse files
committed
Merge branch 'release/v1.2.0'
2 parents b42ef8a + c15db6e commit d7e66f5

File tree

5 files changed

+87
-11
lines changed

5 files changed

+87
-11
lines changed

.github/workflows/run_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Linting and tests
55

66
on:
77
push:
8-
branches: [ "main" ]
8+
branches: [ "main", "develop", "release/*" ]
99
pull_request:
1010

1111
permissions:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [v1.2.0](https://github.com/SallingGroup-AI-and-ML/venv-cli/releases/tag/v1.2.0) (2023-08-04)
4+
5+
From this release forward, this project follows the `Git Flow` branching model. To reflect this, the default development branch have been renamed `develop`, and the `main` branch is now only for tagged releases.
6+
To read more about Git Flow, see (https://nvie.com/posts/a-successful-git-branching-model/). Also see [README](https://github.com/SallingGroup-AI-and-ML/venv-cli/blob/v1.2.0/README.md#git-flow) for branch naming conventions.
7+
8+
* Changed github test workflow to reflect new branch naming conventions.
9+
* Added better, context-based bash completions.
10+
311
## [v1.1.0](https://github.com/SallingGroup-AI-and-ML/venv-cli/releases/tag/v1.1.0) (2023-08-02)
412

513
### New install script

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,26 @@ As this is meant to be a lightweight tool providing simple, QoL improvements to
162162

163163
That said, pull requests are welcome. For bigger changes, please open an issue first to discuss what you would like to change.
164164

165-
To contribute, clone the repo, create a virtual environment (preferably using `venv-cli`) and install `dev-requirements.txt`. When you are done with your changes, run the test suite with
165+
To contribute, clone the repo and create a branch, create a virtual environment (preferably using `venv-cli`) and install `dev-requirements.txt`. When you are done with your changes, run the test suite with
166166
```console
167167
$ pytest .
168168
```
169+
then create a pull request for the `develop` branch.
169170

170171
Every subcommand has its own test file `tests/test_venv_<command>.py` Please make sure to add/update tests as appropriate.
171172

173+
### Git Flow
174+
This project follows the [Git Flow](https://nvie.com/posts/a-successful-git-branching-model/) branching model. The default development branch is accordingly named `develop`, and the branch `main` is reserved for tagged releases and hotfixes. Other branches should be named according to their purpose:
175+
```
176+
feature/<branch name>
177+
bugfix/<branch name>
178+
release/<branch name>
179+
hotfix/<branch name>
180+
support/<branch name>
181+
```
182+
183+
Releases are made by creating a branch `release/vX.X.X` from `develop`, where `X.X.X` represents the release version number, following [SemVer](https://semver.org/). This freezes the version number of **this release**, and no more features from `develop` should be merged into this release (only `bugfix/`). When the `release/` branch is ready for release, merge it into `main` and tag the commit with the release version, then merge the `release/` branch back into `develop` (resolving any merge conflicts) to get the bugfixes included there as well.
184+
172185
## License
173186

174187
[MIT](https://choosealicense.com/licenses/mit/)

src/venv-cli/completions/bash/venv_completion.sh

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,73 @@
11
# bash completion for venv -*- shell-script -*-
22

33
_venv() {
4-
local cur_word prev_word subcommands fill_list
4+
local cur_word prev_word _subcommands subcommands help_options
55
cur_word="${COMP_WORDS[COMP_CWORD]}"
66
prev_word="${COMP_WORDS[COMP_CWORD-1]}"
7-
subcommands="create activate install lock clear sync deactivate -V --version"
8-
command_options="-h --help"
97

10-
if [ "${prev_word}" == "venv" ]; then
11-
fill_list="${subcommands} ${command_options}"
12-
else
13-
fill_list="${command_options}"
8+
_subcommands="activate clear create deactivate install lock sync"
9+
subcommands=( $(compgen -W "${_subcommands}" -- "${cur_word}") )
10+
help_options=( $(compgen -W "-h --help" -- "${cur_word}") )
11+
12+
# Generate completions for subcommand options
13+
compopt -o nosort
14+
case "${prev_word}" in
15+
"venv")
16+
# If only 'venv' has been entered, generate list of subcommands and options
17+
COMPREPLY+=( ${subcommands[*]} )
18+
COMPREPLY+=( ${help_options[*]} )
19+
20+
local version_options
21+
version_options=( $(compgen -W "-V --version" -- "${cur_word}") )
22+
COMPREPLY+=( ${version_options[*]} )
23+
;;
24+
"create")
25+
# Generate list of all available python3 versions
26+
27+
# The command below does the following, by line:
28+
# * List all python commands, e.g. "python3", "python3.10-config", ...
29+
# * Select only "python3.X" or "python3.XX"
30+
# * Remove the "python", leaving the version number
31+
# * Select unique entries, sorted by numerical value
32+
local python_versions
33+
python_versions=( $( \
34+
compgen -c "python${cur_word}" \
35+
| grep -P '^python3.\d+$' \
36+
| sed 's|python||' \
37+
| sort -n --unique \
38+
) )
39+
COMPREPLY+=( ${python_versions[*]} )
40+
COMPREPLY+=( ${help_options[*]} )
41+
;;
42+
"install"|"lock")
43+
# Generate completions for requirement and lock file paths
44+
COMPREPLY+=( $(compgen -f -X '!(*.txt|*.lock)' -- "${cur_word}" | sort) )
45+
COMPREPLY+=( ${help_options[*]} )
46+
compopt -o plusdirs +o nosort # Add directories after generated completions
47+
;;
48+
"sync")
49+
# Generate completions for lock file paths
50+
COMPREPLY+=( $(compgen -f -X '!*.lock' -- "${cur_word}" | sort) )
51+
COMPREPLY+=( ${help_options[*]} )
52+
compopt -o plusdirs +o nosort # Add directories after generated completions
53+
;;
54+
"activate"|"deactivate"|"clear")
55+
# Only generate help options
56+
COMPREPLY+=( ${help_options[*]} )
57+
;;
58+
"-V"|"--version")
59+
# Nothing to generate
60+
;;
61+
*)
62+
# Nothing to generate
63+
;;
64+
esac
65+
66+
# Special case for 'venv lock requirements.txt <TAB>', where only *.lock files should be suggested
67+
if [ "${COMP_WORDS[COMP_CWORD-2]}" == "lock" ] && [[ "${prev_word}" =~ ^.*\.txt$ ]]; then
68+
COMPREPLY+=( $(compgen -f -X '!*.lock' -- "${cur_word}" | sort) )
69+
compopt -o plusdirs +o nosort # Add directories after generated completions
1470
fi
15-
COMPREPLY=($(compgen -W "${fill_list}" -- "${cur_word}"))
1671
}
1772

1873
complete -F _venv venv

src/venv-cli/venv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ _yellow="\033[01;33m"
99
_red="\033[31m"
1010

1111
# Version number has to follow pattern "^v\d+\.\d+\.\d+.*$"
12-
_version="v1.1.0"
12+
_version="v1.2.0"
1313

1414
# Valid VCS URL environment variable pattern
1515
# https://peps.python.org/pep-0610/#specification

0 commit comments

Comments
 (0)