From ea5da463c458bc68254014cdbd6a87a2678eb40b Mon Sep 17 00:00:00 2001 From: Konstantinos Papadopoulos Date: Mon, 15 Jan 2024 21:08:39 +0100 Subject: [PATCH 1/5] fix: Python 3.11 breaks f-String cast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From What’s New In Python 3.11: > Changed Enum.format() (the default for format(), str.format() and f-strings) to always produce the same result as Enum.str(): for enums inheriting from ReprEnum it will be the member’s value; __for all other enums it will be the enum and member name (e.g. Color.RED).__ For this reason we specifically use the enum's value where necessary. Fixes #9 --- auto_click_auto/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auto_click_auto/core.py b/auto_click_auto/core.py index 29aa93a..e1d1143 100644 --- a/auto_click_auto/core.py +++ b/auto_click_auto/core.py @@ -75,7 +75,7 @@ def enable_click_shell_completion( for shell in shells: if shell in (ShellType.BASH, ShellType.ZSH): - shell_config_file = os.path.expanduser(f"~/.{shell}rc") + shell_config_file = os.path.expanduser(f"~/.{shell.value}rc") # Completion implementation: `eval` command in shell configuration eval_command = ( @@ -105,7 +105,7 @@ def enable_click_shell_completion( elif shell == ShellType.FISH: completer_script_path = os.path.expanduser( - f"~/.config/fish/completions/{program_name}.{shell}" + f"~/.config/fish/completions/{program_name}.{shell.value}" ) # bash and zsh config files are generic, so we can assume the user From 75667367f2c1bf8e79a1451d18b211c8d302220c Mon Sep 17 00:00:00 2001 From: Konstantinos Papadopoulos Date: Mon, 15 Jan 2024 21:39:47 +0100 Subject: [PATCH 2/5] Update project version and CHANGELOG to 0.1.4 --- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ce735a..cf9ca95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.1.4] - 2024-01-15 + +### Fixed + +- Autocomplete did not work properly for Python 3.11 environments. +Users can manually delete incorrectly created fish configuration file +~/.config/fish/completions/{program_name}.ShellType.FISH, created from this +bug (https://github.com/KAUTH/auto-click-auto/issues/9) + ## [0.1.3] - 2023-12-28 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index 953efee..4aadfc3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "auto-click-auto" -version = "0.1.3" +version = "0.1.4" description = "Automatically enable tab autocompletion for shells in Click CLI applications." authors = ["Konstantinos Papadopoulos "] maintainers = ["Konstantinos Papadopoulos "] From 73bfd180c5027168022a16c178d0b8cea4eac68e Mon Sep 17 00:00:00 2001 From: Konstantinos Papadopoulos Date: Sun, 17 Dec 2023 17:15:45 +0100 Subject: [PATCH 3/5] Add build argument for python version in functional-test Dockerfile This way we can parametrize the Python version used in the functional tests Docker image. --- tests/functional/Dockerfile-ubuntu | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/functional/Dockerfile-ubuntu b/tests/functional/Dockerfile-ubuntu index 1de87c0..30b6f06 100644 --- a/tests/functional/Dockerfile-ubuntu +++ b/tests/functional/Dockerfile-ubuntu @@ -1,7 +1,9 @@ # Dockerfile for functional testing of `auto-click-auto` +ARG PYTHON_VERSION=3.10 + # Base test image to re-use for each test -FROM python:3.10-slim-buster as base_test_env +FROM python:${PYTHON_VERSION}-slim-buster as base_test_env RUN apt-get update && apt-get install -y vim zsh fish COPY . /opt/auto-click-auto/ From 2e16de3447cfa4efcd3aa064c569603c7dc17493 Mon Sep 17 00:00:00 2001 From: Konstantinos Papadopoulos Date: Sun, 17 Dec 2023 17:18:16 +0100 Subject: [PATCH 4/5] Parametrize Python version in functional tests GH workflow We parametrize for only 3 Python versions for now, "3.9", "3.10", "3.11". --- .github/workflows/functional-tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/functional-tests.yml b/.github/workflows/functional-tests.yml index 77565f0..1115315 100644 --- a/.github/workflows/functional-tests.yml +++ b/.github/workflows/functional-tests.yml @@ -7,9 +7,12 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v3 - name: Run functional tests on Ubuntu environment - run: docker build . -f tests/functional/Dockerfile-ubuntu -t click-test-ubuntu \ No newline at end of file + run: docker build . -f tests/functional/Dockerfile-ubuntu --build-arg PYTHON_VERSION=${{ matrix.python-version }} -t click-test-ubuntu \ No newline at end of file From 00eabe31f22554d9c4bb05e03c7d7e28dc3b1bf3 Mon Sep 17 00:00:00 2001 From: Konstantinos Papadopoulos Date: Sun, 17 Dec 2023 17:31:47 +0100 Subject: [PATCH 5/5] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf9ca95..dad0753 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.1.4] - 2024-01-15 +### Added + +- Parametrized functional testing for Ubuntu environments for Python 3.9, 3.10, 3.11 (https://github.com/KAUTH/auto-click-auto/pull/10) + ### Fixed - Autocomplete did not work properly for Python 3.11 environments.