drewwhis / pybricks-stubs Goto Github PK
View Code? Open in Web Editor NEWTyping for EV3 Python programming (using the LEGO® pybricks)
License: MIT License
Typing for EV3 Python programming (using the LEGO® pybricks)
License: MIT License
should be:
Check which buttons on the EV3 Brick are currently pressed.
Returns List of pressed buttons.
Return type List of Button
How do we edit the default settings.json so that we don't have to edit the settings.json every time we create a new project?
Hi. Nice work here. I have a question about making this work better with Pybricks.
We are currently publishing the pybricks-api repository as the pybricks package on PyPi. As such, the fact that pybricks-stubs
also provides a pybricks
package means that both can't be installed at the same time.
pybricks-api
currently provides documentation for Pybricks MicroPython but no type hints. And given the name pybricks-stubs
, I would expect this repository to provide typing information in .pyi
files rather than .py
files in a package named pybricks-stubs
rather than pybircks
as per PEP 561.
Would you be open to a pull request to make such a change? This would allow pybricks-api
and pybricks-stubs
to complement each other rather than essentially providing the same thing. This would mean that any implementation would get removed here (e.g. function bodies replaced with ...
) and the tests would probably no longer be relevant. I know a lot of hard work went into that and it is not a nice feeling to just throw it out but we would probably accept it in pybricks-api
if it seems useful.
Additionally, I would like for pybricks-stubs
to provide additional -stubs
packages for MicroPython modules like urandom
so that we can have code completion for those as well.
In the long term (i.e. for Pybricks 3.x), it would be cool if we could also add a setup option so that people could install pybricks-stubs
for different hubs besides the EV3.
I added your project in my environment and I got error message. I is still installed and the intellisence support for VS Code mostly works.
Downloading/unpacking pybricks-stubs
Downloading pybricks-stubs-0.0.3.tar.gz
Running setup.py (path:/tmp/pip_build_root/pybricks-stubs/setup.py) egg_info for package pybricks-stubs
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
Installing collected packages: pybricks-stubs
Running setup.py install for pybricks-stubs
/usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
File "/usr/local/lib/python3.4/dist-packages/pybricks/parameters.py", line 7
BOTTOM_LEFT: ...
^
SyntaxError: invalid syntax
Successfully installed pybricks-stubs
Cleaning up...
https://github.com/drewwhis/pybricks-stubs/blob/master/pybricks/parameters.py#L7
My issue is that the code completion can't help me for the enums like Align, SoundFile, etc.
Any idea why and how to fix it?
If I define the enum value with
LEFT = ""
for example, it is now visible in the code hints. But I am afraid that I am doing something utterly wrong.
Update: Well, I tested and it worked:
class ImageFile(Enum):
STOP_2: ...
THUMBS_UP = ""
EV3: ...
and my code:
brick.sound.beep()
brick.display.image(ImageFile.THUMBS_UP)
time.sleep(2)
Is there a reason why methods that would return a value, don't actually do so?
(I am new to python, so I might miss something.)
I am aware that these are only stubs, but the linter gives me errors like "Assigning result of a function call, where the function has no returnpylint(assignment-from-no-return)" which I would like to avoid and my test show that this is easily avoided by returning some dummy value (e.g. 0 or []).
I would be happy to fix it myself and create a pull request, if you want me to.
And thanks for the nice work, makes ev3 programming so much easier and more fun.
In at least one place, List[int, int] is used; however, List only takes one parametrized type.
Unable to install the new version of pybricks-stups (2.0.0). Here is the error message:
B:>pip install pybricks-stubs
Requirement already satisfied: pybricks-stubs in c:\users\kawag\appdata\local\programs\python\python37-32\lib\site-packages (0.0.6)
Are you planning to upgrade your pybricks-stubs to follow the new version of pybricks 2.0?
Expect this to be fixed in version 0.0.5.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.