v0.0.0
Initial release.
Earlier version numbers appear in this project's git history but were never
tagged or published, so there is no upgrade path to describe -- everything
below is simply what the package contains.
Fixed
ws://andwss://URLs no longer parse as port 0. No system services
database has an entry for the websocket schemes, sogetservbyname("wss")
failed -- and those are the schemes this client uses most. Port resolution now
goes throughnetimps, whose scheme table is consulted before the system
database.
Added
pytruenas call <method>command. Invoke any middleware method by its
dotted name (system.info,core.ping,pool.dataset.details) — not just
the queryable<namespace>.querymethodsquerycovers. Parameters are JSON
values via-p/--param(repeatable).
Changed
-
CLI targets are now trailing positional arguments, not
-t/--target.
A command's own positionals come first, then the target host(s):
pytruenas query user nas1 nas2,pytruenas dump-api nas1,nas2. Comma lists
and[A-Z]/[0-9]range patterns still expand; no target meanslocalhost.
The-t/--targetflag has been removed. -
Dependency floors raised to the validated versions:
duho>=0.3.2(CLI parser
fixes — a global option before a subcommand is no longer shadowed; a literal
%in aCmddocstring no longer breaks parser build) and thesshextra's
pathlib_next[sftp-async]>=0.8.3(SFTP default concurrency raised 8→16).
Fixed
-
API calls no longer silently return
Noneon a dropped connection. The
namespace call retry loop fell through and returnedNoneafter a single
ECONNABORTED— which_getread as "record missing", turning an_upsert
into a spurious create (possible duplicate rows). It now retries then raises,
and never returnsNoneon a connection error. -
Long-running jobs no longer spuriously time out.
core.job_wait(waited
on after uploads/downloads and mutating_upsert/_updatecalls) is now
issued with no client-side timeout, so a job lasting longer than the 60s
default no longer raisesCallTimeoutwhile it is still running server-side.
Client.call(timeout=None)now means "wait indefinitely". -
client.run()with astrinputtogether with a textencoding/errors
no longer crashes. It used to pre-encode the string to bytes and hand the
encoding tosubprocess.run, which then tried to.encode()the already-bytes
input (AttributeError). Now text mode keepsstrinput as-is (and decodes
bytesinput), binary mode encodes. Found by live testing on TrueNAS 26.0. -
ops.template.TemplateTarget.apply_templateno longer crashes on a plain
string template (issubclass()was called on a non-type); astris now
treated as literal template content and a path-like is read as file content. -
namespace.ioerroronly maps a middleware error toOSErrorwhen the
bracketed prefix names a real POSIX errno; previously an unrecognised prefix
producedIOError(None, msg), discarding the original exception type.
Internal
jsonrpc.Client.callnarrows the compatibility kwargs it ignores and logs any
other unexpected keyword at debug level instead of silently swallowing it;
_ioerroris no longer forwarded into the upload/download paths.Namespacechild lookups use a per-instance dict instead offunctools.cache
on the methods, so namespaces are garbage-collected with their client instead
of being pinned for the process lifetime (relevant to long-lived embeddings).- The
pytruenas.opssubpackage (systemd/midclt host-config helpers) is
experimental and exercised only by unit tests, not against a live host.
Added
- Packaged as
pytruenas(src layout, hatchling,pytruenasconsole script,
py.typed). Python 3.9+. - Lean in-house JSON-RPC 2.0 client (
pytruenas.jsonrpc) speaking the middleware
protocol overwss:///ws://and the localws+unix://socket, with
extended-JSON (datetime/date/time/set/IP) round-tripping and
ClientException/ValidationErrorsmapping. Verified against a live host. - Attribute-style API namespace (
client.api.<namespace>.<method>(...)) with
_get/_query/_create/_update/_upsertconvenience helpers. - Filesystem paths on
pathlib_next:client.path()returns aLocalPath
(local) orTruenasPath(remote — SFTP-preferred via pathlib_next'sSftpPath,
falling back to the middlewarefilesystem.*websocket API for
delete/rename/symlink). - Typings generator (
generate-typings): produces.pyistubs for the whole
API, validated to parse across every version of a real v26 dump (780 methods). - CLI (
dump-api,query,generate-typings) onduhowith multi-target
fan-out (-t/--target,--parallel) and optional YAML config. - Optional extras:
ssh,config,codegen,host. - Test suite green on Python 3.9 and 3.13/3.14.
Notes
- Runtime CLI/logging/qualname/text come from
duho(>=0.3.0); path types from
pathlib_next(>=0.8.2). Both are on PyPI. - Remote shell command execution (
client.runover SSH) usesasyncssh(the
sshextra); the middleware API has no command-exec method. SFTP is handled by
pathlib_next.
Full Changelog: https://github.com/jose-pr/pytruenas/commits/v0.0.0