Skip to content

server ¤

Logic for the PyPI server.

Classes:

Functions:

DistCollection ¤

DistCollection(index_url: str = DEFAULT_INDEX_URL)

Manage distributions.

Parameters:

  • index_url (str, default: DEFAULT_INDEX_URL ) –

    The URL of the PyPI index to use.

Methods:

latest_version ¤

latest_version(package: str) -> str | None

Get the latest version of a package.

Parameters:

  • package (str) –

    The package name (distribution name).

Returns:

  • str | None

    The version as a string, or none.

upload ¤

upload(dists: Iterable[str | Path]) -> None

Upload distributions.

Parameters:

version_exists ¤

version_exists(package: str, version: str) -> bool

Tell if a package version exists.

Parameters:

  • package (str) –

    The package name (distribution name).

  • version (str) –

    The package version.

Returns:

  • bool

    True or False.

server_logs ¤

server_logs(*, port: int = 31411) -> None

Show the server logs.

Parameters:

  • port (int, default: 31411 ) –

    The server port.

server_loop ¤

server_loop(
    *,
    dist_dir: str | Path = DEFAULT_DIST_DIR,
    port: int = DEFAULT_PORT
) -> None

Run the server in the foreground.

Parameters:

  • dist_dir (str | Path, default: DEFAULT_DIST_DIR ) –

    The directory that will receive the distribution artifacts.

  • port (int, default: DEFAULT_PORT ) –

    The server port.

server_status ¤

server_status(*, port: int = 31411) -> dict | None

Return the server status as a dict of metadata.

Parameters:

  • port (int, default: 31411 ) –

    The server port.

Returns:

  • dict | None

    Some metadata about the server process.

start_server ¤

start_server(
    *,
    dist_dir: str | Path = DEFAULT_DIST_DIR,
    port: int = DEFAULT_PORT
) -> None

Start the watcher in the background.

Parameters:

  • dist_dir (str | Path, default: DEFAULT_DIST_DIR ) –

    The directory that will receive the distribution artifacts.

  • port (int, default: DEFAULT_PORT ) –

    The server port.

stop_server ¤

stop_server(*, port: int = 31411) -> bool

Stop the server.

Parameters:

  • port (int, default: 31411 ) –

    The server port.

Returns:

  • bool

    Whether a process was killed or not.