astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
12.08k stars 425 forks source link

Add each package to `PYTHONPATH` #1132

Open RotaN8 opened 4 weeks ago

RotaN8 commented 4 weeks ago

Currently, when using rye init --script project1 to create a project, packages must be manually added to the Python path using commands like PYTHONPATH=$PYTHONPATH:/path/to/package rye run project1. This approach becomes cumbersome and less scalable as the number of packages grows.

Proposal:

It would greatly enhance user experience and project management if rye init --script project1 automatically included all packages within the project’s directory structure. By doing so, users wouldn’t need to manage PYTHONPATH manually for each package addition.

Example Scenario:

Current Method:

rye init --script project1
PYTHONPATH=$PYTHONPATH:/path/to/package rye run project1

Proposed Method:

rye init --script project1
rye run project1  # Automatically includes packages within the project directory

Request for Feedback:

Additionally, if there are better practices or features within Rye that address efficient management of PYTHONPATH in projects, I would appreciate guidance on how to utilize them effectively.

This enhancement would streamline the workflow and improve scalability for projects utilizing rye.

Thank you for considering this suggestion to further enhance the functionality of rye.