Skip to content

Make click optional for library installs#39

Open
lewbei wants to merge 1 commit into
pycalendar:mainfrom
lewbei:make-click-cli-extra
Open

Make click optional for library installs#39
lewbei wants to merge 1 commit into
pycalendar:mainfrom
lewbei:make-click-cli-extra

Conversation

@lewbei

@lewbei lewbei commented May 12, 2026

Copy link
Copy Markdown

Fixes #26.

This follows the maintainer checklist from the issue:

  • removes click from the base runtime requirements
  • adds a cli extra via extras_require
  • bumps the package version to the next major version, 4.0.0
  • documents pip install x-wr-timezone[cli] for command line usage

Implementation details:

  • importing x_wr_timezone no longer requires click
  • when click is installed, x_wr_timezone.main remains a Click command object, preserving the existing CLI tests and entry point behavior
  • when click is missing, the CLI entry point exits with a clear install hint

Verification:

$env:Path = "$PWD\.venv\Scripts;$env:Path"
.\.venv\Scripts\python -m pytest

Result: 162 passed, 188 skipped, 2 warnings.

Additional checks:

& 'C:\Program Files\Git\bin\bash.exe' test/test_code_quality.sh
.\.venv\Scripts\python -m pip check
.\.venv-no-click\Scripts\python -m pip check

No-CLI install smoke:

.\.venv-no-click\Scripts\python -m pip install -e .
$env:Path = "$PWD\.venv-no-click\Scripts;$env:Path"
.\.venv-no-click\Scripts\python -c "import importlib.util, x_wr_timezone; print('click', importlib.util.find_spec('click')); print('has_to_standard', hasattr(x_wr_timezone, 'to_standard'));"
x-wr-timezone --help

Observed click None, has_to_standard True, and the CLI prints the pip install x-wr-timezone[cli] hint when click is not installed.

@niccokunzmann

Copy link
Copy Markdown
Member

Thanks for the PR!

There are merge conflicts now. Could you solve them?
It can be merged then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make dependency on click optional

2 participants