-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
when .grit places under a git-managed pyenv with virtualenv due to parent .gitignore
Checked other resources
- This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
- I added a clear and descriptive title that summarizes this issue.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
- I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
- I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.
Example Code
prerequisites: Install pyenv with official instructions
mkdir -p /tmp/reproduce
cd /tmp/reproduce
pyenv virtualenv 3.13.7 dummy-env
pyenv local dummy-env
pip install langchain-cli==0.0.37
langchain-cli migrate .
Error Message and Stack Trace (if applicable)
Running GritQL pattern with args: /home/ec2-user/.cache/grit/.install/bin/grit apply langchain_all_migrations() . --grit-dir /home/ec2-user/.pyenv/versions/3.13.7/envs/dummy-env/lib/python3.13/site-packages/langchain_cli/namespaces/migrate/.grit
ERROR (code: 200) - pattern definition not found: langchain_all_migrations. Try running grit init.
Description
When running langchain-cli migrate .
, the .grit
directory used by the CLI places under a git-managed pyenv virtualenv. Due to GritQL’s behavior of honoring parent .gitignore files, the .grit directory becomes ignored and GritQL fails to load pattern definitions, resulting in a “pattern definition not found” error.
~/.pyenv
is a git repository (as per official install)~/.pyenv/versions/3.13.7/envs/{envname}/.gitignore
is auto-generated and ignores*
~/.pyenv/versions/3.13.7/envs/{envname}/lib/python3.13/site-packages/langchain_cli/namespaces/migrate/.grit
is ignored
Workarounds
- Temporarily remove ~/.pyenv/.git so the parent .gitignore is not applied.
- Run
git init
under ~/.pyenv/versions/3.13.7/envs/{envname}/lib/python3.13/site-packages/langchain_cli/namespaces/migrate/.grit so .grit becomes the repo root (works but shows warnings because nothing is committed).
Request
Place the .grit
directory in a non-git-managed location. (e.g., ~/.cache
)
System Info
System Information
OS: Linux
OS Version: #1 SMP Tue Nov 5 17:36:31 UTC 2024
Python Version: 3.13.7 (main, Aug 27 2025, 17:03:46) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)]
Package Information
langchain_core: 0.3.75
langsmith: 0.4.21
langchain_cli: 0.0.37
langserve: 0.3.1
Other Dependencies
fastapi: 0.116.1
gitpython<4,>=3: Installed. No version info available.
gritql<1.0.0,>=0.2.0: Installed. No version info available.
httpx: 0.28.1
httpx<1,>=0.23.0: Installed. No version info available.
jsonpatch<2.0,>=1.33: Installed. No version info available.
langserve[all]>=0.0.51: Installed. No version info available.
langsmith-pyo3>=0.1.0rc2;: Installed. No version info available.
langsmith>=0.3.45: Installed. No version info available.
openai-agents>=0.0.3;: Installed. No version info available.
opentelemetry-api>=1.30.0;: Installed. No version info available.
opentelemetry-exporter-otlp-proto-http>=1.30.0;: Installed. No version info available.
opentelemetry-sdk>=1.30.0;: Installed. No version info available.
orjson: 3.11.3
orjson>=3.9.14;: Installed. No version info available.
packaging>=23.2: Installed. No version info available.
pydantic: 2.11.7
pydantic<3,>=1: Installed. No version info available.
pydantic>=2.7.4: Installed. No version info available.
pytest>=7.0.0;: Installed. No version info available.
PyYAML>=5.3: Installed. No version info available.
requests-toolbelt>=1.0.0: Installed. No version info available.
requests>=2.0.0: Installed. No version info available.
rich>=13.9.4;: Installed. No version info available.
sse-starlette: 1.8.2
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
tomlkit>=0.12: Installed. No version info available.
typer<1.0.0,>=0.9.0: Installed. No version info available.
typing-extensions>=4.7: Installed. No version info available.
uvicorn<1.0,>=0.23: Installed. No version info available.
vcrpy>=7.0.0;: Installed. No version info available.
zstandard>=0.23.0: Installed. No version info available.
pip freeze
annotated-types==0.7.0
anyio==4.10.0
certifi==2025.8.3
charset-normalizer==3.4.3
click==8.2.1
fastapi==0.116.1
gitdb==4.0.12
GitPython==3.1.45
gritql==0.2.0
h11==0.16.0
httpcore==1.0.9
httpx==0.28.1
idna==3.10
jsonpatch==1.33
jsonpointer==3.0.0
langchain-cli==0.0.37
langchain-core==0.3.75
langserve==0.3.1
langsmith==0.4.21
markdown-it-py==4.0.0
mdurl==0.1.2
orjson==3.11.3
packaging==25.0
pydantic==2.11.7
pydantic_core==2.33.2
Pygments==2.19.2
PyYAML==6.0.2
requests==2.32.5
requests-toolbelt==1.0.0
rich==14.1.0
shellingham==1.5.4
smmap==5.0.2
sniffio==1.3.1
sse-starlette==1.8.2
starlette==0.47.3
tenacity==9.1.2
tomlkit==0.13.3
typer==0.17.3
typing-inspection==0.4.1
typing_extensions==4.15.0
urllib3==2.5.0
uvicorn==0.35.0
zstandard==0.24.0