setup.py a python project and distribute
Step 1: pip install virtualenv
what and why virtualenv ?
Step 2: Create a directory setup_pythonProject and within this directory put your project 'myProject' and
cmd > virtualenv vivekVirtualenv
Output:
Step 3: Activate virtual environment
cmd > vivekVirtualenv\Scripts\activate.bat
i.e.
E:\setup_pythonProject>vivekVirtualenv\Scripts\activate.bat
Output:
(vivekVirtualenv) E:\setup_pythonProject>
which means that we are now pointing to the created virtual environment
Step 4: Install a package
cmd > pip install requests
cmd > pip freeze
Output:
If you pip freeze>requirements.txt then a requirements file will get created.
Step 5: If using pycharm from tools for the root directory select create setup.py
This will create a setup.py file
Step 6: Now cmd> python setup.py install
This will create a build folder
Step 7: cmd> python setup.py sdist
sdist means source distribution.sdist creates the archive of the default format for the current platform. The default format is a gzip’ed tar file (.tar.gz) on Unix, and ZIP file on Windows.
python setup.py sdist --formats=gztar,zip will create zip folder
for more details click sdist
Step 8: cmd> python setup.py bdist
bdist means binary distribution
The default format for built distributions is a “dumb” tar file on Unix, and a simple executable installer on Windows. (That tar file is considered “dumb” because it has to be unpacked in a specific location to work.).For more details click bdist
what and why virtualenv ?
Step 2: Create a directory setup_pythonProject and within this directory put your project 'myProject' and
cmd > virtualenv vivekVirtualenv
Output:
Step 3: Activate virtual environment
cmd > vivekVirtualenv\Scripts\activate.bat
i.e.
E:\setup_pythonProject>vivekVirtualenv\Scripts\activate.bat
Output:
(vivekVirtualenv) E:\setup_pythonProject>
which means that we are now pointing to the created virtual environment
Step 4: Install a package
cmd > pip install requests
cmd > pip freeze
Output:
If you pip freeze>requirements.txt then a requirements file will get created.
Step 5: If using pycharm from tools for the root directory select create setup.py
This will create a setup.py file
Step 6: Now cmd> python setup.py install
This will create a build folder
Step 7: cmd> python setup.py sdist
sdist means source distribution.sdist creates the archive of the default format for the current platform. The default format is a gzip’ed tar file (.tar.gz) on Unix, and ZIP file on Windows.
python setup.py sdist --formats=gztar,zip will create zip folder
for more details click sdist
Step 8: cmd> python setup.py bdist
bdist means binary distribution
The default format for built distributions is a “dumb” tar file on Unix, and a simple executable installer on Windows. (That tar file is considered “dumb” because it has to be unpacked in a specific location to work.).For more details click bdist
Comments
Post a Comment