Skip to content

Latest commit

 

History

History
74 lines (54 loc) · 1.81 KB

pypi-package-creation.md

File metadata and controls

74 lines (54 loc) · 1.81 KB

Step to create a python package on pypi

Configure Your Package for PyPI

Ensure that your setup.py or pyproject.toml file is properly configured to include the README.md file.

For setup.py:

from setuptools import setup, find_packages

setup(
    name='mathlib',
    version='0.1',
    packages=find_packages(),
    description='A simple math library with basic operations',
    long_description=open('README.md').read(),
    long_description_content_type='text/markdown',
    author='Arun Kumar Pandey',
    author_email='[email protected]',
    url='https://github.com/arunp77/mathlib-package/',
    license='MIT',
    install_requires=[],
    classifiers=[
        'Programming Language :: Python :: 3',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
    ],
)

For pyproject.toml with Poetry:

[tool.poetry]
name = "your-package-name"
version = "0.1.0"
description = "A brief description of your package"
readme = "README.md"
authors = ["Your Name <[email protected]>"]
license = "MIT"

[tool.poetry.dependencies]
# List your package dependencies here

Build Your Package

Before uploading to PyPI, build your package (but first install the following package: pip install wheel twine) and then go to:

python setup.py sdist bdist_wheel

Or if using Poetry:

poetry build

Upload to PyPI

Upload your package to PyPI using Twine:

twine upload dist/*

6. Verify Your Package

After uploading, you can verify your package on PyPI by visiting the PyPI website and searching for your package name. Ensure that the README.md content appears correctly.

My package is available at: https://pypi.org/project/arunp77-mathlib/.