Title: Python-SDK does not handle import aliases · Issue #124 · codellm-devkit/python-sdk · GitHub
Open Graph Title: Python-SDK does not handle import aliases · Issue #124 · codellm-devkit/python-sdk
X Title: Python-SDK does not handle import aliases · Issue #124 · codellm-devkit/python-sdk
Description: Describe the bug The Python-sdk does not handle an import that has been renamed to an alias such as import pandas as pd. To Reproduce Steps to reproduce the behavior: Run this code: from cldk.analysis.python.treesitter import PythonSitte...
Open Graph Description: Describe the bug The Python-sdk does not handle an import that has been renamed to an alias such as import pandas as pd. To Reproduce Steps to reproduce the behavior: Run this code: from cldk.analy...
X Description: Describe the bug The Python-sdk does not handle an import that has been renamed to an alias such as import pandas as pd. To Reproduce Steps to reproduce the behavior: Run this code: from cldk.analy...
Opengraph URL: https://github.com/codellm-devkit/python-sdk/issues/124
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python-SDK does not handle import aliases","articleBody":"**Describe the bug**\n\nThe Python-sdk does not handle an import that has been renamed to an alias such as `import pandas as pd`.\n\n**To Reproduce**\n\nSteps to reproduce the behavior:\n1. Run this code:\n```python\nfrom cldk.analysis.python.treesitter import PythonSitter\n\ncode = \"\"\"\nimport io\nfrom flask import Flask\nimport pandas as pd\n\ndef hello():\n print(\"Hello!\")\n\"\"\"\n\nif __name__ == \"__main__\":\n python_sitter = PythonSitter()\n\n print(\"Statements:\\n\")\n import_statements = python_sitter.get_all_imports(code)\n for statement in import_statements:\n print(statement)\n\n print(\"\\nDetails:\\n\")\n import_details = python_sitter.get_all_imports_details(code)\n for detail in import_details:\n print(detail)\n```\n\n**Expected behavior**\n\nI expect to get all of the imports parsed correctly from the `get_all_imports_details()` method.\n\nInstead I got this output:\n\n```bash\nStatements:\n\nimport io\nimport pandas as pd\nfrom flask import Flask\n\nDetails:\n\nfrom_statement='' imports=['io']\nfrom_statement='' imports=[]\nfrom_statement='flask' imports=['Flask']\n```\n\nNotice the `from_statement='' imports=[]` in the output instead of the `pandas` import.\n\n**Logs**\nIf applicable, add logs to help explain your problem.\n\n**Additional context**\nAdd any other context about the problem here.\n","author":{"url":"https://github.com/rofrano","@type":"Person","name":"rofrano"},"datePublished":"2025-04-10T20:48:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/124/python-sdk/issues/124"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:307d066e-1cd5-1e8b-5bdd-0ae6ac4acfbb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A636:4F705:DCFA8:11FE89:698E88F2 |
| html-safe-nonce | f6da9e53d458e6b7e05f075333fa2e26976910470aafb7f6c5fcc7a5ea2939a9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjM2OjRGNzA1OkRDRkE4OjExRkU4OTo2OThFODhGMiIsInZpc2l0b3JfaWQiOiI3MDc0NzQ3NzM3NTA2MjIwMjc0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f1cef26e8fff7d5346957f50e7d829ffa76d4d6fcb42bd138dc5522a4c5d8a59 |
| hovercard-subject-tag | issue:2986859055 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/codellm-devkit/python-sdk/124/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0da984f5270aaec126f85dca5b7e9b6369aace17b6640f8406cee8d8ac758e6d/codellm-devkit/python-sdk/issues/124 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0da984f5270aaec126f85dca5b7e9b6369aace17b6640f8406cee8d8ac758e6d/codellm-devkit/python-sdk/issues/124 |
| og:image:alt | Describe the bug The Python-sdk does not handle an import that has been renamed to an alias such as import pandas as pd. To Reproduce Steps to reproduce the behavior: Run this code: from cldk.analy... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rofrano |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb2828a801ee6b7be618f3ac76fbf55def35bbc30f053a9c41bf90210b8b72ba |
| turbo-cache-control | no-preview |
| go-import | github.com/codellm-devkit/python-sdk git https://github.com/codellm-devkit/python-sdk.git |
| octolytics-dimension-user_id | 197800760 |
| octolytics-dimension-user_login | codellm-devkit |
| octolytics-dimension-repository_id | 826048982 |
| octolytics-dimension-repository_nwo | codellm-devkit/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 826048982 |
| octolytics-dimension-repository_network_root_nwo | codellm-devkit/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f7a12861f7011eecb14bcc4388a767d829a52dfc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width