Devcontainers do not work with git worktree
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- git, python
- Domain
- developer-experience, devops
Research direction
Reproduce the issue with git worktree add ../blueapi-enum add-enum-for-endpoint, then open the worktree in its devcontainer and run uv sync. Inspect the devcontainer configuration and worktree .git handling; done means Git commands and uv sync work from the opened worktree without the reported repository or setuptools-scm errors.
Written by the indexing model from the issue text.
Description
Way to replicate this issue
- In a cloned repository add a worktree by
git worktree add ../blueapi-enum add-enum-for-endpoint
You will see that inside the worktree the .git has a link to the parent and not the
gitdir: /scratch/ckk43848/blueapi/.git/worktrees/blueapi-enum
- Open the blueapi-enum in devcontainer
See the following issues
fatal: not a git repository: /scratch/ckk43848/blueapi/.git/worktrees/blueapi-enum
uv sync issue
root ➜ /workspaces/blueapi-enum
$ uv sync
Resolved 274 packages in 0.90ms
× Failed to build `blueapi @ file:///workspaces/blueapi-enum`
├─▶ The build backend returned an error
╰─▶ Call to `setuptools.build_meta.build_editable` failed (exit status: 1)
[stderr]
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/build_meta.py", line 481, in get_requires_for_build_editable
return self.get_requires_for_build_wheel(config_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
self.run_setup()
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/build_meta.py", line 317, in run_setup
exec(code, locals())
File "<string>", line 1, in <module>
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/__init__.py", line 117, in setup
return distutils.core.setup(**attrs) # type: ignore[return-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 148, in setup
_setup_distribution = dist = klass(attrs)
^^^^^^^^^^^^
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/dist.py", line 321, in __init__
_Distribution.__init__(self, dist_attrs)
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 307, in __init__
self.finalize_options()
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools/dist.py", line 790, in finalize_options
ep(self)
File "/root/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools_scm/_integration/setuptools.py", line 203, in infer_version
_infer_version_impl(
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools_scm/_integration/setuptools.py", line 236, in _infer_version_impl
result.apply(dist)
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools_scm/_integration/version_inference.py", line 183, in apply
data = infer_version_with_config(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/setuptools_scm/_integration/version_inference.py", line 123, in
infer_version_with_config
_version_missing(config, tool=env.tool_names[0])
File "/cache/uv/builds-v0/.tmprWugKC/lib/python3.11/site-packages/vcs_versioning/_get_version_impl.py", line 263, in _version_missing
raise LookupError(error_msg)
LookupError: setuptools-scm was unable to detect version for /workspaces/blueapi-enum.
Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout
without the .git folder) don't contain the necessary metadata and will not work.
For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj
Alternatively, set the version with the environment variable SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${NORMALIZED_DIST_NAME} as described in
https://setuptools-scm.readthedocs.io/en/latest/config/
hint: Build failures usually indicate a problem with the package or the build environmen
Possible solution:
Try to mount the parent as well when devcontainer knows that it is a worktree
- Dominant language
- Jinja
- Stars
- 28
- Forks
- 10
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 4
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DiamondLightSource/python-copier-template
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Ignore renovate updates for ubuntu and ubuntu-devcontainerPossibly taken @KayMohh claimed this 30 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
documentation good first issue
Difficulty 1/5 Under an hour Newbie friendliness 70/100
All issues in DiamondLightSource/python-copier-template
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
webhook-lifecycle-complete flags send-and-wait style nodes whose only webhooks are restart webhooksPossibly taken @Murad-khan-professional claimed this today. Openstatus:in-linear
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
n8n-io/n8n#45894 · 2 comments ·
Maintainers usually reply within 1 day
-
formatter-markdown: keep a bare URL followed by a period linked when emphasis delimiters changeOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
swc-project/swc-next-issues#1167 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
umbraco/Umbraco-CMS-MCP-Editor#362 ·
Maintainers usually reply within 1 day
-
ci
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
jonathanong/no-mistakes#5138 ·