61
loading...
This website collects cookies to deliver better user experience
setup.cfg
--> It is the configuration file for setuptools. It tells setuptools about your package(such as the name and version) as well as which code files to include. There are a variety of metadata and options supported here.
[metadata]
description-file = README.md
setup.py
--> It is the build script for which tells setuptools about your package(such as the name and version) as well as which code files to include.
setuptools is a library designed to facilitate packaging Python projects.
setup.py
and enter the following content. Change the name to include your username; this ensures that you have a unique package name and that your package doesn’t conflict with packages uploaded by other people.from setuptools import setup, find_packages
version = '0.0.1' # Any format you want
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name='your-package-name',
packages=find_packages(),
version=version,
license='MIT',
description='Short description',
long_description=long_description,
long_description_content_type="text/markdown",
author='Author Name',
author_email='[email protected]',
url='https://gitlab.com/username/repo-name',
download_url=f'https://gitlab.com/username/repo-name/-/archive/{version}/repo-name-{version}.tar.gz',
keywords=['Some', 'keywords'],
install_requires=[
'dependency-1', # All external pip packages you are importing
'dependency-2',
],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
)
Copyright (c) 2021 YOUR NAME
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Repository --> Tags --> New Tag
and create new tag(tag name should be same as the version) for every release of the package to PyPI. setup.py
file.
NOTE:
Every time you want to update your package later on, upload a new version to gitlab/github, create a new release as discussed, specify a new release tag and copy-paste the link to Source into the setup.py file (do not forget to also increment the version number).
python setup.py sdist
pip install twine
twine upload --repository testpypi dist/*
Upload successful
pip install -i https://test.pypi.org/simple/ your-package-name
twine upload dist/*
python setup.py sdist
twine upload dist/*
pip install your-package --upgrade
--> to see whether your changes worked.
pip install your-package-name
.