Work memo when creating a package with Python and registering it in PyPI In addition, this time I made a command line tool
By registering with PyPI, you will be able to install with pip
├── README.md
├── requirements.txt
├── setup.py
└── src
├── __init__.py
└── hoge.py
An empty file created with touch
For github
Source code of the implemented package
Since this is a command line tool, I have described the process to be executed in the main
function.
Enter the information required when registering the package
```Py:setup.py
# -*- encoding:utf-8 -*-
from setuptools import setup, find_packages
setup(
name='pass-manager',
version='1.0.0',
author='petitviolet',
author_email='[email protected]',
packages=find_packages(),
install_requires=[],
description = 'CLI tool',
long_description = 'Simple CLI tool',
url = 'https://example.com/',
license = 'MIT',
# scripts = ['src/hoge.py'],
platforms = ['Mac OS X'],
# platforms = ['POSIX', 'Windows', 'Mac OS X'],
entry_points={
'console_scripts': 'hoge = src.hoge:main'
},
zip_safe=False,
classifiers=[
'Environment :: Console',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Utilities'
]
)
```
Enter classfiers
and license
by looking at [https://pypi.python.org/pypi?:action=list_classifiers](https://pypi.python.org/pypi ?:action=list_classifiers). I think.
# setup.Check py
$ python setup.py check
# -> "running check"Is output
$ python setup.py register
running register
...
We need to know who you are, so please choose either:
1. use your existing login,
2. register as a new user,
3. have the server generate a new password for you (and email it to you), or
4. quit
Your selection [default 1]:
Now select 2
and register your username and password
The user account is actually created
In addition, password will get angry if it is not strong enough
python setup.py register sdist bdist bdist_egg upload
You can now upload the source, binaries and eggs to PyPI.
You will be able to access the uploaded package at http://pypi.python.org/pypi/ "PKG-NAME" Package information (contents described in setup.py) can also be edited from the PyPI package page.
Recommended Posts