Skip to main content

Oaknut family meta-distribution — tools for Acorn computer filesystems, files, and formats.

Project description

oaknut

Python tools for Acorn computer filesystems, files, and formats — the BBC Micro, Electron, Archimedes, and their descendants.

This repository is a uv workspace monorepo containing the oaknut-* family of packages. Each package is independently published to PyPI, but they all contribute to a shared oaknut. Python namespace so that imports read naturally:

from oaknut.file import AcornMeta, MetaFormat
from oaknut.dfs import DFS
from oaknut.adfs import ADFS
from oaknut.afs import AFS
from oaknut.basic import tokenise
from oaknut.zip import extract_archive

Packages

PyPI distribution Import path Scope
oaknut-file oaknut.file Acorn file metadata handling: INF sidecars, filename encoding, xattrs, and access flags
oaknut-discimage oaknut.discimage Disc image sector abstractions shared by Acorn filesystem packages
oaknut-basic oaknut.basic BBC BASIC tokeniser and detokeniser for Acorn 8-bit and 32-bit BASIC source files
oaknut-dfs oaknut.dfs Python library for handling Acorn DFS disc images (SSD/DSD format)
oaknut-adfs oaknut.adfs Acorn ADFS disc image support for Archimedes, RISC OS, and BBC Master
oaknut-zip oaknut.zip Work with ZIP files containing Acorn computer metadata
oaknut-afs oaknut.afs Acorn Level 3 File Server (AFS) filesystem support — the private on-disc format WFSINIT prepares in the tail of an old-map ADFS disc
oaknut-disc oaknut.disc CLI for working with Acorn DFS, ADFS, and AFS disc images

The dependency arrows run strictly bottom-up: file → discimage → {dfs, adfs} → afs, with basic feeding into dfs and adfs, and zip depending only on file. The disc CLI package depends on all library packages.

Quickstart: opening a disc

from oaknut.dfs import DFS
from oaknut.dfs.formats import ACORN_DFS_40T_SINGLE_SIDED

# Create a blank 40-track single-sided DFS image in memory. The
# catalogue is initialised empty with the supplied title.
dfs = DFS.create(ACORN_DFS_40T_SINGLE_SIDED, title="WELCOME")

# Files live under the catalogue root. The "$" directory is the
# default if you write a bare filename.
(dfs.root / "HELLO").write_bytes(b'PRINT "Hello, World!"')

print(f"title:        {dfs.title!r}")
print(f"files:        {[str(f.path) for f in dfs.files]}")
print(f"free_sectors: {dfs.free_sectors}")

Output:

title:        'WELCOME'
files:        ['$.HELLO']
free_sectors: 397

Quickstart: Acorn file metadata

from oaknut.file import AcornMeta

# A RISC OS file with the ArtWorks filetype (0xD94) stamped into its
# load address. The bottom byte is the low half of the date word.
meta = AcornMeta(load_addr=0xFFFD9400, exec_addr=0xFFF12345)

print(f"load_addr:         0x{meta.load_addr:08X}")
print(f"filetype-stamped:  {meta.is_filetype_stamped}")
print(f"inferred filetype: 0x{meta.infer_filetype():03X}")

Output:

load_addr:         0xFFFD9400
filetype-stamped:  True
inferred filetype: 0xD94

The disc CLI

The oaknut-disc package provides a unified command-line tool for working with Acorn disc images:

# List contents of a DFS floppy
disc ls games.ssd '$'

# Copy a file between a DFS floppy and an ADFS hard disc
disc cp games.ssd:'$.ELITE' scsi0.dat:'$.Elite'

# Create and initialise a Level 3 File Server disc
disc create scsi0.dat --format adfs-hard --capacity 10MiB --title Server
disc afs-init scsi0.dat --disc-name Server --cylinders 309 \
  --user Syst:S --user RJS:2MiB \
  --emplace Library --emplace Library1

# View both ADFS and AFS partitions
disc tree scsi0.dat

The tool supports DFS, ADFS, and AFS transparently, with filing-system prefix dispatch (afs:$, adfs:$, dfs:$) for dual-partition images. Acorn star-aliases (*CAT, *DELETE, *RENAME, etc.) are accepted alongside their Unix equivalents.

Development

git clone https://github.com/rob-smallshire/oaknut.git
cd oaknut
uv sync
uv run pytest

The workspace uses [tool.uv.sources] in the root pyproject.toml to wire sibling packages as local path dependencies during development, so any change in one package is immediately visible to the others without a publish round-trip. End users installing from PyPI get the published versions resolved normally.

Guidance for working on the codebase lives in CLAUDE.md at the workspace root, with package-specific addenda in packages/<name>/CLAUDE.md.

Installing from PyPI

Install the whole family with uv:

uv add oaknut

Or install individual packages as needed:

uv add oaknut-dfs        # DFS floppy images only
uv add oaknut-adfs       # ADFS floppy and hard disc images
uv add oaknut-disc       # the disc CLI tool

With pip:

pip install oaknut        # everything
pip install oaknut-disc   # just the CLI

Documentation

Licence

MIT. See each package's LICENSE file.

Project details


Download files

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

Source Distribution

oaknut-10.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

oaknut-10.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file oaknut-10.1.0.tar.gz.

File metadata

  • Download URL: oaknut-10.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for oaknut-10.1.0.tar.gz
Algorithm Hash digest
SHA256 bbb54e33ad70d98a9f42d3fa7b8fe0ce0e54b35db420da2a67ed0107bf5fa651
MD5 aeb05bb64bdbddaa910360db6e896cbf
BLAKE2b-256 9067a9bb71ff8fc98dbe2bdd84188179758a39692a47b1c2e6b889c05990b8e0

See more details on using hashes here.

File details

Details for the file oaknut-10.1.0-py3-none-any.whl.

File metadata

  • Download URL: oaknut-10.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for oaknut-10.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5be69450ac8e18025f4990abcb413fe8a6a9397929710eed3df958fefee0d8f2
MD5 67aeba21f6962fa398099a23cb6bddee
BLAKE2b-256 0a10b48802dea55c92e08bb0b52abebb4885df5631668d64df17897b6e765e97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page