Python API
FOSU is in active development; its API may change without compatibility shims.
Parsing returns eager objects and lists, detached from native memory. All records
are read-only native objects with eager Python fields, declared and typed in
_model.py. Attribute reads do not allocate numeric values. Lists remain ordinary
mutable Python lists.
Install and use
Requires CPython 3.10+. Stable-ABI wheels target glibc and musl Linux on x86-64 and AArch64, plus macOS 11+ on Intel and Apple Silicon. One wheel per platform supports every compatible CPython version. Windows x86-64 is supported both natively and through the Linux x86-64 wheel under WSL.
python -m pip install fosu
Installing from a source checkout requires a C++20 compiler. An ordinary
isolated pip install . provisions CMake and Ninja when needed; Unix Makefiles
are also supported when Ninja is unavailable. --no-build-isolation makes the
caller responsible for all build tools.
import fosu
beatmap = fosu.parse_file("map.osu")
for note in beatmap.hit_objects:
if isinstance(note, fosu.Slider):
print(note.time, note.length, note.control_points)
parse_file(path) accepts strings, bytes, and os.PathLike.
parse(data) accepts buffer-protocol objects, including bytes, bytearray,
memoryview, and arrays. Non-bytes buffers are copied to an immutable snapshot;
encode text explicitly.
Inputs are bounded by available address space. Allocation failures raise
MemoryError, and file failures raise OSError. Native parsing
releases the GIL; Python value construction holds it. Concurrent calls return
independent results. Malformed records are skipped and counted in
beatmap.stats.malformed_lines; success does not certify playability.
Section selection
listing = fosu.parse_file(
"map.osu",
sections=fosu.Sections.METADATA | fosu.Sections.DIFFICULTY,
)
Both entry points accept keyword-only sections, defaulting to Sections.ALL.
Members are GENERAL, EDITOR, METADATA, DIFFICULTY, EVENTS,
TIMING_POINTS, COLOURS, and HIT_OBJECTS. Combine them with |.
Skipped sections retain defaults and empty lists; Sections(0) selects none.
Unsupported mask bits are rejected.
Include GENERAL for mode-dependent difficulty rules (such as mania CircleSize)
and EVENTS for break-dependent combo rules. Only selected sections contribute
malformed-line counts.
Results and important distinctions
The model classes in _model.py define the fields and convenience methods. Shared fields use C++ names. Important Python-specific behavior:
hit_objectscontainsCircle,Slider,Spinner, orHoldNote, in stable timestamp order. Narrow the union withisinstance.- Times are milliseconds. Slider endpoints are
0by default. Passcalculate_slider_end_times=Truetoparseorparse_fileto calculate them using curve distance, timing and repeats. Do not use slider endpoints unless calculation was requested. Accessing the field never computes or caches anything. Other object types still have numeric endpoints. Omitted sections use their default settings. Hit samples and slider edge fields remain text. - Slider
control_pointsincludes the head position, unlike the native point range.curve_segmentspreserves modern segment boundaries and explicit B-spline degrees.slides=2means forward and back. tag_listandbookmark_listare parsed conveniences alongside thetagsandbookmarkstext fields.- IDs and preview time map the
-1sentinel toNone. - Strings decode with UTF-8
surrogateescape, preserving undecodable bytes. - Inherited timing-point NaN beat lengths are preserved; consumers must not treat them as ordinary slider velocities.
Records support equality, repr, deepcopy, and pickle. They are not dataclasses:
dataclasses.asdict and dataclasses.replace do not apply. Public record classes
cannot be subclassed, and attributes cannot be assigned or deleted. Constructors
accept positional or keyword arguments and retain the supplied values without
runtime type validation. Parsed numeric fields are always eagerly converted to
their documented Python types.
List contents can be changed without affecting the input or another parse result. Such changes do not recompute derived data. All records participate in cyclic garbage collection, including cycles consumers create through lists or values passed to constructors.
Pass calculate_slider_paths=True to retain each slider's path (otherwise
None). fosu.slider_position_at(slider.path, progress) is a pure query over
that polyline, with progress clamped to [0, 1]. Returned PathPoint coordinates
are relative to the head; add the slider's x/y for playfield coordinates.
Paths alone do not calculate end times. Requesting both reuses their distance.
Native code exposes the same query and Beatmap.slider_paths, indexed by slider.
calculate_slider_events=True additionally populates slider.events with
HEAD, TICK, REPEAT, LEGACY_LAST_TICK, and TAIL records in official
generator order, grouped by slider-span traversal. This is not necessarily
timestamp order: a legacy last tick may be timed before a late tick or the
repeat beginning its final span. The legacy event is the effective historical
tail judgement, not an additional score or combo event; the real TAIL and
slider end_time remain unchanged. This option includes path and end-time
calculation. Each record has time, span index/start time, path progress, and a
position relative to the head. Native code exposes Beatmap.slider_events,
indexed by slider. Without the option, events are empty. These are path events
using the decoded slider's timing, not a converted ruleset's nested hitobjects:
no samples or catch conversion.
Expansion beyond 1,048,576 events per map raises MemoryError rather than
silently dropping events.
apply_stacking=True applies unmodded osu!standard stacking after parsing,
including the pre-v6 algorithm. Hit-object x/y and absolute slider control points
are adjusted before returning. obj.raw_position() subtracts the stacking offset
from the current x/y, or returns x/y when stacking is absent. It can have small
floating-point rounding differences. Coordinates are floats in both interfaces,
including when stacking is disabled. Each object also retains stack_height and stack_offset
in its Stacking value for inspection; do not add the offset again.
Relative path/event positions remain unchanged: add them to the adjusted head.
It includes path and end-time calculation, but not events. Native results use
Beatmap.stacking, indexed by hit object. Other modes are unchanged; Python
stacking is None when not calculated. Include GENERAL, DIFFICULTY,
TIMING_POINTS and HIT_OBJECTS when selecting sections for meaningful results.
mods= accepts combined Mods values. EZ and HR adjust difficulty settings for
osu!standard and osu!taiko; HR also reflects standard hit objects and slider
control points vertically. EZ/HR require GENERAL and DIFFICULTY in sections.
They are not yet supported for osu!catch or osu!mania because those modes require
converted fruit offsets or resolved hit windows; support is planned. DT,
NIGHTCORE, and HT support every mode and divide gameplay timeline values by
1.5, 1.5, and 0.75 respectively. This includes hit objects, calculated slider
events, timing-point offsets and uninherited beat lengths, and breaks. General
and Editor timestamp metadata remains in source-map time.
See compatibility for supported behavior and limitations; there is no ruleset conversion.
CPU selection
fosu.backend reports "avx2", "neon", or "scalar".
Set FOSU_BACKEND=auto|scalar|avx2|neon before importing to select an engine.
Unsupported explicit requests raise ImportError; selection stays fixed for
the loaded extension. See
development checks.
Release files for fosu 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fosu-0.5.0.tar.gz | 249.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| fosu-0.5.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| fosu-0.5.0-cp310-abi3-musllinux_1_2_x86_64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ x86-64 | Details |
| fosu-0.5.0-cp310-abi3-musllinux_1_2_aarch64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ ARM64 | Details |
| fosu-0.5.0-cp310-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.26+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| fosu-0.5.0-cp310-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64, Linux glibc 2.26+ ARM64 | Details |
| fosu-0.5.0-cp310-abi3-macosx_11_0_x86_64.whl | CPython 3.10 | abi3 | macOS 11.0+ x86-64 | Details |
| fosu-0.5.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 2.2 MB
Release files / fosu-0.5.0.tar.gz
| Download URL | fosu-0.5.0.tar.gz |
|---|---|
| Size | 249.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60ba3a2d4b7365321b8c919769f43a92e8b0fb29ffb2af52a48ce2442a890147
|
|
BLAKE2b-256 checksum How to use checksums |
6f213d4b4989a7b53f2735f6fdf064bc27058c91e0e7717820c926a661db38ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency logRelease files / fosu-0.5.0-cp310-abi3-win_amd64.whl
| Download URL | fosu-0.5.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 333.0 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b4e7cc558313745729e295b09857200eb1390318da51bc6d94db7f5aa14716d4
|
|
BLAKE2b-256 checksum How to use checksums |
c727b2b36ac1207e9d91cd421f9a3b9e833a4d880bb1fa60eca2c6d65c0fb838
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency logRelease files / fosu-0.5.0-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | fosu-0.5.0-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 326.1 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
6320c6489d5436199f72ef25aa780a1093ada90568569b5ea0e55ffd9c382348
|
|
BLAKE2b-256 checksum How to use checksums |
2a62c36156e0c21ece07004da774a341d912ea41ab59175fc9047c7684d08291
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency logRelease files / fosu-0.5.0-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | fosu-0.5.0-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 352.2 kB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
7e731248e36650004eeaa9e1b6a0d10379b15ddc11f90e4a479aa9ad7ef56105
|
|
BLAKE2b-256 checksum How to use checksums |
1bb864184411d0358d9c20978149c6f30bb772fe1a8088bbf3ae69ffefdc807b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency logRelease files / fosu-0.5.0-cp310-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
| Download URL | fosu-0.5.0-cp310-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 326.7 kB |
| Tags | CPython 3.10 Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
366ea9b790207e79f4ea277bcb644a653d9983cb9a302b6684c1e4b786191c07
|
|
BLAKE2b-256 checksum How to use checksums |
4ba31259c1e97b56f861cd42046cc4979ea6fd778dbe73b013600c22a1a8846c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency logRelease files / fosu-0.5.0-cp310-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | fosu-0.5.0-cp310-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 353.3 kB |
| Tags | CPython 3.10 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8d9d4aa220d195012dd7333a17f1ed8065bcee7a4bee2433b35cfaa35deafb84
|
|
BLAKE2b-256 checksum How to use checksums |
a37182ba11d3aa36284d36218e762b873e954576c12e50ab6a09ccb0d6e9e48b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency logRelease files / fosu-0.5.0-cp310-abi3-macosx_11_0_x86_64.whl
| Download URL | fosu-0.5.0-cp310-abi3-macosx_11_0_x86_64.whl |
|---|---|
| Size | 141.0 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
37040df7481678f4181b3e5a87c236a1eb1258019dc35cc37f23e3ae320aca17
|
|
BLAKE2b-256 checksum How to use checksums |
57f169a27d169f38f81c44308ed9a88a82a89a5a606fa69a3dd9f6b8fefa6369
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency logRelease files / fosu-0.5.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | fosu-0.5.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 134.6 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8b1ae31008ba02af281bb87abb6437f94a990b96da40e9669cfd0317871055ca
|
|
BLAKE2b-256 checksum How to use checksums |
833d6a726b8197f1b350330eff5f7abcf600e327e9c7ce73a4aff00878a8c355
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.
Transparency log