The root layer is missing an __init__.py file #590

Closed
opened 2026-02-20 17:40:51 -05:00 by yindo · 5 comments
Owner

Originally created by @gbaian10 on GitHub (Apr 17, 2025).

Checked other resources

  • This is a bug, not a usage question. For questions, please use GitHub Discussions.
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Description

As stated in the title, specifically, this directory is missing an __init__.py file.

Image

Is there any particular reason we can't add it?
I accidentally discovered today that missing it causes some VSCode extensions to skip analyzing the contents of this library.

I also found that this project recursively contains py.typed files.
As far as I know, it should only be needed in the root directory. At least, langchain_core only has it in the root directory.
Could this be related to the missing __init__.py in the root directory?

System Info

langgraph==0.3.31

Originally created by @gbaian10 on GitHub (Apr 17, 2025). ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use GitHub Discussions. - [x] I added a clear and detailed title that summarizes the issue. - [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example). - [x] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue. ### Description As stated in the title, specifically, [this directory](https://github.com/langchain-ai/langgraph/tree/main/libs/langgraph/langgraph) is missing an `__init__.py` file. ![Image](https://github.com/user-attachments/assets/f757ac98-b4c7-4e51-9d2a-83ff0965b9a9) Is there any particular reason we can't add it? I accidentally discovered today that missing it causes some VSCode extensions to skip analyzing the contents of this library. I also found that this project recursively contains `py.typed` files. As far as I know, it should only be needed in the root directory. At least, `langchain_core` only has it in the root directory. Could this be related to the missing `__init__.py` in the root directory? ### System Info langgraph==0.3.31
yindo closed this issue 2026-02-20 17:40:52 -05:00
Author
Owner

@vbarda commented on GitHub (Apr 17, 2025):

This is actually done on purpose, because you can't have __init__.py file in namespace packages (and most of the langgraph libraries in the directory are all namespace packages).

Same for py.typed - all individual namespace packages are supposed to have it.

Closing since not a bug and is intended

@vbarda commented on GitHub (Apr 17, 2025): This is actually done on purpose, because you can't have `__init__.py` file in namespace packages (and most of the langgraph libraries in the directory are all namespace packages). Same for `py.typed` - all individual namespace packages are supposed to have it. Closing since not a bug and is intended
Author
Owner

@gbaian10 commented on GitHub (Apr 17, 2025):

@vbarda
If I manually insert this file after installing all the packages, could it cause any negative effects?
For example, could it lead to unexpected program behavior or issues with future package updates?

@gbaian10 commented on GitHub (Apr 17, 2025): @vbarda If I manually insert this file after installing all the packages, could it cause any negative effects? For example, could it lead to unexpected program behavior or issues with future package updates?
Author
Owner

@hinthornw commented on GitHub (Apr 17, 2025):

Yes it could potentially lead to other namespace packages not being imported correctly.

If all __init__.py files are empty it should work fine, but if any content is in them, it may degrade imports.

@hinthornw commented on GitHub (Apr 17, 2025): Yes it could potentially lead to other namespace packages not being imported correctly. If all `__init__.py` files are empty it should work fine, but if any content is in them, it may degrade imports.
Author
Owner

@gbaian10 commented on GitHub (Apr 17, 2025):

I want to insert an empty __init__.py so that VSCode can recognize it.
If inserting it will prevent the package from upgrading properly, perhaps I should completely remove the package (or delete the __init__.py I manually inserted) each time I upgrade the langgraph package, and then reinstall all the upgraded langgraph packages?

@gbaian10 commented on GitHub (Apr 17, 2025): I want to insert an empty `__init__.py` so that VSCode can recognize it. If inserting it will prevent the package from upgrading properly, perhaps I should completely remove the package (or delete the `__init__.py` I manually inserted) each time I upgrade the `langgraph` package, and then reinstall all the upgraded `langgraph` packages?
Author
Owner

@gbaian10 commented on GitHub (Apr 17, 2025):

I've found a way to solve my problem, and I've shared it on https://github.com/langchain-ai/langgraph/discussions/4336#discussion-8216195
Thank you both for your responses.

@gbaian10 commented on GitHub (Apr 17, 2025): I've found a way to solve my problem, and I've shared it on https://github.com/langchain-ai/langgraph/discussions/4336#discussion-8216195 Thank you both for your responses.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#590