Python package publish to pypi

1
~$ vim setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3

#from distutils.core import setup
import platform
import setuptools

def build_params():
params = {
'name':'copycat-clipboard3',
'version':'1.1',
'description':'easy way let use clip on command line with system clip (support python 3)',
'author':'Ming',
'author_email':'ming@alone.tw',
'url':'https://github.com/iwdmb/copycat',
'py_modules':['copycat3'],
'license':'MIT',
'install_requires': ['clime', 'pyclip-copycat'],
}
if platform.system() == 'Windows':
params['scripts'] = ['copycat3.bat']
else:
params['scripts'] = ['copycat3']

return params

setuptools.setup (
**build_params()
)
1
~$ vim ~/.pypirc
1
2
3
4
5
6
7
8
[distutils]
index-servers =
pypi

[pypi]
repository=https://pypi.python.org/pypi
username=*username*
password=*password*
1
2
3
4
5
6
~$ python3 -m venv ./venv
~$ source ./venv/bin/active
~$ pip install --upgrade pip
~$ pip install --upgrade setuptools wheel
~$ python3 setup.py sdist bdist_wheel
~$ python setup.py sdist upload -r pypi

Reference