Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke scripts from the project root #932

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ _Unreleased_

- Always create `.gitignore` file in `rye init`. #919

- Invoke Rye scripts from the project root. #932

<!-- released start -->

## 0.31.0
Expand Down
2 changes: 2 additions & 0 deletions docs/guide/pyproject.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ with different keys with the most important key being `cmd` which holds the comm
However if only `cmd` is set, then the object is optional. `cmd` itself can either be set to a
string or an array of arguments.

Scripts are invoked from the root of the project (where the `pyproject.toml` is located).

```toml
[tool.rye.scripts]
# These three options are equivalent:
Expand Down
1 change: 1 addition & 0 deletions rye/src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ fn invoke_script(
let mut cmd = Command::new(&args[0]);
cmd.args(&args[1..]);
cmd.env("VIRTUAL_ENV", &*pyproject.venv_path());
cmd.current_dir(pyproject.root_path());
if let Some(path) = env::var_os("PATH") {
let mut paths = split_paths(&path).collect::<Vec<_>>();
paths.insert(0, venv_bin.into());
Expand Down
Loading