Skip to content

Add crates/* directories to Dependabot config - #7687

Merged
youknowone merged 1 commit into
RustPython:mainfrom
fanninpm:dependabot-multiple-directories
Apr 27, 2026
Merged

Add crates/* directories to Dependabot config#7687
youknowone merged 1 commit into
RustPython:mainfrom
fanninpm:dependabot-multiple-directories

Conversation

@fanninpm

@fanninpm fanninpm commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

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

coderabbitai Bot commented Apr 25, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Dependabot's Cargo configuration is updated to monitor multiple directory scopes using a directories field instead of a single directory. This expands coverage to include the repository root and all crate subdirectories matching the pattern crates/*.

Changes

Cohort / File(s) Summary
Dependabot Configuration
.github/dependabot.yml
Updated Cargo ecosystem update configuration to use directories (root / and crates/*) instead of single directory field, expanding dependency update coverage across multiple crate locations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • youknowone
  • ShaharNaveh

Poem

🐰 A rabbit hops through cargo crates with glee,
Now Dependabot watches all three directories!
From root to crates, no package left behind,
Dependencies fresh, all organized and aligned! 📦✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly and accurately describes the main change: adding crates/* directories to the Dependabot configuration file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

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/*"

@coderabbitai coderabbitai Bot Apr 25, 2026

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.

⚠️ 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

ShaharNaveh commented Apr 25, 2026

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

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

I still thinks it's worth doing so.
Then if one crate deviate from a specific crate version we can have a comment there explaining why. But generally, I think we should not manage dependencies in multiple places

@youknowone
youknowone merged commit 7f8cddd into RustPython:main Apr 27, 2026
20 checks passed
@youknowone

Copy link
Copy Markdown
Member

I agree to unified Cargo.toml workspace dependency even though if the goal is to separate all the modules under crates/stdlib/src into their own dynamically-linked crates. They don't conflict.

@fanninpm
fanninpm deleted the dependabot-multiple-directories branch April 27, 2026 01:57
@ShaharNaveh ShaharNaveh mentioned this pull request Apr 27, 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.

3 participants