remove use of importlib.metadata for version access #709

Open
opened 2026-02-20 17:41:22 -05:00 by yindo · 13 comments
Owner

Originally created by @sydney-runkle on GitHub (Jun 10, 2025).

We should either hardcode the version or use uv dynamic versioning (preferred).

Would be great to benchmark the import time for langgraph with/without this change!

Eventually we might want to use dynamic imports internally in all __init__.py files, but more robust benchmarking is required to determine prio here.

Originally created by @sydney-runkle on GitHub (Jun 10, 2025). We should either hardcode the version or use uv dynamic versioning (preferred). Would be great to benchmark the import time for `langgraph` with/without this change! Eventually we might want to use dynamic imports internally in all `__init__.py` files, but more robust benchmarking is required to determine prio here.
yindo added the good first issuehelp wantedperformance labels 2026-02-20 17:41:22 -05:00
Author
Owner

@YassinNouh21 commented on GitHub (Jun 13, 2025):

@sydney-runkle
I thought of it as the following

Main LangGraph Package
• Migrated to uv-dynamic-versioning in pyproject.toml
• Replaced static version = "0.4.7" with a dynamic version config
• Introduced [tool.hatch.version] for fallback/version fallback
• Cleaned up version.py to a simple:
version = "0.4.7"

CLI Package
• Applied the same dynamic versioning setup
• Simplified version.py to hardcoded version string

SDK Package
• Same dynamic versioning setup in pyproject.toml
• Cleaned and simplified __init__.py with hardcoded version

@YassinNouh21 commented on GitHub (Jun 13, 2025): @sydney-runkle I thought of it as the following Main LangGraph Package • Migrated to uv-dynamic-versioning in pyproject.toml • Replaced static version = "0.4.7" with a dynamic version config • Introduced [tool.hatch.version] for fallback/version fallback • Cleaned up version.py to a simple: __version__ = "0.4.7" CLI Package • Applied the same dynamic versioning setup • Simplified version.py to hardcoded version string SDK Package • Same dynamic versioning setup in pyproject.toml • Cleaned and simplified __init__.py with hardcoded version
Author
Owner

@sydney-runkle commented on GitHub (Jun 13, 2025):

@YassinNouh21,

Sounds amazing, feel free to submit a PR and I'd be happy to review!

@sydney-runkle commented on GitHub (Jun 13, 2025): @YassinNouh21, Sounds amazing, feel free to submit a PR and I'd be happy to review!
Author
Owner

@YassinNouh21 commented on GitHub (Jun 13, 2025):

@sydney-runkle DONE I created the pr

@YassinNouh21 commented on GitHub (Jun 13, 2025): @sydney-runkle DONE I created the pr
Author
Owner

@diego-coder commented on GitHub (Jul 20, 2025):

Hi @sydney-runkle,

I reviewed the discussion, CI logs, and your feedback on this issue. Since the original branch has stalled and there have been changes to main (plus some lockfile and versioning noise), I’d like to help get this across the finish line by starting from a clean branch, if that works for you, for example:

  • Carefully review and implement all your previous review comments and suggestions from the PR.
  • Work against the latest main to avoid conflicts and out-of-date dependencies.
  • Use the current recommended tools/versions (uv, etc.) and make sure lockfiles are updated correctly.
  • Run all local tests, lints, and docs builds to ensure everything passes before opening a new PR.
  • Reference the original PR and thank the previous author for their effort.

Let me know if you have any other ideas/priorities, I want to make this as easy to review and merge as possible.

@diego-coder commented on GitHub (Jul 20, 2025): Hi @sydney-runkle, I reviewed the discussion, CI logs, and your feedback on this issue. Since the original branch has stalled and there have been changes to `main` (plus some lockfile and versioning noise), I’d like to help get this across the finish line by starting from a clean branch, if that works for you, for example: - Carefully review and implement all your previous review comments and suggestions from the PR. - Work against the latest `main` to avoid conflicts and out-of-date dependencies. - Use the current recommended tools/versions (`uv`, etc.) and make sure lockfiles are updated correctly. - Run all local tests, lints, and docs builds to ensure everything passes before opening a new PR. - Reference the original PR and thank the previous author for their effort. Let me know if you have any other ideas/priorities, I want to make this as easy to review and merge as possible.
Author
Owner

@new-world-coder commented on GitHub (Aug 21, 2025):

Hi @sydney-runkle

I see there are existing hardcode-based PRs. Since maintainers suggested uv dynamic versioning as the preferred approach, I’d like to implement that and submit a PR with benchmarks. Does that sound good?

@new-world-coder commented on GitHub (Aug 21, 2025): Hi @sydney-runkle I see there are existing hardcode-based PRs. Since maintainers suggested uv dynamic versioning as the preferred approach, I’d like to implement that and submit a PR with benchmarks. Does that sound good?
Author
Owner

@danbruno101 commented on GitHub (Aug 25, 2025):

@sydney-runkle are you still looking for someone to work on this?

@danbruno101 commented on GitHub (Aug 25, 2025): @sydney-runkle are you still looking for someone to work on this?
Author
Owner

@new-world-coder commented on GitHub (Sep 11, 2025):

@sydney-runkle Could you please re-run the CI workflows? I've pushed fixes for the failing tests.

Thank you

@new-world-coder commented on GitHub (Sep 11, 2025): @sydney-runkle Could you please re-run the CI workflows? I've pushed fixes for the failing tests. Thank you
Author
Owner

@diego-coder commented on GitHub (Sep 11, 2025):

@YassinNouh21 and I actually already fixed this in a commit back in July https://github.com/langchain-ai/langgraph/pull/5599 we are waiting for CI to be run on it, it's been rebased on the latest code and is passing the vercel checks. So, we already have a fix in here.

@diego-coder commented on GitHub (Sep 11, 2025): @YassinNouh21 and I actually already fixed this in a commit back in July https://github.com/langchain-ai/langgraph/pull/5599 we are waiting for CI to be run on it, it's been rebased on the latest code and is passing the vercel checks. So, we already have a fix in here.
Author
Owner

@Quiago commented on GitHub (Sep 12, 2025):

Is this issue still open? @sydney-runkle

@Quiago commented on GitHub (Sep 12, 2025): Is this issue still open? @sydney-runkle
Author
Owner

@aaron-seq commented on GitHub (Oct 10, 2025):

Is this issue still open? @sydney-runkle?

@aaron-seq commented on GitHub (Oct 10, 2025): Is this issue still open? @sydney-runkle?
Author
Owner

@diego-coder commented on GitHub (Oct 10, 2025):

@YassinNouh21 and I are still waiting for our review at the moment.

@diego-coder commented on GitHub (Oct 10, 2025): @YassinNouh21 and I are still waiting for our review at the moment.
Author
Owner

@sandeepyadav1478 commented on GitHub (Jan 5, 2026):

So the issue is resolved??

@sandeepyadav1478 commented on GitHub (Jan 5, 2026): So the issue is resolved??
Author
Owner

@Mercury0226 commented on GitHub (Feb 10, 2026):

Submitted a fix PR: https://github.com/langchain-ai/langgraph/pull/6772\n\nSummary:\n- Removed runtime importlib.metadata lookup in version path and kept version stable for package runtime usage.

@Mercury0226 commented on GitHub (Feb 10, 2026): Submitted a fix PR: https://github.com/langchain-ai/langgraph/pull/6772\n\nSummary:\n- Removed runtime importlib.metadata lookup in version path and kept __version__ stable for package runtime usage.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#709