Typehints / intellisense for Brython?
See original GitHub issueDeveloping in Brython makes your IDE throw all sorts of inspection warnings, since the IDE cannot find the imports.
Steps to Fix:
-
Stubs for Brython specific modules be created, and exposed via the brython package, so that they are accessible in the code as
from brython.browser import document
. -
Allow imports via the brython package. That is, the following two imports should produce the same results when brython is loaded on the webpage.
from browser import html
from brython.browser import html
Everything else remains the same. These newly exposed modules simply provide the IDE with the definitions. Brython still uses its precompiled brython.js
and brython_stdlib.js
files to provide functionality for these imports.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:6 (3 by maintainers)
Top Results From Across the Web
No stubs for brython for PyCharm - crucial to make it ... - GitHub
I need autocomplete during coding in PyCharm. Python heart is fast coding so it is crucial. I can not import really module from...
Read more >module browser.template - Brython documentation
The module template allows to dynamically generate some elements in a page, by including Python code blocks or expressions inside the HTML code....
Read more >Introduction - Brython documentation
The Document Object Model is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, ......
Read more >module browser.html - Brython documentation
module browser.html. This module exposes the HTML tags. The tag name is in uppercase letters. The classes defined are : HTML4 tags :...
Read more >Introducing PyScript (summary of PyCon keynote)
Brython (similarly is Skulpt but which lacks DOM manipulation) is a new implementation with parser & built-in objects written in JS and standard...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Maybe a .pyi file with type annotations would suffice? PyCharm, at least, seems to use those even if the corresponding .py file is absent. See PEP 484 for more information about the .pyi files. I’m also not sure if going through the
brython
package is necessary. It should be possible to have the PyPI package install multiple modules.I understand the need, but solving this issue requires a good knowledge of development tools. I can’t keep it in the scope of the Brython project, so I am closing it with the tag “won’t fix”. Sorry about that ! If you want to create a specific project for this, I will try to help if I can.