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.1.0

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.1.0
File Size Uploaded
port1900-0.1.0.tar.gz 8.6 kB Details

Built distribution (wheel)

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

Total release size: 19.3 kB

Release files / port1900-0.1.0.tar.gz

Download URL port1900-0.1.0.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2108c9c1e8c1ed3e947c34cc72eeeb659afe68a93137772235bb116e202e5349
BLAKE2b-256 checksum
How to use checksums
393d4c41d01f44095fa8f7f852814b85354a380b6b4b9e69b6569ba7c31279a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.4 {"installer":{"name":"uv","version":"0.12.4","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.1.0-py3-none-any.whl

Download URL port1900-0.1.0-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fc06b08f9d9a2d54a2462cd3325871ae6de51f9bb9f178a155cf81508a33e4e
BLAKE2b-256 checksum
How to use checksums
4084bcf70840aa504aaefe16a8a17d606bdf4d89aa9e56f6c88e19cbf9165079
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.4 {"installer":{"name":"uv","version":"0.12.4","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

This release

0.1.0 This release

2 release files

0.0.1

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