How to Upload a File in Wine
While I was working on my project on software licensing, I noticed that there are several packages in PyPI which do not have a requirements.txt file (the file mentioning the dependencies). License files, though not a rare species only surely an endangered one in the Python World. These made my life and so difficult yous lazy programmers, grrr).
"One has to solve her problem." And then whenever I used to encounter whatsoever developer I used to tell them the best practices for developers. Some of them used to give me not always a good vibe. (oh you irritating lady :(). Nigh of them were saddened by the long listing of all-time practices. (me (grrr, grrr, grr))
I wanted to upload my new project, gitcen in PyPI. I shared my this idea with my eternal rival. He gave me quite smiling.
He thinking : "Lady now you will empathise".
I smiled back.
Me thinking : "ohh man I hate yous".
The code was all prepare and working
I used both PyCharm and jupyter notebook to write code.
The master chore is done, now I will only accept to upload my projection at PyPI, the Pyhton Parcel Index.
requirements.txt
I created a requirements.txt file. One has to add the external dependencies. It helps to create the the like development environs. Instead of manually typing the dependencies one can use pip freeze which volition show the all modules installed in that particular virtual environment.
$ pip freeze $ pip freeze > requirements.txt
This is piece of cake, (Lazy coders).
setup.py
Now is the time for setup.py. Information technology is a Python file which helps us to get the package. In the file, we call the setup office. The parameter inside the function are the different metadata of the project. The setup.py file of gitcen looks similar this:
from setuptools import setup setup( name="gitcen", version='0.one.0', clarification="A project to discover git information.", long_description="A project to find git information about authors' commits,most active days and time.", author="Anwesha Das.", author_email="anwesha@das.customs", url="https://github.com/anweshadas/gitcen", license="GPLv3+", py_modules=['gitcen'], install_requires=[ 'Click', 'pygit2==0.24' ], entry_points=''' [console_scripts] gitcen=gitcen:main ''', classifiers=( 'Evolution Status :: three - Blastoff', 'Intended Audience :: Developers', 'License :: OSI Canonical :: GNU General Public License v3 or after (GPLv3+)', 'Programming Linguistic communication :: Python :: 3.6' ) )
A picayune bite of history, previously there was bundle a named distutils which provided the setup office. But now we employ the package setuptools.
It includes different information such as proper noun, license, entry betoken etc. In that location is a parameter classifiers . Read more well-nigh information technology here.
This was lenghty but ok. May these coders are non that lazy (while coding, otherwise is. As per my experience with my man goes.)
Creating Source Distribution
The side by side was to create a compressed tarball for source distribution.
$python3 setup.py sdist
Output of the command is a tar.gz file.
Creating PyPI account
PyPI, the Python Package Index, the 3rd party official software repository for Python ecosystem. I has to create an business relationship in it.
exam.pypi.org
If 1 wants to test the upload, test.pypi.org is the accost to become to. Know more than about the steps here.
When will this thing finish?
Utilise twine
twine helps to upload packages in PyPI. Information technology assembles the utilities to interact with PyPI. The start footstep was to install twine. I installed it from dnf packet managing director.
$ sudo dnf install python3-twine
I had to register my project. Using the following command
$ twine register dist/gitcen-0.1.0.tar.gz
Finally the moment had come up! I uploaded gitcen in PyPI with the following command
$ twine upload dist/gitcen-0.1.0.tar.gz
I had already put my authentication information in the ~/.pypirc
Now anyone can install gitcen from PyPI
$ pip install gitcen
Therefore going through this at present I understand that information technology is very frustrating. You lot have a working code and you are not been able to share this with the customs (easily, fast). If we give information technology a thought and so we can realize that these are steps i has to memorize. Every bit I was a first timer there were many new things to which I came across, so it made my life difficult. And yeah,
Lamentable coders, for not agreement your pain!
Source: http://anweshadas.in/how-to-upload-a-package-in-pypi-using-twine/
Belum ada Komentar untuk "How to Upload a File in Wine"
Posting Komentar