Skip to content

Commit 6c339b6

Browse files
docs re scripts in src layout (#283)
1 parent 59f8fad commit 6c339b6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/metadata.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,22 @@ You can also supply it with literal arguments:
111111
getter = "mypackage.version:get_version('dev')"
112112
```
113113

114+
!!! note
115+
116+
The module that the version getter function is in
117+
[must be importable *before* installation](https://github.com/pdm-project/pdm/issues/3385#issuecomment-2632705361).
118+
If you are using a `src` layout, you must specify the function like this:
119+
120+
```toml
121+
getter = "src.mypackage.version:get_version"
122+
```
123+
124+
Or put it in a package outside the target package, e.g. in a `scripts/` directory in the repository root.
125+
126+
```toml
127+
getter = "scripts.version:get_version"
128+
```
129+
114130
### Writing dynamic version to file
115131

116132
You can instruct `pdm-backend` to write back the dynamic version to a file. It is supported for all sources but `file`.

0 commit comments

Comments
 (0)