Requirements
Wheel: It is a built package that can be installed without the build proces
pip install wheel
Twine : It is a utility for interacting with PyPI
pip install twine
Configuring a Project
Here are files that will needed in root level.
setup.py : It contains a global setup() function. The keyword arguments to this function are how specific details of your project are defined.
1 setup(
2 name='sample',
3
4 # Versions should comply with PEP440.
5 version='1.0.0',
6
7 description='A sample Python project',
8 # url, author, author_email, license
9
10 # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
11 classifiers=[
12 # How mature is this project? Common values are (Alpha, Beta, Production)
13 'Development Status :: 3 - Alpha',
14
15 # that you indicate whether you support Python 2, Python 3 or both.
16 'Programming Language :: Python :: 2.7',
17 ],
18
19 keywords='sample module',
20
21 # List run-time dependencies here
22 install_requires=['peppercorn'],
23
24 # List additional groups of dependencies here (e.g. development dependencies).
25 extras_require={
26 'dev': ['check-manifest'],
27 'test': ['coverage'],
28 },
29
30 # If there are data files included in your packages
31 package_data={
32 'sample': ['package_data.dat'],
33 },
34
35 # Place data files outside of your packages
36 data_files=[('my_data', ['data/data_file'])],
37
38 # To provide executable scripts
39 entry_points={
40 'console_scripts': [
41 'sample=sample:main',
42 ],
43 },
44 )
45
setup.cfg : It is ini file that contains option defaults for setup.py
README.rst : It is readme for the project
MANIFEST.in : Where you need to package additional files
Package (Folder) : Most common practice to is to include all python modules and packages under a single top-level package that has the same name as the project
Building
Development Mode
- python setup.py develop
This will install any dependencies declared with “install_requires” and also any scripts declared with “console_scripts”.
Packaging Project
Source Distributions
- python setup.py sdist
To build a Universal Wheel:
- python setup.py bdist_wheel --universal
Pure Python Wheels
- python setup.py bdist_wheel
Install for windows
- python setup.py bdist_wininst
Now you can share and install it in windows easy with wizard as below
Now Check Index of Modules from : http://localhost:7464/
You can find you new modules in here
you can used it in python now as module as below and you can share it with other developers.
1 import minifycsv
2
3 #using minifycsv
4 minifycsv.main()
Next we can see uploading the Project to PyPI.
Add a comment