Skip to content

Optional dependency crashes the import chain when the import itself isn't optional - #1

Merged
pcescato merged 3 commits into
mainfrom
knowledge/contribution-2026-09-06-optional-dependency-crashes-the-import-c
Sep 6, 2026
Merged

Optional dependency crashes the import chain when the import itself isn't optional#1
pcescato merged 3 commits into
mainfrom
knowledge/contribution-2026-09-06-optional-dependency-crashes-the-import-c

Conversation

@pcescato

@pcescato pcescato commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Community contribution generated by the Shared Knowledge MCP.

  • Path: knowledge/programming/optional-dependency-crashes-the-import-chain-when-the-import-itself-isn-t-option.md
  • Category: Programming
  • Tags: python, packaging, pyproject-toml, dependencies, imports

This Pull Request is the publication request: merging it makes the article eligible for publication on the documentation site.

Copilot AI lite review requested due to automatic review settings September 6, 2026 01:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The added article has frontmatter/body formatting issues (invalid tags YAML indentation and an H1 in content despite site-injected H1) that can break parsing or render incorrectly on the docs site.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR publishes a new community knowledge-base article explaining why “optional dependencies” in pyproject.toml can still break imports when the corresponding Python imports are unconditional, and how to fix it by deferring/guarding imports or promoting the dependency to required.

Changes:

  • Adds a new Programming article describing the failure mode and remediation pattern for optional dependencies that are imported at module load time.
  • Includes examples contrasting deferred guarded imports vs. unconditional top-level imports.
File summaries
File Description
knowledge/programming/optional-dependency-crashes-the-import-chain-when-the-import-itself-isn-t-option.md New article covering optional-dependency import-chain crashes and recommended import/packaging fixes.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +8 to +13
tags:
- python
- packaging
- pyproject-toml
- dependencies
- imports
pcescato and others added 2 commits September 6, 2026 03:35
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@pcescato
pcescato merged commit 1f1c200 into main Sep 6, 2026
1 check passed
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.

2 participants