Skip to main content

PyPI Publish Example

Przykład publikacji paczki Python do PyPI bezpośrednio z README.

git clone https://github.com/wronai/markpact.git

Użycie

# Podgląd bez publikacji
markpact examples/pypi-publish/README.md --publish --dry-run

# Publikacja do TestPyPI
markpact examples/pypi-publish/README.md --publish --registry pypi-test

# Publikacja do PyPI z bump wersji
markpact examples/pypi-publish/README.md --publish --bump patch

# Publikacja do PyPI (produkcja)
markpact examples/pypi-publish/README.md --publish

Instalacja i użycie CLI

Po publikacji na PyPI, możesz zainstalować i używać CLI:

# Instalacja
pip install markpact-example-pypi

# Użycie CLI
markpact-example-pypi
# Output: Hello, World!

# Z niestandardowym imieniem
markpact-example-pypi --name "Markpact"
# Output: Hello, Markpact!

# Dodawanie liczb
markpact-example-pypi --add 5 3
# Output: 5 + 3 = 8

Konfiguracja

Upewnij się, że masz skonfigurowany ~/.pypirc:

[pypi]
username = __token__
password = pypi-xxxx

[testpypi]
username = __token__
password = pypi-xxxx

publishing:

markpact examples/pypi-publish/README.md --publish

generated files:

./sandbox/
└── markpact_example_pypi
    ├── cli.py
    ├── dist
    │   ├── markpact_example_pypi-0.1.15-py3-none-any.whl
    │   └── markpact_example_pypi-0.1.15.tar.gz
    ├── __init__.py
    ├── pyproject.toml
    └── README.md

output:

[markpact] Parsing examples/pypi-publish/README.md
[markpact] wrote /home/tom/github/wronai/markpact/sandbox/markpact_example_pypi/__init__.py
[markpact] wrote /home/tom/github/wronai/markpact/sandbox/markpact_example_pypi/cli.py
[markpact] Bumped version to 0.1.7
[markpact] Publishing markpact-example-pypi v0.1.7 to PyPI...
[markpact] Building package...
[markpact] Uploading to PyPI...
[markpact] Found ~/.pypirc at: /home/tom/.pypirc
[markpact] ~/.pypirc section [pypi] parsed:
    username = __token__
    password = pypi-AgE...
[markpact] Running twine command:
    /home/tom/miniconda3/bin/python3 -m twine upload --config-file /home/tom/.pypirc --verbose dist/*
[markpact] ✓ Published to PyPI
[markpact] Version: 0.1.7
[markpact] URL: https://pypi.org/project/markpact-example-pypi/
[markpact] Updated version in examples/pypi-publish/README.md

published project: https://pypi.org/project/markpact-example-pypi/


registry = pypi
name = markpact-example-pypi
version = 0.1.18
description = Example package published with markpact
author = Your Name
license = MIT
keywords = example, markpact, demo
repository = https://github.com/your/repo
"""Example package published with markpact"""

__version__ = "0.1.0"

def hello(name: str = "World") -> str:
    """Say hello to someone."""
    return f"Hello, {name}!"

def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b
"""CLI for example package"""

import argparse
from . import hello, add

def main():
    parser = argparse.ArgumentParser(description="Example CLI")
    parser.add_argument("--name", default="World", help="Name to greet")
    parser.add_argument("--add", nargs=2, type=int, help="Add two numbers")
    
    args = parser.parse_args()
    
    if args.add:
        result = add(args.add[0], args.add[1])
        print(f"{args.add[0]} + {args.add[1]} = {result}")
    else:
        print(hello(args.name))

if __name__ == "__main__":
    main()
# No HTTP tests for CLI package

Metadata

Release files for markpact-example-pypi 0.1.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for markpact-example-pypi 0.1.19
File Size Uploaded
markpact_example_pypi-0.1.19.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for markpact-example-pypi 0.1.19
File Interpreter ABI Platform
markpact_example_pypi-0.1.19-py3-none-any.whl Python 3 none any Details

Total release size: 6.7 kB

Release files / markpact_example_pypi-0.1.19.tar.gz

Download URL markpact_example_pypi-0.1.19.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4eb32606c91aa5c137f737a6c662f7dd5a6db770f512a92c9aafabe0e6f1d734
BLAKE2b-256 checksum
How to use checksums
26f3f415b7b6764bded14197fcc25aed425982fbaacaa233635c1642dd58ce0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / markpact_example_pypi-0.1.19-py3-none-any.whl

Download URL markpact_example_pypi-0.1.19-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4b291a103912cf5bb6ee1caabc4b1dd15dd26b5c736b06ef9ed7a637b4fb2cb
BLAKE2b-256 checksum
How to use checksums
0b864d2aa413ccb6b66358c36c5d6a095eaa5080cd6627f40dd174dba62a35fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.19 This release

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page