Skip to content

Commit

Permalink
Invoke scripts from project root
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 committed Mar 23, 2024
1 parent 153213c commit 5743e45
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
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

0 comments on commit 5743e45

Please sign in to comment.