Skip to main content

oaknut-afs

PyPI version CI Python versions License: MIT

A Python library for reading, writing, and creating Acorn Level 3 File Server (AFS) disc partitions — the private on-disc filesystem the Level 3 File Server served to BBC Micro, Master, and Archimedes clients over Econet.

AFS is a hierarchical, multi-user filesystem: it has real directories, a per-file owner and public access model, and a $.Passwords file of user accounts. It is identified by the AFS0 magic in its info sectors.

Part of a dual-partition disc. An AFS filesystem does not occupy a disc alone — it lives in the tail cylinders of an old-map ADFS disc. The real WFSINIT utility (and oaknut's initialise()) shrinks the ADFS partition and carves the AFS region out of the space freed. oaknut-afs reads and writes that region; oaknut-adfs handles the host.

Part of the oaknut monorepo.

What it does

  • Read and write an AFS partition: browse the directory tree, read and write files, create and remove directories, and edit metadata (owner and public access, the native two-byte datestamp).
  • Partition and initialise (initialise()): the WFSINIT analogue — repartition an old-map ADFS disc and lay down an empty AFS filesystem in the tail, with its map, root, and $.Passwords file.
  • Manage users (UserSpec, PasswordsFile): create accounts with passwords and disc-space allocations; the built-in Syst, Boot, and Welcome accounts are handled.
  • Import a host tree (import_host_tree()): populate a new filesystem from a directory of files with .inf sidecars.
  • Merge (merge()) two AFS partitions, and emplace shipped libraries (SHIPPED_LIBRARIES) such as the standard Library.

Passwords are stored as the file server stored them: up to six cleartext ASCII bytes in $.Passwords, with no encryption — oaknut reproduces the format faithfully rather than obscuring it.

Installation

uv add oaknut-afs         # or: pip install oaknut-afs

oaknut-afs works with any PEP 517 build front-end and package manager; the examples use uv.

Usage

Creating and populating a filesystem

from oaknut.afs import AFS, UserSpec

with AFS.create_file(
    "server.dat",
    capacity="10MB",
    disc_name="Server",
    users=[UserSpec(name="RJS", quota="2MB")],
) as afs:
    # Creating the RJS account also creates its home directory, $.RJS.
    (afs.root / "RJS" / "ReadMe").write_text("Welcome to the file server.\n")

Reading

from oaknut.afs import AFS

with AFS.from_file("server.dat") as afs:
    for entry in afs.root.iterdir():
        print(entry.name)
    text = (afs.root / "RJS" / "ReadMe").read_text()

For dual ADFS + AFS discs, the disc CLI reaches the AFS partition through the ADFS host with an afs: prefix (disc ls 'server.dat:afs:$'), routed by content identification.

Development

The package is developed in the oaknut workspace. From the repository root:

uv sync                                  # install all workspace members editable
uv run pytest packages/oaknut-afs/tests  # this package's tests
uv run ruff check                        # lint

Architecture

oaknut-afs depends on oaknut-adfs (to place and read the partition within its ADFS host), oaknut-discimage, and oaknut-file, and contributes AFS to the oaknut.filesystem extension axis so that AFS partitions are identified, listed, and read through the disc CLI alongside the disc-based filing systems. Sector-level access comes from oaknut-discimage; metadata and the acorn codec from oaknut-file.

Further reading

License

MIT — see LICENSE.

Download files

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

Source Distribution

oaknut_afs-12.15.1.tar.gz (207.5 kB view details)

Uploaded Source

Built Distribution

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

oaknut_afs-12.15.1-py3-none-any.whl (159.0 kB view details)

Uploaded Python 3

File details

Details for the file oaknut_afs-12.15.1.tar.gz.

File metadata

  • Download URL: oaknut_afs-12.15.1.tar.gz
  • Upload date:
  • Size: 207.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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_afs-12.15.1.tar.gz
Algorithm Hash digest
SHA256 9bad545134f06b64e13ff20dc59fd36e11addc6cca98cffc9770e476a105864e
MD5 d378dbd39163a6e105d7899d6f00148f
BLAKE2b-256 486c5322283bbf9e48ff2359b5b8f17245042eb09941fbd5d93a448c121bd2d0

See more details on using hashes here.

File details

Details for the file oaknut_afs-12.15.1-py3-none-any.whl.

File metadata

  • Download URL: oaknut_afs-12.15.1-py3-none-any.whl
  • Upload date:
  • Size: 159.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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_afs-12.15.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5b62f887a29ef91811dbc7c940f2bf2e1f9a1cce03d346d09813dc65a7f0b1c
MD5 1295bb8f14f06a9f265ebbc5579788e0
BLAKE2b-256 5acdb44a75d9bd68deea7d2ac7f1dcccdd6ea13402a735a6740a103439bf2185

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

12.15.1 This release

2 files

12.15.0

2 files

12.14.1

2 files

12.14.0

2 files

12.13.1

2 files

12.12.0

2 files

12.11.0

2 files

12.10.1

2 files

12.10.0

2 files

12.9.0

2 files

12.8.2

2 files

12.8.1

2 files

12.8.0

2 files

12.7.2

2 files

12.7.1

2 files

12.7.0

2 files

12.6.2

2 files

12.6.1

2 files

12.6.0

2 files

12.5.3

2 files

12.5.2

2 files

12.5.1

2 files

12.5.0

2 files

12.4.1

2 files

12.4.0

2 files

12.3.0

2 files

12.2.0

2 files

12.1.0

2 files

12.0.1

2 files

12.0.0

2 files

11.2.0

2 files

11.1.0

2 files

11.0.2

2 files

11.0.1

2 files

11.0.0

2 files

10.7.0

2 files

10.6.0

2 files

10.5.0

2 files

10.4.0

2 files

10.3.0

2 files

10.2.0

2 files

10.1.0

2 files

10.0.5

2 files

10.0.4

2 files

10.0.3

2 files

10.0.2

2 files

10.0.1

2 files

Supported by

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