The command-line tool for creating and managing DBBasic apps: thin scripts over git, cp and sed.

0 downloads

dbbasic-cli-new/PUBLISHING.md
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-cli-new.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-cli-new.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-cli-new.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Prepare for PyPI publication 57213b9 1 year, 1 month ago History
PUBLISHING.md · 3.5 KB · 180 lines

Publishing dbbasic-cli to PyPI

Prerequisites

  1. Install build tools:
pip install build twine
  1. Create PyPI account at https://pypi.org/account/register/
  1. Set up API token:
  • Go to https://pypi.org/manage/account/token/
  • Create new token (scope: Entire account or specific project)
  • Save token securely

Build Distribution

# Clean previous builds
rm -rf build/ dist/ *.egg-info/

# Build packages
python -m build

# This creates:
# dist/dbbasic_cli-1.0.0-py3-none-any.whl
# dist/dbbasic_cli-1.0.0.tar.gz

Test on TestPyPI (Recommended First)

# Upload to TestPyPI
python -m twine upload --repository testpypi dist/*

# Test installation from TestPyPI
pip install --index-url https://test.pypi.org/simple/ dbbasic-cli

Publish to PyPI

# Upload to PyPI
python -m twine upload dist/*

# You'll be prompted for credentials:
# Username: __token__
# Password: pypi-... (your API token)

Install from PyPI

Once published, anyone can install with:

pip install dbbasic-cli

This will:

  1. Install the dbbasic_cli Python package
  2. Create the dbbasic command globally (available in any directory)
  3. Enable auto-discovery of module commands from other dbbasic-* packages

Testing Global Installation

After publishing, test in a fresh environment:

# Create clean virtual environment
python -m venv test_env
source test_env/bin/activate  # On Windows: test_env\Scripts\activate

# Install from PyPI
pip install dbbasic-cli

# Test command
dbbasic help
dbbasic list

# Test from different directory
cd /tmp
dbbasic help

Version Bumping

Before each release:

  1. Update version in dbbasic_cli/__init__.py:
__version__ = "1.0.1"
  1. Update version in setup.py:
version="1.0.1",
  1. Create git tag:
git tag -a v1.0.1 -m "Release version 1.0.1"
git push origin v1.0.1
  1. Build and publish new version

Semantic Versioning

  • Major (1.x.x): Breaking changes
  • Minor (x.1.x): New features, backward compatible
  • Patch (x.x.1): Bug fixes

Package Name Note

The PyPI package name is dbbasic-cli but:

  • Import as: import dbbasic_cli
  • Command name: dbbasic (without -cli)

This matches the pattern of other CLIs like:

  • pip install django → command: django-admin
  • pip install flask → command: flask
  • pip install pytest → command: pytest

Continuous Integration (Future)

Consider setting up GitHub Actions to:

  1. Run tests on push
  2. Build packages on tag
  3. Auto-publish to PyPI on release

Example .github/workflows/publish.yml:

name: Publish to PyPI

on:
  release:
    types: [created]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-python@v4
      with:
        python-version: '3.10'
    - name: Install dependencies
      run: |
        pip install build twine
    - name: Build package
      run: python -m build
    - name: Publish to PyPI
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
      run: twine upload dist/*

Current Status

Package: dbbasic-cli Version: 1.0.0 Status: Ready for PyPI publication Command: dbbasic (globally available after install) Dependencies: None (pure Python stdlib)

Quick Publish Commands

# 1. Clean and build
rm -rf build/ dist/ *.egg-info/
python -m build

# 2. Check packages
twine check dist/*

# 3. Upload to PyPI
twine upload dist/*