Skip to main content

Port1900: Async Nex Protocol Client Library

Port1900 is an async-first, fully type-hinted Python client library for the Nex protocol.

Features

  • Async First: Built on top of Python's standard asyncio networking loop.
  • Nex Protocol Support: Connection management, path transmission, stateless retrieval, and directory detection.
  • Type Safe: Fully typed API passing strict static type checking (mypy --strict).
  • NexURI Representation: Rich URI class to parse, inspect, validate, manipulate, and resolve Nex URIs.
  • Zero Dependencies: Built entirely on Python's standard library.
  • CLI Utility: Includes a port1900 command-line interface out of the box.

Installation

port1900 requires Python 3.12 or later and can be installed with your package manager of choice.

With pip:

pip install port1900

With uv:

uv add port1900

Quick Start

1. Make a Simple Request

Use Client with standard async context managers to query a Nex server:

import asyncio
from port1900 import Client, Port1900Error

async def main():
    async with Client() as client:
        try:
            # Query a Nex document or directory
            response = await client.request("nex://nex.nightfall.city/")

            print(f"Target host: {response.uri.host}")
            print(f"Is directory: {response.is_directory}")
            print(f"Content length: {len(response.content)} bytes")
            print("--- Response Text ---")
            print(response.text)
        except Port1900Error as error:
            print(f"Request failed: {error}")

if __name__ == "__main__":
    asyncio.run(main())

2. Working with NexURI

The NexURI class parses full URI strings (nex://host/path) or path targets:

from port1900 import NexURI

# Parse from Nex URI string
uri = NexURI.from_string("nex://nex.nightfall.city/hello-world.txt")

print(uri.host)          # 'nex.nightfall.city'
print(uri.port)          # 1900
print(uri.path)          # '/hello-world.txt'
print(uri.request_path)  # 'hello-world.txt'
print(uri.is_directory)  # False

# Create modified copies
custom_port_uri = uri.with_port(1905)
parent_uri = uri.parent
root_uri = uri.root

Command Line Interface (CLI)

port1900 includes a command-line client:

# Query a Nex target (defaults to nex://nex.nightfall.city/)
uv run port1900 nex://nex.nightfall.city/

# Query on a custom port
uv run port1900 -p 1905 nex://example.com/hello-world.txt

# Output raw binary content to stdout
uv run port1900 -r nex://nex.nightfall.city/image.png

# Display CLI help
uv run port1900 --help

Licence

MIT

Release files for port1900 0.0.1

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

Source distribution (sdist)

Source distribution for port1900 0.0.1
File Size Uploaded
port1900-0.0.1.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for port1900 0.0.1
File Interpreter ABI Platform
port1900-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.3 kB

Release files / port1900-0.0.1.tar.gz

Download URL port1900-0.0.1.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
349d058ff424015935fd8fb72c714908b6eff1929b7c90b6caf50ac96363a1ad
BLAKE2b-256 checksum
How to use checksums
0e1d51dede24f2118a13a9cee055ffd9498db9f2b66fefd1710a49b4abf24cd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / port1900-0.0.1-py3-none-any.whl

Download URL port1900-0.0.1-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53987952f5752a5a234af252e3bc8ddf69b4bdb7fb34482b7c09e37d59a4b76c
BLAKE2b-256 checksum
How to use checksums
fc32a0e62d2e82fd8c16fd6611998b3a4c66bd09d752dce7a1701bb1e5324381
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

1.0.0

2 release files

0.1.0

2 release files

This release

0.0.1 This release

2 release files

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