pybricks / pybricks-api

User API and documentation for Pybricks MicroPython
https://pypi.org/project/pybricks
MIT License
79 stars 23 forks source link

Release as Python Package #3

Closed strichter closed 4 years ago

strichter commented 4 years ago

Not sure whether you have a different way of doing this, but here we go:

I want my son (he is 10 so everything is a bit overwhelming) to use VS Code with the ev3dev browser to run his code on the EV3 bricks. However, the biggest benefit of an IDE is auto-completion. But with no way to tell Python about the pybricks API, this is not possible.

The simplest solution would be to publish the package on PyPI. Then I can simply install the package in my VE and everything will just work.

If this is of interest, I can create a PR for you to accomplish that. (I maintain 400+ PyPI packages.)

laurensvalk commented 4 years ago

We do plan to get it on PyPI very soon, so indeed that should make auto-complete easier for some users.

But we're still looking how to best simplify this in the extension, cross-platform, for users who are not necessarily familiar with creating virtual environments or even installing Python.

strichter commented 4 years ago

Right, but I think it would be a small baby step and at least educators setting up the laptops could do the install for the students.

Maybe VS Code has some sort of "Project Type" so that you can define one for ev3dev that installs a virtualenv with pybricks. The plugin could simply require the Python plugin.

(I was personally surprised how hard it was to get Python setup in VS Code. I think that instructing people to create a virtualenv and install stuff into it is intense.)

laurensvalk commented 4 years ago

(I was personally surprised how hard it was to get Python setup in VS Code. I think that instructing people to create a virtualenv and install stuff into it is intense.)

Exactly. That's why we have refrained from doing so. Making the extension do it all for the user instead would be nice. But making it work for everyone, always, without breaking their existing Python, is not so trivial.

dlech commented 4 years ago

For now, it should be possible to install the package from git:

(.venv) $ pip install git+https://github.com/pybricks/pybricks-api@master

However, we haven't done much to improve code completion yet, e.g. there are no type annotations.

strichter commented 4 years ago

@dlech I just recently typed most of my commercial product, so I am more than happy to do it for you and add some mypy checking.

laurensvalk commented 4 years ago

The simplest solution would be to publish the package on PyPI.

This is done now, so I'm going to close this issue.

There is a separate discussion for autocomplete here.