Add `crates/*` directories to Dependabot config by fanninpm · Pull Request #7687 · RustPython/RustPython · GitHub
Skip to content

Add crates/* directories to Dependabot config#7687

Open
fanninpm wants to merge 1 commit intoRustPython:mainfrom
fanninpm:dependabot-multiple-directories
Open

Add crates/* directories to Dependabot config#7687
fanninpm wants to merge 1 commit intoRustPython:mainfrom
fanninpm:dependabot-multiple-directories

Conversation

@fanninpm
Copy link
Copy Markdown
Contributor

@fanninpm fanninpm commented Apr 25, 2026

This allows dependabot to bump versions in all places we have Cargo.toml, not just the root directory.

Summary by CodeRabbit

  • Chores
    • Enhanced dependency update automation configuration to cover multiple project directories, improving the efficiency of dependency management across the codebase.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/dependabot.yml:
- Around line 5-7: The dependabot config currently lists directories: - "/" and
- "crates/*", which is redundant for a Cargo workspace; update the
dependabot.yml by removing the "crates/*" entry so only directories: - "/"
remains unless you intentionally need per-crate schedules or ignore rules;
locate the directories key in .github/dependabot.yml and delete the "crates/*"
line or replace the array with a single "directory: \"/\"" entry when
simplifying to root-only workspace discovery.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 48961f83-2f64-4656-986c-e13fe935f420

📥 Commits

Reviewing files that changed from the base of the PR and between 6ab1f80 and 5f994ab.

📒 Files selected for processing (1)
  • .github/dependabot.yml

Comment thread .github/dependabot.yml
Comment on lines +5 to +7
directories:
- "/"
- "crates/*"
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Apr 25, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# 1) Check whether a `crates/` parent directory exists and what it contains.
echo "=== crates/ tree ==="
fd -t d -d 2 . crates 2>/dev/null || echo "(no crates/ directory found)"

# 2) List all Cargo.toml files in the repo (excluding vendored/target dirs)
echo
echo "=== All Cargo.toml locations ==="
fd -H -t f '^Cargo\.toml$' -E target -E vendor

# 3) Inspect workspace members declared at the repo root
echo
echo "=== Root Cargo.toml [workspace] section ==="
sed -n '/\[workspace\]/,/^\[/p' Cargo.toml 2>/dev/null | head -n 80

Repository: RustPython/RustPython

Length of output: 1720


🌐 Web query:

Dependabot config: does the directoriesfield support glob patterns likecrates/* for Cargo workspaces, and is it recommended to list workspace member directories separately from the workspace root?

💡 Result:

Yes, the directories field in Dependabot's dependabot.yml supports glob patterns like crates/* for Cargo workspaces. This feature was introduced in June 2024 and applies to the cargo package ecosystem. For Cargo workspaces, configuring directory: / at the root is typically sufficient because Dependabot automatically discovers and updates all workspace members (Cargo.toml files listed in the root workspace's members and related dependencies like workspace.dependencies). Listing workspace member directories separately (e.g., via crates/* or explicit paths) is possible with directories but not necessary or recommended for standard setups, as it may lead to redundant configurations or overlapping rules. Use the root configuration unless you need distinct schedules, groups, or ignores for specific subdirectories.

Citations:


Consider simplifying to directory: "/" unless per-crate configurations are intentional.

The glob pattern crates/* does match workspace member directories; however, Dependabot's official guidance (as of June 2024) states that for Cargo workspaces, configuring directory: "/" alone is sufficient and recommended. Dependabot automatically discovers and updates all workspace members listed in the root workspace configuration. Adding member directories separately via the directories field may lead to redundant configurations and overlapping update rules.

If the intent is to apply distinct schedules, ignore rules, or version groups to specific crates, then explicit per-crate entries make sense. Otherwise, remove "crates/*" and rely on the root configuration.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/dependabot.yml around lines 5 - 7, The dependabot config currently
lists directories: - "/" and - "crates/*", which is redundant for a Cargo
workspace; update the dependabot.yml by removing the "crates/*" entry so only
directories: - "/" remains unless you intentionally need per-crate schedules or
ignore rules; locate the directories key in .github/dependabot.yml and delete
the "crates/*" line or replace the array with a single "directory: \"/\"" entry
when simplifying to root-only workspace discovery.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The problem is that Dependabot was updating blake2 in /Cargo.toml (in the root directory) but simultaneously not updating blake2 in crates/stdlib/Cargo.toml. Is there any way to fix this?

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.

@fanninpm, that's a well-known pain point with Dependabot and Cargo workspaces — my earlier concern was unwarranted. When both the root Cargo.toml and a subdirectory crate (e.g. crates/stdlib/Cargo.toml) share a dependency, Dependabot historically opened a PR only for the root crate, leaving the subdirectory crate behind and causing version drift.

Adding "crates/*" via the directories glob is the correct fix here — it explicitly tells Dependabot to scan each subdirectory under crates/ for its own Cargo.toml and open update PRs for those manifests independently. The change is valid and the PR looks good as-is. Sorry for the noise!


✏️ Learnings added
Learnt from: fanninpm
Repo: RustPython/RustPython PR: 7687
File: .github/dependabot.yml:5-7
Timestamp: 2026-04-25T16:47:08.900Z
Learning: In RustPython/RustPython, Dependabot only updates the root `/Cargo.toml` when using `directory: "/"` for the Cargo ecosystem, but does NOT automatically update dependencies in workspace member crates under `crates/` (e.g. `crates/stdlib/Cargo.toml`). The correct fix is to use the `directories` field with both `"/"` and `"crates/*"` in `.github/dependabot.yml` so that Dependabot scans each crate subdirectory separately.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-06T05:30:53.056Z
Learning: Applies to **/*.rs : Follow the default rustfmt code style by running `cargo fmt` to format Rust code

@ShaharNaveh
Copy link
Copy Markdown
Contributor

Nothing wrong with this change. But I do think it's better to define all dependencies versions in the root Cargo.toml under workspace, and have somedep = { workspace = true } in all crate members Cargo.toml

@fanninpm
Copy link
Copy Markdown
Contributor Author

Nothing wrong with this change. But I do think it's better to define all dependencies versions in the root Cargo.toml under workspace, and have somedep = { workspace = true } in all crate members Cargo.toml

What if the goal is to separate all the modules under crates/stdlib/src into their own dynamically-linked crates (similar to CPython)?

@ShaharNaveh
Copy link
Copy Markdown
Contributor

ShaharNaveh commented Apr 25, 2026

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