Skip to content

fix(python): 'create' and 'init' use warnings instead of errors for non-fatal pyproject.toml issues#406

Merged
mwbrooks merged 5 commits intomainfrom
mwbrooks-pyproject-project-section-warning
Mar 17, 2026
Merged

fix(python): 'create' and 'init' use warnings instead of errors for non-fatal pyproject.toml issues#406
mwbrooks merged 5 commits intomainfrom
mwbrooks-pyproject-project-section-warning

Conversation

@mwbrooks
Copy link
Member

@mwbrooks mwbrooks commented Mar 16, 2026

Changelog

Fixes a pyproject.toml error that was displayed by slack create and slack init. The error occurred when creating a Bolt Python project that includes a pyproject.toml, but it doesn't define a [project] section or dependencies array. Now, a warning is displayed in --verbose mode instead, since this is a valid pyproject.toml format.

Summary

This pull request updates the create and init commands to display a warning instead of an error for non-fatal pyproject.toml issues. This fixes a user experience bug where an error was displayed when creating Bolt Python projects that include a valid pyproject.toml but missing a [project] section or dependencies array.

Preview

Before:

image

After:

image

Requirements

When installPyProjectToml encounters missing structure (no [project]
section, no dependencies array, invalid TOML, or file not found), these
are not true errors — they just mean the pyproject.toml doesn't have the
structure needed to auto-add slack-cli-hooks. The CLI now logs a debug
warning and returns a descriptive "Skipped updating pyproject.toml
because <reason>" message instead of propagating an error. True errors
(file write failures, pip install failures) remain errors.
@mwbrooks mwbrooks added this to the Next Release milestone Mar 16, 2026
@mwbrooks mwbrooks self-assigned this Mar 16, 2026
@mwbrooks mwbrooks added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented changelog Use on updates to be included in the release notes semver:patch Use on pull requests to describe the release version increment area:bolt-python Related to github.com/slackapi/bolt-python labels Mar 16, 2026
@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.95%. Comparing base (4998899) to head (826f6f1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/runtime/python/python.go 66.66% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #406   +/-   ##
=======================================
  Coverage   67.94%   67.95%           
=======================================
  Files         218      218           
  Lines       18050    18054    +4     
=======================================
+ Hits        12264    12268    +4     
  Misses       4632     4632           
  Partials     1154     1154           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mwbrooks mwbrooks marked this pull request as ready for review March 16, 2026 19:18
@mwbrooks mwbrooks requested a review from a team as a code owner March 16, 2026 19:18
Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

@mwbrooks Ssssssuper nice change for a better getting started experience! 🐍 ✨

IIRC this might be the workaround to issues @srtaalej was facing that motivated some sample app PRs so after this merges I'll close these in favor of the new warnings:

🗣️ ramble: We should continue to improve our templates as part of overall changes for python developers - perhaps enhancing the pyproject.toml attributes included?

Let's get this merged whenever the time is best 🚢 💨

Comment on lines +352 to +354
if output != "" {
outputs = append(outputs, output)
}
Copy link
Member

Choose a reason for hiding this comment

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

💡 praise: Nice catch to expected paths!

@mwbrooks
Copy link
Member Author

@mwbrooks Ssssssuper nice change for a better getting started experience! 🐍 ✨

IIRC this might be the workaround to issues @srtaalej was facing that motivated some sample app PRs so after this merges I'll close these in favor of the new warnings:

🗣️ ramble: We should continue to improve our templates as part of overall changes for python developers - perhaps enhancing the pyproject.toml attributes included?

Thanks! I agree, we should continue to improve our sample apps by modernizing them with the latest Python best practices. To me, this means removing requirements.txt and migrating our dependencies to pyproject.toml (and updating the README.md and other docs).

@mwbrooks
Copy link
Member Author

@zimeg Thanks again for the PR review! Once tests pass from main, I'll hit merge 🚀

@mwbrooks mwbrooks merged commit defbe8f into main Mar 17, 2026
8 checks passed
@mwbrooks mwbrooks deleted the mwbrooks-pyproject-project-section-warning branch March 17, 2026 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bolt-python Related to github.com/slackapi/bolt-python bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented changelog Use on updates to be included in the release notes semver:patch Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants