Skip to content

Commit a95f4cf

Browse files
Fix --directory path in examples (#12165)
<!-- Thank you for contributing to uv! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> The examples assume that the packages are in the project root directory. However, they are nested inside `src`, and the commands in the examples do not work as intended. I could not find any related issues. ## Test Plan <!-- How was it tested? --> I tested it by executing the commands on my terminal - Linux and Windows (PowerShell). --------- Co-authored-by: Charlie Marsh <[email protected]>
1 parent c1ef482 commit a95f4cf

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

docs/concepts/projects/init.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ if __name__ == "__main__":
6565
Python files can be executed with `uv run`:
6666

6767
```console
68+
$ cd example-app
6869
$ uv run main.py
6970
Hello from example-project!
7071
```
@@ -90,7 +91,7 @@ example-pkg
9091
├── README.md
9192
├── pyproject.toml
9293
└── src
93-
└── example_packaged_app
94+
└── example_pkg
9495
└── __init__.py
9596
```
9697

@@ -107,7 +108,7 @@ requires-python = ">=3.11"
107108
dependencies = []
108109

109110
[project.scripts]
110-
example-pkg = "example_packaged_app:main"
111+
example-pkg = "example_pkg:main"
111112

112113
[build-system]
113114
requires = ["hatchling"]
@@ -130,7 +131,7 @@ requires-python = ">=3.11"
130131
dependencies = []
131132

132133
[project.scripts]
133-
example-pkg = "example_packaged_app:main"
134+
example-pkg = "example_pkg:main"
134135

135136
[build-system]
136137
requires = ["hatchling"]
@@ -140,7 +141,8 @@ build-backend = "hatchling.build"
140141
The command can be executed with `uv run`:
141142

142143
```console
143-
$ uv run --directory example-pkg example-pkg
144+
$ cd example-pkg
145+
$ uv run example-pkg
144146
Hello from example-pkg!
145147
```
146148

@@ -213,7 +215,8 @@ def hello() -> str:
213215
And you can import and execute it using `uv run`:
214216

215217
```console
216-
$ uv run --directory example-lib python -c "import example_lib; print(example_lib.hello())"
218+
$ cd example-lib
219+
$ uv run python -c "import example_lib; print(example_lib.hello())"
217220
Hello from example-lib!
218221
```
219222

@@ -291,7 +294,8 @@ def main() -> None:
291294
The command can be executed with `uv run`:
292295

293296
```console
294-
$ uv run --directory example-ext example-ext
297+
$ cd example-ext
298+
$ uv run example-ext
295299
Hello from example-ext!
296300
```
297301

0 commit comments

Comments
 (0)