Repository navigation
fix: detect slack-cli-hooks under any normalized python package name - #733
Merged
Merged
Conversation
Python package names compare equal after PEP 503 normalization, so slack_cli_hooks, Slack.CLI-Hooks, and slack-cli-hooks all name the same package. The check for an existing slack-cli-hooks dependency in requirements.txt and pyproject.toml matched only the hyphenated spelling, which added a second slack-cli-hooks<1.0.0 entry to projects that declare slack_cli_hooks==0.3.0. https://packaging.python.org/en/latest/specifications/name-normalization/ Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #733 +/- ##
=======================================
Coverage 78.13% 78.14%
=======================================
Files 238 239 +1
Lines 18115 18121 +6
=======================================
+ Hits 14154 14160 +6
Misses 3961 3961 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
mwbrooks
approved these changes
Oct 29, 2026
| // containsPackage returns if the file data names the package with any spelling | ||
| // that normalizes to the same name, such as slack_cli_hooks for slack-cli-hooks | ||
| func containsPackage(fileData string, pkgName string) bool { | ||
| pkgName = normalizePackageName(pkgName) |
Member
There was a problem hiding this comment.
praise: Matching on normalized names fixes the duplicate slack_cli_hooks entry and also stops counting slack-cli-hooks-extra as declared. Linking the regex and normalizer straight to the packaging spec is a nice touch 📦
Member
Author
|
🌟 Thanks for the kind review @mwbrooks! Glad the normalized names catch the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
Python projects that list
slack_cli_hooks, or another spelling ofslack-cli-hooks, inrequirements.txtorpyproject.tomlno longer get a secondslack-cli-hooks<1.0.0dependency added during project initialization withslack createorslack init.Summary
This pull request recognizes an existing
slack-cli-hooksdependency under any normalized Python package name, so spellings likeslack_cli_hooksandSlack.CLI-Hooksno longer get a duplicate.-,_, or.as one separator.installRequirementsTxtandinstallPyProjectTomlonly matched the exact textslack-cli-hooks. The examples in chore: replace requirements.txt with pyproject.toml dependencies slack-samples/bolt-python-examples#337 list"slack_cli_hooks==0.3.0"inpyproject.toml, so the CLI added"slack-cli-hooks<1.0.0"to them as a second entry.containsPackagefrom a newpip.go, next tonpm.goin the Node runtime. It normalizes each package name found in the file and compares it withslack-cli-hooks. Version specifiers, extras, and markers after the name don't affect the match, as inslack_cli_hooks[x]>=0.3; python_version>"3.9".Testing
gh repo clone slack-samples/bolt-python-examples && cd bolt-python-examples && gh pr checkout 337slack_cli_hooks==0.3.0inpyproject.toml:cd ai/slackbot-mcp-client/no-authslack initwith this branch's build. Confirm it printsFound pyproject.toml with slack-cli-hooks, then decline the prompt to link an app.git diff pyproject.tomland confirm there are no changes. A build frommainadds"slack-cli-hooks<1.0.0",to thedependenciesarray here.requirements.txtlistsslack_cli_hooks==0.3.0and confirm it printsFound requirements.txt with slack-cli-hooksand leaves the file unchanged.Notes
#egg=slack_cli_hooksfragments, and[tool.poetry.dependencies]keys.slack-cli-hooks, such asslack-cli-hooks-example, no longer counts as declared, soslack-cli-hooks<1.0.0is added next to it.requirements.txtstill looks for the exact textslack-boltwhen deciding where to add the hooks line. Withslack_bolt, the line is added at the end of the file. This affects placement only, not duplicates.Requirements
🤖 Generated with Claude Code