pypa/hatch

`hatch version` doesn't work on a `setuptools-scm` project unless `hatch-vcs` is installed

Open

#2,069 创建于 2025年10月2日

在 GitHub 查看
 (15 评论) (0 反应) (0 负责人)Python (4,451 star) (240 fork)batch import
buggood first issue

描述

I get a traceback like this when I try:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/glyph/Library/Application Support/hatch/env/virtual/automat/rI8sZPBT/automat-build/lib/python3.13/site-packages/hatchling/__main__.py", line 6, in <module>
    sys.exit(hatchling())
             ~~~~~~~~~^^
  File "/Users/glyph/Library/Application Support/hatch/env/virtual/automat/rI8sZPBT/automat-build/lib/python3.13/site-packages/hatchling/cli/__init__.py", line 26, in hatchling
    command(**kwargs)
    ~~~~~~~^^^^^^^^^^
  File "/Users/glyph/Library/Application Support/hatch/env/virtual/automat/rI8sZPBT/automat-build/lib/python3.13/site-packages/hatchling/cli/version/__init__.py", line 31, in version_impl
    source = metadata.hatch.version.source
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/glyph/Library/Application Support/hatch/env/virtual/automat/rI8sZPBT/automat-build/lib/python3.13/site-packages/hatchling/metadata/core.py", line 1503, in source
    raise UnknownPluginError(message)
hatchling.plugin.exceptions.UnknownPluginError: Unknown version source: vcs

see this conversation https://github.com/glyph/automat/commit/643f7ce4ff0dfbe0269d57e0611b24fd5a149d93#r163303552

贡献者指南

`hatch version` doesn't work on a `setuptools-scm` project unless `hatch-vcs` is installed · pypa/hatch#2069 | Good First Issue