Creates "from __main__" import for __main__ program
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Reproduce the issue with the shown t-pyannotate.py program and inspect the refactoring entry point that consumes type_info.json. Trace how the main.G sample becomes an import and annotation, then verify the generated refactor no longer creates an invalid from main import while retaining the type information.
Written by the indexing model from the issue text.
Description
Given t-pyannotate.py:
from pyannotate_runtime import collect_types
collect_types.init_types_collection()
collect_types.start()
class G:
pass
def c(obj):
pass
c(G())
collect_types.stop()
collect_types.dump_stats("type_info.json")
Running and writing it produces the following diff, where it tries to import G from __main__ then:
--- t-pyannotate.py (original)
+++ t-pyannotate.py (refactored)
@@ -1,4 +1,5 @@
from pyannotate_runtime import collect_types
+from __main__ import G
collect_types.init_types_collection()
@@ -10,6 +11,7 @@
def c(obj):
+ # type: (G) -> None
pass
type_info.json:
[
{
"path": "t-pyannotate.py",
"line": 8,
"func_name": "G",
"type_comments": [
"() -> None"
],
"samples": 1
},
{
"path": "t-pyannotate.py",
"line": 12,
"func_name": "c",
"type_comments": [
"(__main__.G) -> None"
],
"samples": 1
}
]
pyannotate b7f96ca (current master).
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No 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 dropbox/pyannotate
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
dropbox/pyannotate#124 · 3 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
dropbox/pyannotate#123 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
dropbox/pyannotate#115 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dropbox/pyannotate#109 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
dropbox/pyannotate#103 · 6 comments · 1 reaction ·
All issues in dropbox/pyannotate
Similar issues
-
tool-calling
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
vllm-project/vllm#59838 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
raullenchai/Rapid-MLX#4042 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 92/100
transitmatters/mbta-slow-zone-bot#70 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
litestar-org/advanced-alchemy#811 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day