Skip to main content

The simplest and quickest way to build and upload a PyPI package

Project description

Quick-PyPI

The simplest and quickest way to build and upload a PyPI package

Installation

pip install quick-pypi

Minimum Example

Before you start, you need to have several things:

  • Determine a unique PyPI package name, easy to remember, like 'quick-pypi-test';
  • Have a PyPI account, then export your upload token to a txt file in your computer;
  • Use PyCharm IDE to develop your own package. NOT notebook!

Step 1: Prepare your PyCharm project tree like:

PyCharm Project Root
 -- src
   -- your_package_name
     -- __init__.py
     -- your_class.py   # where you can write your own code!
 -- dists               # auto generated folder storing uploading version history
   -- 0.0.1
   -- 0.0.2
   -- ...
   -- VERSION           # a file storing the latest version of uploading
 quick_pypi.py          # Main settings of uploading package

Step 2: The simplest quick_pypi.py file content is below:

from quick_pypi.deploy import *
auto_deploy(
    cwd=os.path.dirname(os.path.realpath(__file__)), # current working directory, generally as project root
    name="quick-pypi-test",
    description="This is a quick-pypi-test package!",
    pypi_token='../../pypi_upload_token.txt', # the token string or path from your PyPI account
)

Step 3: Deploy the package to PyPI server

After you finish writing your codes in the src package, you can just simply right-click the quick-pypi.py to run, and wait for its completion.

Step 4: Check if the package is uploaded successfully!

Complicated Example settings for advanced users

A real example is here:

from quick_pypi.deploy import *

auto_deploy(
    cwd=os.path.dirname(os.path.realpath(__file__)),
    name="pyrefworks",
    long_name="A Python Toolkit for RefWorks Data Analysis",
    description="Converting RefWorks files into a CSV table file",
    long_description="This is a project to convert RefWork files to a CSV file",
    src_root="src",
    dists_root=f"dists",
    pypi_token='../pypi_upload_token.txt', # a file storing the token from your PyPI account
    test=False, # determine if uploading to test.pypi.org
    version="0.0.1a0", # fixed version when uploading or using version='auto'
    project_url="http://github.com/dhchenx/pyrefworks",
    author_name="Donghua Chen",
    author_email="xxx@xxx.com",
    requires="quick-csv",
    license='MIT',
    license_filename='LICENSE',
    keywords="refworks, csv file",
    github_username="dhchenx",
    max_number_micro=20, # major.minor.micro
    max_number_minor=20 # version maximum numbers in each part, e.g. 0.0.20 --> 0.1.0; 0.20.20 --> 1.0.0
)

Here you can provide more information about your package, like setting your author's name, email, license, short or long names and descriptions, etc.

Deploy to local computer without upload

import quick_pypi as qp

qp.deploy(
    src_root="src",
    dist_root='data/dist1',
   # name="quick-pypi-test",
   # description="This is a quick-pypi project",
    version="0.0.1a0", # fixed version number, wont change
   # project_url="http://github.com/dhchenx/quick-pypi-test",
   #  author_name="Donghua Chen",
    # author_email="douglaschan@126.com",
    # requires="jieba;quick-crawler",
    # license='MIT',
    # license_filename='LICENSE'
)

This will generate a series of actual package files (e.g. README.md, LICENSE,setup.py, etc. ).

Then, you can manually build the package through twine in the directory of dist1.

An example using our toolkit to deploy in the PyPI platform is demonstrated here.

License

The quick-pypi project is provided by Donghua Chen.

Project details


Download files

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

Source Distribution

quick-pypi-0.0.1a2.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

quick_pypi-0.0.1a2-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file quick-pypi-0.0.1a2.tar.gz.

File metadata

  • Download URL: quick-pypi-0.0.1a2.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for quick-pypi-0.0.1a2.tar.gz
Algorithm Hash digest
SHA256 8628d24a513d645e8058af786bdc4f90017d87881e44e57ff75986632fab34d9
MD5 9e1f9c7e133661e4bf24d0592f8b6a4e
BLAKE2b-256 2e0f03f75e9f4f269546de73dc920c0bd760a13ab3e1ef9688e1173ffdddf9b5

See more details on using hashes here.

File details

Details for the file quick_pypi-0.0.1a2-py3-none-any.whl.

File metadata

  • Download URL: quick_pypi-0.0.1a2-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for quick_pypi-0.0.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 b7816fa799df2a90cdf1f1885020d366fd5a2be68d9a0e9e79afecbfbf9c2b17
MD5 0375d7bc29f1faf494d9850ec35213f7
BLAKE2b-256 9b9d842c17c38c0a180f2d8385b6f1ed30effd940fa44b66508cf8c16dbf620a

See more details on using hashes here.

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