fix: Improve Python project detection and entrypoint resolution #1010
+206
−29
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.
This is just a draft for you guys @vladfrangu, @l2ysho, from Claude based on our long Slack conversation. I'll be happy to answer your potential questions about Python projects, but I won't be able to further help you with the implementation.
This unblocks apify/actor-templates#361.
Enhance Python project detection to support standard package layouts without enforcing specific directory names. This change makes the CLI more flexible and user-friendly for Python developers.
Changes
pyproject.toml,requirements.txt, or.pyfiles (not just__main__.py)src/subdirectorysrc/__main__.pycontinue to workImplementation Details
isPythonProject()for flexible project detectiondiscoverPythonPackages()to find valid packages (level 1 and 2 only)findPythonEntrypoint()with enhanced error handlingTesting
my_package/,src/my_package/Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com