|
1 | 1 | --- |
2 | 2 | title: Packages |
3 | 3 | nav_order: 3 |
| 4 | +has_children: true |
4 | 5 | --- |
5 | 6 |
|
6 | 7 | ### Explore python packages |
@@ -28,4 +29,64 @@ from pybrot.Mandelbrot import Mandelbrot |
28 | 29 |
|
29 | 30 | m=Mandelbrot() |
30 | 31 | m.show() |
31 | | -``` |
| 32 | +``` |
| 33 | + |
| 34 | +# Steps to create local python package |
| 35 | + |
| 36 | +### References |
| 37 | +- [Publish your own python package](https://www.youtube.com/watch?v=tEFkHEKypLI) |
| 38 | + |
| 39 | +### Prepare all files |
| 40 | +- To create python package you'll need 4 things |
| 41 | + - solution folder : This contains all python script files related to your package |
| 42 | + - setup.py : file which contain package meta data |
| 43 | + - README : |
| 44 | + - LICENSE : package license |
| 45 | +- refer this github repo : [vidstream](https://github.com/NeuralNine/vidstream) |
| 46 | +- Sample setup.py file |
| 47 | + |
| 48 | + ```python |
| 49 | + from setuptools import setup, find_packages |
| 50 | + import codecs |
| 51 | + import os |
| 52 | + |
| 53 | + here = os.path.abspath(os.path.dirname(__file__)) |
| 54 | + |
| 55 | + with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh: |
| 56 | + long_description = "\n" + fh.read() |
| 57 | + |
| 58 | + VERSION = '0.0.13' |
| 59 | + DESCRIPTION = 'Streaming video data via networks' |
| 60 | + LONG_DESCRIPTION = 'A package that allows to build simple streams of video, audio and camera data.' |
| 61 | + |
| 62 | + # Setting up |
| 63 | + setup( |
| 64 | + name="vidstream", |
| 65 | + version=VERSION, |
| 66 | + author="NeuralNine (Florian Dedov)", |
| 67 | + author_email="<mail@neuralnine.com>", |
| 68 | + description=DESCRIPTION, |
| 69 | + long_description_content_type="text/markdown", |
| 70 | + long_description=long_description, |
| 71 | + packages=find_packages(), |
| 72 | + install_requires=['opencv-python', 'pyautogui', 'pyaudio'], |
| 73 | + keywords=['python', 'video', 'stream', 'video stream', 'camera stream', 'sockets'], |
| 74 | + classifiers=[ |
| 75 | + "Development Status :: 1 - Planning", |
| 76 | + "Intended Audience :: Developers", |
| 77 | + "Programming Language :: Python :: 3", |
| 78 | + "Operating System :: Unix", |
| 79 | + "Operating System :: MacOS :: MacOS X", |
| 80 | + "Operating System :: Microsoft :: Windows", |
| 81 | + ] |
| 82 | + ) |
| 83 | + ``` |
| 84 | +### Create *.whl file |
| 85 | +- install wheel package using `pip install wheel` |
| 86 | +- create python package using `python setup.py bdist_wheel` |
| 87 | +- this should generate build and dist folder on your project directory |
| 88 | +- you can find *.whl file in dist folder |
| 89 | + |
| 90 | +### install package using *.whl file |
| 91 | +- just use `pip install package.whl` command to install package on your local system, if package.whl is not in your current directory then you might need to specify whole path |
| 92 | +- find this package on directory `C:\Users\Ryzen2600x\AppData\Local\Programs\Python\Python311\Lib\site-packages` |
0 commit comments