ofek/hatch-vcs

Error references setuptools_scm config where it should be hatch.version

Offen

#109 geöffnet am 16.01.2026

 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Python (23 Forks)github user discovery
documentationhelp wanted

Repository-Metriken

Stars
 (188 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

In a monorepo with subpackages, if one forgets to set search_parent_directories = true, the error hint says:

LookupError: Error getting the version from source `vcs`: setuptools-scm was unable to detect version for /path/to/root/subpackage.

However, a repository was found in a parent directory: /path/to/root

To fix this, you have a few options:

1. Use the 'relative_to' parameter to specify the file that setuptools-scm should use as reference:
   setuptools_scm.get_version(relative_to=__file__)

2. Enable parent directory search in your configuration:
   [tool.setuptools_scm]
   search_parent_directories = true

3. Change your working directory to the repository root: /path/to/root

4. Set the root explicitly in your configuration:
   [tool.setuptools_scm]
   root = "/path/to/root"

But that is not working. The hint should say

...
2. Enable parent directory search in your configuration:
   [tool.hatch.version.raw-options]
   search_parent_directories = true
...
4. Set the root explicitly in your configuration:
   [tool.hatch.version.raw-options]
   root = "/path/to/root"

I'm not sure about the first, since I'm not using setup.py

Contributor Guide