Skip to main content

My test package

Project description

My test package ๐Ÿ˜๐Ÿ˜๐Ÿ˜

STEP to upload your package

1. Install the required packages:

  • Setuptools: Setuptools is a package development process library designed for creating and distributing Python packages.
  • Wheel: The Wheel package provides a bdist_wheel command for setuptools. It creates .whl file which is directly installable through the pip install command. We'll then upload the same file to pypi.org.
  • Twine: The Twine package provides a secure, authenticated, and verified connection between your system and PyPi over HTTPS.
  • Tqdm: This is a smart progress meter used internally by Twine.
sudo python -m pip install --upgrade pip setuptools wheel
sudo python -m pip install tqdm
sudo python -m pip install --user --upgrade twine

2. Setup project

  • Create folder structure follow this repo
  • Package file sample dokg
#!/usr/bin/env python
echo "hey there, this is my first pip package"
  • Make script excecutable: chmod +x dokr

  • Create a setup file setup.py in your package. This file will contain all your package metadata information.

import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()


setuptools.setup(
    name = 'dokg',
    version = '0.3',
    scripts = ['dokg'],
    author = 'Hai V.Dam',
    author_email = 'haidv@tomochain.com',
    description  = 'My test package',
    long_description = long_description,
    long_description_content_type = "text/markdown",
    url = 'https://github.com/naviat/dokg',
    packages = setuptools.find_packages(),
    classifiers = [
         "Programming Language :: Python :: 3",
         "Programming Language :: Python :: 2",
         "License :: OSI Approved :: MIT License",
         "Operating System :: OS Independent",
    ],
)

3. Compiling Your Package

Go into your package folder and execute this command: python setup.py bdist_wheel. This will create a structure like this:

.
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ build
โ”‚   โ”œโ”€โ”€ bdist.macosx-10.7-x86_64
โ”‚   โ””โ”€โ”€ scripts-3.7
โ”‚       โ””โ”€โ”€ dokg
โ”œโ”€โ”€ dist
โ”‚   โ””โ”€โ”€ dokg-0.3-py3-none-any.whl
โ”œโ”€โ”€ dokg
โ”œโ”€โ”€ dokg.egg-info
โ”‚   โ”œโ”€โ”€ PKG-INFO
โ”‚   โ”œโ”€โ”€ SOURCES.txt
โ”‚   โ”œโ”€โ”€ dependency_links.txt
โ”‚   โ””โ”€โ”€ top_level.txt
โ””โ”€โ”€ setup.py
  • build: build package information.

  • dist: Contains your .whl file. A WHL file is a package saved in the Wheel format, which is the standard built-package format used for Python distributions. You can directly install a .whl file using pip install some_package.whl on your system

  • project.egg.info: An egg package contains compiled bytecode, package information, dependency links, and captures the info used by the setup.py test command when running tests.

4. Upload on pip

  • Create pypirc: The Pypirc file stores the PyPi repository information. Create a file in the home directory

for Windows : C:\Users\UserName\.pypirc

for *nix : ~/.pypirc

And add the following content to it. Replace javatechy with your username. ๐Ÿ˜๐Ÿ˜๐Ÿ˜

[distutils] 
index-servers=pypi
[pypi] 
repository = https://upload.pypi.org/legacy/ 
username = naviat

To upload your dist/*.whl file on PyPi, use Twine:

python -m twine upload dist/*

NOTE: When upgrade your package => delete all file in dist folder before run the command above

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

dokg-0.4-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page