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
Metadata
Release files for dokg 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dokg-0.4-py3-none-any.whl | Python 3 | none | any | Details for dokg-0.4-py3-none-any.whl |
Release files / dokg-0.4-py3-none-any.whl
| Download URL | dokg-0.4-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95a2d694c0ac5509a3eef68d4bc8a1280bf7e98080da38e921e78b7162b0137e
|
|
BLAKE2b-256 checksum How to use checksums |
0d539707e3703c0323556d48e00d48e814a009a30516bf4c7ba945be6d8da94e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
|
Security for dokg 0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.