Skip to content

Conversation

@Yaannko
Copy link

@Yaannko Yaannko commented Dec 16, 2025

  • Issue: Running python3 manage.py ... directly fails because dependencies are installed in a uv managed virtual environment, not the system Python environment.
  • Error: ModuleNotFoundError: No module named 'pycountry' (and others).
  • Proper Usage: Commands must be run via uv run python manage.py ... or by explicitly activating the virtual environment (source .venv/bin/activate).
  • Improvement: Add a specific section in README.rst emphasizing uv run usage or automatic activation.

Summary by Sourcery

Documentation:

  • Add README guidance on running management commands via uv or an activated virtual environment to avoid missing dependency errors.

…d virtual environment, not the system Python environment.
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 16, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates README.rst to clarify how to run Django management commands when dependencies are installed in a uv-managed virtual environment, emphasizing the need to use uv run or explicitly activate the virtualenv instead of calling python3 manage.py directly.

File-Level Changes

Change Details Files
Document correct command invocation in uv-managed virtual environment.
  • Explain that dependencies are installed in a uv-managed virtual environment rather than the system Python environment.
  • Describe the failure mode when using plain python3 manage.py (e.g., ModuleNotFoundError for packages like pycountry).
  • Add guidance to use uv run python manage.py ... or to activate .venv before running Django management commands.
  • Add or update a dedicated section in the README to highlight uv-based workflows and automatic activation options.
README.rst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `README.rst:107-116` </location>
<code_context>
 7. **Activate virtual environment**

-After running ``uv sync```, activate a virtual environment
+   All python commands must be run within the project's virtual environment. You have two options:

-.. code-block:: sh
+   **Option A: Activate the environment (Recommended)**
+
+   .. code-block:: sh
+
+     . .venv/bin/activate
+
+   **Option B: Use `uv run`**
+
+   Prepend ``uv run`` to any python command to run it in the environment without explicit activation.
+
+   .. code-block:: sh
</code_context>

<issue_to_address>
**nitpick (typo):** Capitalize "Python" when referring to the language in prose.

Specifically, update the phrases "All python commands" and "any python command" in this section to use "Python."

Suggested implementation:

```
   All Python commands must be run within the project's virtual environment. You have two options:

```

```
   Prepend ``uv run`` to any Python command to run it in the environment without explicit activation.

```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Yaannko Yaannko changed the title Issue : Dependency Isolation & Runtime Context Fix : Dependency Isolation & Runtime Context Dec 16, 2025
@mariobehling mariobehling requested a review from Copilot December 16, 2025 10:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds documentation to clarify the proper usage of virtual environments when running Python commands in the project, addressing the issue where users encountered ModuleNotFoundError when running commands directly with system Python instead of through the uv-managed virtual environment.

Key Changes:

  • Enhanced the "Activate virtual environment" section with clear explanation of why virtual environment usage is required
  • Added two explicit options for running commands: activating the environment (recommended) or using uv run prefix
  • Provided concrete examples to illustrate both approaches

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

. .venv/bin/activate
**Option B: Use `uv run`**
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The formatting is inconsistent with the rest of the document. The heading structure uses bold text with inline code formatting. Consider using consistent heading formatting or ensuring the inline code uses proper reStructuredText syntax (double backticks ``). The backticks around 'uv run' should be double backticks for proper rendering.

Suggested change
**Option B: Use `uv run`**
**Option B: Use ``uv run``**

Copilot uses AI. Check for mistakes.
@hongquan
Copy link
Member

Hi, prepending uv run is just an option. You can activate the virtual environment from the beginning:

. ./.venv/bin/activate

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants