wagtail / wagtail/wagtail-cli

Wagtail docs version detection fails if wagtail-cli is installed as tool

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Issue summary

If I install the wagtail cli as a tool as per the instructions

uv tool install wagtail-cli

then wt docs is not able to detect the wagtail version of the project I am in. However wt --version is able to correctly determine the wagtail version of the current project.

The docs command tries to detect the wagtail version with importlib

https://github.com/wagtail/wagtail-cli/blob/190d1bee2dad91f79336c3efe68ddbab7f14989d/src/wagtail_cli/docs.py#L55-L61

The --version command detects the wagtail version by executing wagtail

https://github.com/wagtail/wagtail-cli/blob/190d1bee2dad91f79336c3efe68ddbab7f14989d/src/wagtail_cli/cli/main.py#L216-L224

Steps to reproduce
  1. Install the wagtail-cli as a tool
  2. In a project with wagtail installed, activate the project virtual environment
  3. Run wt --version and observe that the current wagtail version is printed
  4. Run queries with wt docs and note that all requests go to stable
Additional information

No response

Can be reproduced

Not confirmed

Technical details

$ wt --version
wagtail-cli 0.2.0
Wagtail: You are using Wagtail 7.4.3
Django: 6.0.8

Working on this

If you would like to contribute to this issue, follow these steps:

  • Confirm that the issue is reproducible, either on a fresh Wagtail project or the bakerydemo.
  • Once confirmed, view our contributing guidelines, add a comment to the issue once you're ready to start.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the problem with uv tool install wagtail-cli in a Wagtail project, then compare src/wagtail_cli/docs.py lines 55-61 with the version handling in src/wagtail_cli/cli/main.py lines 216-224. Confirm that wt docs detects the current project’s Wagtail version rather than routing requests to stable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.