Python Forum
Sound-player standalone
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sound-player standalone
#2
Over has made a standalone Sound-player where Python is not required.
Now gone take a look making the same Sound player for Python with wheel.
Wheel can also be distribute bye PyPi(soon Warehouse),example could have been pip install play if i had uploaded my wheel.

For making wheel will be using setup.py.
So bye doing pip install wheel,should all be included for 3-party user.
data_files: this add dll and so file to OS.
install_requires: This will install packages.
entry_points: This is cool function that will actually make .exe for Windows as executable for Linux.
# setup.py
from setuptools import setup
 
__author__ = 'snippsat'
setup(
   name="play",
   version='0.1',
   py_modules=['play'],
   description="Play sound files",
   url='https://python-forum.io',
   author_email='[email protected]',
   python_requires='>=3.4',
   # Add required files to Windows and Linux
   data_files=[       
       ('Scripts', ['avbin.dll']),
       ('usr/lib', ['libavbin.so.10'])
       ],
   classifiers=[
       'Programming Language :: Python :: 3.4',
       'Programming Language :: Python :: 3.5',
       'Programming Language :: Python :: 3.6',
    ],
   # These will be installed when "pip install wheel" run
   install_requires=[       
       'pyglet',
       'click',
   ],
   # Make executable eg for Windows will make .exe in Scripts folder
   entry_points='''\
        [console_scripts]
        play=play:play''',
)
Now i activate folder again pipenv shell.
Build the wheel:
E:\sound_env
λ python setup.py bdist_wheel
Now navigate to dist folder and install wheel.
E:\sound_env
λ cd dist

E:\sound_env\dist
λ ls
play-0.1-py3-none-any.whl

E:\sound_env\dist
λ pip install play-0.1-py3-none-any.whl
So now in Python Script folder in virtual environment i have.
play.exe
avbin.dll
Then this should work from anywhere in cmd,as long as Scripts folder is in environment variable Path for Windows.
Reply


Messages In This Thread
Sound-player standalone - by snippsat - Mar-17-2018, 11:16 PM
RE: Sound-player standalone - by snippsat - Mar-21-2018, 08:17 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020