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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

port1900-1.0.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

port1900-1.0.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file port1900-1.0.0.tar.gz.

File metadata

  • Download URL: port1900-1.0.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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}

File hashes

Hashes for port1900-1.0.0.tar.gz
Algorithm Hash digest
SHA256 86acdf5070e5ee8abb878d41ce55d1b48dd521efca591fed54b869415991e115
MD5 d0ffd1a2821afc847e3f5f12cec1e0e0
BLAKE2b-256 a2d541ab19e81cef480540619eaffdd22e17467635c7a95e36b7856d68cd6b86

See more details on using hashes here.

File details

Details for the file port1900-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: port1900-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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}

File hashes

Hashes for port1900-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd51649c71effe64ac30f2b29e1b852b5d08585ec7c0c3523d35478ab9f67333
MD5 0203cdb52abefe3a3142a801200acfba
BLAKE2b-256 bdba8caf35c5e38fcfb606a81ec5864383e4b9ed2886139614431885414e00fb

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.1.0

2 files

0.0.1

2 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