beeware / briefcase

Tools to support converting a Python project into a standalone native application.
https://briefcase.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.69k stars 375 forks source link

Add support for pyglet #1030

Open shenjackyuanjie opened 1 year ago

shenjackyuanjie commented 1 year ago

What is the problem or limitation you are having?

Pyglet is a cross-platform, pure Python windowing library. It would be desirable to have native support for Pyglet in Briefcase.

Describe the solution you'd like

Add native Briefcase support for pyglet.

Describe alternatives you've considered

Pyglet can be supported at present by selecting "No GUI toolkit", and manually building the stub app and dependencies. However, it would be desirable to have Pyglet as an explicit option.

Additional context

  1. Adding a Pyglet option to briefcase-template. This will involve changes to:
    • cookiecutter.json to declare the additional dependency,
    • pyproject.toml to define requirements, and disable Android/iOS/Web targets
    • app.py to add a stub app
  2. Modifying the new command in Briefcase to include Pyglet in the list of platform options.
  3. Adding Pyglet to the CI configuration for Briefcase and briefcase-template so that pyglet apps are built and tested.

It's worth noting that (2) is only required because of #392; if Briefcase read metadata options from the template, adding Pyglet to briefcase-template would automatically result in the option becoming available.

shenjackyuanjie commented 1 year ago

thanks for edit!

jromal commented 1 year ago

I am using pyglet just for playing audio (from a BytesIO "file"). And I do not get it to work on Android.

Does someone know if the usage of only that part of pyglet should work or I have to find another compatible solution for playing mp3 "on the fly" with briefcase and android? I understand that the usage as full windows environment would not work. But I use Toga for windows management. And pyglet just for mp3 playing.

Thanks.

freakboy3742 commented 1 year ago

Briefcase can't magically make a GUI toolkit work on a platform that the GUI toolkit itself doesn't support. Pyglet doesn't support Android; therefore Briefcase can't make it run on Android.

It would be highly unlikely that you can use "just parts" of Pyglet - especially if those parts of audio APIs, as those are the sorts of APIs that are highly dependent on integration with system libraries.

As for alternative APIs for playing mp3s - I can't point you at a cross-platform audio API that I know works on Android. The only option I'm aware of at present would be to write directly against the native Android using the Chaquopy bridge.

jromal commented 1 year ago

Thanks for the answer.

It is clear that pyglet is fully installed as a package. I did not know that this module cannot be supported by Android at all.

The "parts" mention was referring to the fact that I do not use it as a GUI toolkit, but Toga is the GUI used. Only the media player of pyglet is used. To do something with Chaquopy goes beyond my kwnoledge (hobby programmer). I fear I have to give away with beeware. I did some program in the past with Kivy but I liked the approach of Beeware more. Just that does not fit in the program/app that I am doing.