Skip to content

Fix click compatibility and update python support - #92

Merged
JonoYang merged 11 commits into
mainfrom
fix-click-compat
Oct 22, 2025
Merged

JonoYang merged 11 commits into
mainfrom
fix-click-compat

Conversation

@AyanSinhaMahapatra

@AyanSinhaMahapatra AyanSinhaMahapatra commented Oct 21, 2025 •

Copy link
Copy Markdown
Member
  • Do not set flag_value as None in click Option

    From click 8.3.0 flag_value is set as a sentinel
    value UNSET instead of None, and since we maintain a PluggableCommanLineOption subclass, we need to
    maintain the same default values for an Option to
    avoid issues.

  • Also drops python 3.9 support and adds python 3.14 support.

Reference: https://github.com/pallets/click/releases/tag/8.3.0
Reference:

From click 8.3.0 flag_value is set as a sentinel
value UNSET instead of None, and since we maintain
a PluggableCommanLineOption subclass, we need to
maintain the same default values for an Option to
avoid issues.

Reference: https://github.com/pallets/click/releases/tag/8.3.0
Reference: aboutcode-org/scancode-toolkit#4572
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
This removes a warning seen in initial virtualenv configuration.

Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
Reference: aboutcode-org/scancode-toolkit#4369
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
Remove special file '6-FIFOTYPE' from types.tar to fix test failure
as in py3.14 tarfiles extraction fails with tarfile.SpecialFileError
for special files.

Reference: #88
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
@AyanSinhaMahapatra AyanSinhaMahapatra changed the title Do not set flag_value as None in click Option Oct 22, 2025
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>

@JonoYang JonoYang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, merging!

@JonoYang
JonoYang merged commit a3adbfa into main Oct 22, 2025
woakas pushed a commit to ubidots/ubidots-cli that referenced this pull request Mar 18, 2026
This PR fixes the compatibility issue with Click 8.3.0.

## Summary

Click 8.3.0 (released September 18, 2024) introduced stricter validation that rejects secondary flags (like `-p`, `-n`) on non-boolean parameters, causing the error: `TypeError: Secondary flag is not valid for non-boolean flag`.

When installing the wheel in a fresh venv, pip installs the latest Click version (8.3.1), which breaks the CLI. The code was working 4 months ago with Click 8.1.8.

**Solution**: Pin Click to `>=8.1.0,<8.2.0` in `pyproject.toml` to ensure compatible Click version is installed.

**Why Click 8.1.x?**
- ✅ Industry standard: Multiple major projects did the same
- ✅ Backward compatible: Maintains the behavior from 4 months ago
- ✅ Low risk: Click 8.1.8 is proven stable with Typer 0.9.x
- ✅ Quick fix: No code changes needed
- ✅ Future-proof: Can update code later to support Click 8.3.0+ when needed

## Source Links for Click 8.3.0 Compatibility Issues

### 1. RELION Project (Scientific Software)
- **Issue**: 3dem/relion#1301
- **Title**: "Possible incompatibility between versions of typer and click in relion-5.0 conda environment"
- **Date**: September 22, 2024
- **Solution**: Pinned `click<8.2.0` in environment.yml
- **Key quote**: "Adding `click<8.2.0` to the environment.yml file and regenerating the conda environment fixes this."

### 2. ScanCode Toolkit
- **Issue**: aboutcode-org/scancode-toolkit#4573
- **Title**: "Compatibility Issue: ScanCode fails with Click 8.3.0 - 'Secondary flag is not valid for non-boolean flag'"
- **Date**: September 26, 2024
- **Solution**: Fixed in commoncode-32.4.0 release
- **Fix PR**: aboutcode-org/commoncode#92

### 3. Open-WebUI
- **Issue**: open-webui/open-webui#17606
- **Title**: "0.6.30 fails to start with 'Secondary flag is not valid for non-boolean flag' error message"
- **Date**: September 19, 2024

### 4. Click Release Information
- **Click 8.3.0 Release**: https://github.com/pallets/click/releases/tag/8.3.0
- **Release Date**: September 18, 2024
- **Changelog**: Shows the stricter validation changes

### 5. Click Source Code (the validation check)
- **File**: https://github.com/pallets/click/blob/master/src/click/core.py
- **Line 2793**: Where the error is raised: `raise TypeError("Secondary flag is not valid for non-boolean flag.")`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants