MrYsLab / pseudo-microbit

A pseudo implementation of the micro:bit micropython API.
Other
16 stars 4 forks source link

Make "pyminifier3" optional #9

Closed astynax closed 3 weeks ago

astynax commented 4 weeks ago

It will be cool to make the pyminifier3 an optional dependency. This project considered "archived". And I even just can't install the package because my python installation doesn't have the 2to3 tool anymore. But because the "pyminifier3" is a dapendency for the "pseudo-microbit" I'm unable to install the former one too.

MrYsLab commented 4 weeks ago

Sorry about the pyminifier confusion. There is a currently supported minifier project that is available

Since many things in the Python world have changed since pseudo-microbit was written, such as pip installs should be performed within a virtual environment, I will need to update the user guide to reflect those changes and to replace pyminifier3 with python-minifier.

This may take several days for me to do this. When I have completed the modifications, I will close this issue.

Thanks for notifying me about this.

MrYsLab commented 4 weeks ago

This may take longer than I thought. Somehow, I misplaced the source files for the documentation, so I will need to recreate them.

astynax commented 4 weeks ago

Thank you for your work! If I could help anyhow, just ping me!

MrYsLab commented 4 weeks ago

Thanks for the offer. I have been trying things out based on the old documentation. What used to work no longer does, specifically setting up and using "external tools." Apparently, PyCharm's changes have also contributed to this. I will document the version of PyCharm I am using, and hopefully, getting this together won't take too long.

MrYsLab commented 3 weeks ago

The new Users Guide is available at https://mryslab.github.io/pseudo-microbit/.

I had to rewrite everything since Python requires pip installs to be within a virtual environment.

I am now using a working minimizer. The user guide provides instructions on how to install it.

I tested on both V1 and V2 versions of the micro:bit.

I will close the issue, but please let me know if there are any questions or problems.

You may still post about this issue; I will see your comments.

Thanks again.

astynax commented 3 weeks ago

Cool! I'm going to do a couple of introductory workshops with microbits for pythonistas. So, in a next week I'll play with pseudo-microbit in "a field" and I may return with some feedback :)

astynax commented 3 weeks ago

I see that no code was changed. This makes impossible for me to install the package:

error: Failed to download and build `pyminifier==2.1`
  Caused by: Build backend failed to determine extra requires with `build_wheel()` with exit status: 1
--- stdout:
Python 3.X support requires the 2to3 tool.
It normally comes with Python 3.X but (apparenty) not on your distribution.
Please find out what package you need to get 2to3and install it.
--- stderr:

---

The "2to3" tool is completely optional in a post-Py2 era, but pyminifier depends on it. Please, consider to remove this dependency if you are already recommending to use "python-minifier" instead.

MrYsLab commented 3 weeks ago

Yes, the code has stayed the same. It did not need to change. However, the installation instructions have changed drastically.

Please tell me precisely what you are doing to cause this error.

astynax commented 3 weeks ago

I'm trying to install pseudo-microbit using uv tool. Into the venv with Python3.12. uv pulls the pseudo_microbit-1.10-py2.py3-none-any.whl that has the outdated metadata, specifically it depends on the old pyminifier. At the end I'm getting such log:

DEBUG Searching for a compatible version of pseudo-microbit (*)
DEBUG Selecting: pseudo-microbit==1.10 [compatible] (pseudo_microbit-1.10-py2.py3-none-any.whl)
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/8f/10/acfb944d2e2e4c09c8ad832224f177b1894d25f0816a300dfabdceb9daf4/pseudo_microbit-1.10-py2.py3-none-any.whl.metadata
DEBUG Adding transitive dependency for pseudo-microbit==1.10: microfs*
DEBUG Adding transitive dependency for pseudo-microbit==1.10: pyminifier*
DEBUG Adding transitive dependency for pseudo-microbit==1.10: uflash*
...
DEBUG Calling `setuptools.build_meta:__legacy__.get_requires_for_build_wheel()`
DEBUG Python 3.X support requires the 2to3 tool.
DEBUG 

DEBUG It normally comes with Python 3.X but (apparenty) not on your distribution.
DEBUG 

DEBUG Please find out what package you need to get 2to3and install it.
DEBUG 

The source distribution also has the same outdated metadata.

When I'm creating the venv manually and use venv's pip, then the pip pulls the pseudo_microbit-1.10-py3-none-any.whl. That one has a proper pyminifier3 dependency, so the installation succeeds. But the package internals now are broken somehow: they lack any .py-files from the root of the repo (music.py etc), and at the same time there are the venv and tests directories.

MrYsLab commented 3 weeks ago

Thanks for the info. We may be at cross-purposes here. The intention of pseudo-microbit was to provide micro: bit-aware editing within PyCharm and to integrate some file manipulation tools into PyCharm.

Pycharm does not compile or run the programs but only performs syntax checking.

As you mentioned, I, too, found that the latest version needs to correctly integrate music, neopixel, radio, and speech modules for import. Things broke when I went from a setup.py file to the pyproject.toml file.

I need to do some more investigation to fix the problem, but I don't know how long this will take.

I don't use UV, so I have no opinion on why it brings in the wrong files.

Also, I'm unsure what platform you plan to use to create micro:bit MicroPython files if you don't want to use PyCharm.

You may want to look at Thonny or the micro:bit on-line Python Editor.

I will leave this issue open until I resolve the missing module support (music, etc.).

If you have any other questions, please let me know.

MrYsLab commented 3 weeks ago

I figured out how to modify project.toml to support the missing modules (music, etc.)

I will be publishing a new release within the next few days. I am not sure if that will help solve your issue or not.

Again, thanks for bringing these issues to my attention.

MrYsLab commented 3 weeks ago

I don't know if this will be helpful, but version 1.12 now recognizes all the micro:bit modules. Please let me know if you have any questions or comments.