Skip to content

v1.2.0

Choose a tag to compare

@github-actions github-actions released this 03 Oct 09:46
· 124 commits to main since this release
9f6e702

Added

  • Frame derived accessors: frame.positions, frame.numbers,
    frame.symbols, frame.cell, and frame.pbc resolve the well-known fields
    from the untouched columns/metadata dicts on each access — cell is the
    3x3 ASE-convention cell from the flat Fortran-order Lattice, pbc defaults
    to Lattice presence. Nothing is cached and nothing stored is rewritten.
  • Lookup by name across columns and metadata: frame["pos"] and
    frame["energy"] both work, as do name in frame, frame.get(name, default), frame.keys(), and so dict(frame). The value returned is the
    stored one, not a copy. Batch, Schema (returning the ColumnSchema or
    MetadataSchema) and SchemaSpec (returning the rule declared under that
    exact name) behave the same. A name that is both a column and a metadata key
    raises the new oxyz.AmbiguousNameError (an OxyzError, deliberately not a
    KeyError) rather than picking one. None of these is a Mapping: Frame,
    Schema and SchemaSpec have no len() and cannot be iterated (a Batch
    iterates its frames, below), so numpy keeps a list of frames as frames —
    rng.choice(frames, k) and np.array(frames, dtype=object) still work.
  • Batch is a sequence of its frames. len(batch) is n_frames and
    iterating yields each Frame. Indexing follows numpy: batch[i] is a
    Frame whose numeric arrays are views onto the batch, batch[a:b] is a
    Batch of views with offsets rebased, and a step slice, a list or array
    of positions, or a boolean mask over frames (batch[batch["energy"] < 0])
    gathers a new Batch, a copy, keeping frame_indices as file provenance.
    String columns are lists and so are copied; scalar metadata comes out as the
    Python value oxyz.read gives, so batch[i] equals the frame read from the
    file, dtype for dtype. Being iterable, a batch can be passed straight to
    oxyz.write and Writer.write.
  • Notebook rendering: Frame, Batch, Schema, SchemaSpec and FrameIndex
    have a _repr_html_, so Jupyter shows them as tables — one row per column
    or metadata key with its dtype, shape and a preview of values; the schema
    report, a spec's rules, and a scan's atom-count and volume statistics as
    tables of their own. Previews are bounded: the first 3 rows of an array,
    arrays in full up to 12 elements, every cell cut at 80 characters, floats to
    4 decimal places formatted independently of numpy's global print options.
    The markup carries no styles or scripts, so the notebook's theme applies, and
    every name and value is escaped.
  • SchemaSpec.rule_for(name, axis=None): the rule validation would apply to a
    field of that name — its literal rule, else the first matching glob or regex
    in declaration order — or None.
  • oxyz.FieldError (an OxyzError, so still a ValueError): a well-known
    field is absent, or present in a shape or type it cannot hold. Raised by the
    new accessors — including when the field is present but will not coerce, so
    a Z:S:1 string column reports a FieldError rather than numpy's invalid literal for int() — and by oxyz.write (see Fixed).

Fixed

  • oxyz.write and Writer.write check every column's row count against the
    frame's n_atoms, raising oxyz.FieldError on a mismatch. A hand-built
    short column used to panic inside the Rust encoder, and a long one silently
    dropped atoms. A 0-D column counts as the one row the encoder writes from it,
    so the scalar-width-1 form stays legal for a single-atom frame.

Changed

  • Every public object has a one-line repr that prints no data, so its length
    depends on how many names an object carries rather than how many atoms or
    frames. Objects that hold data — Frame, Batch, SimStateSource,
    SystemSource — describe values by numpy dtype and shape
    ('pos': float64[96, 3]); Schema and SchemaSpec describe a file in the
    extxyz letters of Properties= ('pos': R:3, 'stress': R[3, 3]), joining
    drifting variants with | and marking an entry some frames lack, or an
    optional rule, with ?. Multi-frame objects show their atom-count range,
    n_atoms=lo..hi. FrameIndex no longer prints its offset arrays; Writer
    shows its path, non-default options, frames_written, and whether it is
    closed; the schema rules and Violation omit fields left at their defaults;
    Kind is Kind.REAL. str(schema) is still the multi-line report.
  • A schema violation on a 2-D metadata rule now states the expected shape in
    full (R[3, 3], formerly R[3]).

Internal

  • The well-known-field resolution the converters each carried is now one layer:
    oxyz._convert owns positions/numbers/symbols/cell/pbc over the
    plain dicts, and oxyz.metatomic consumes it instead of its own
    _cell_and_pbc body. numbers and MissingSpeciesError move out of
    oxyz._torch, which imports torch eagerly and so could not back
    Frame.numbers. oxyz.ase keeps its own routing loop (ASE-table parity),
    and oxyz.torch_sim keeps its batched, column-vector cell.
  • New oxyz._summary: the shape-only repr and the NaN-equal, order-insensitive
    value comparison Frame and Batch share.
  • pytest/pytest-cov and boto3/moto move out of the dev group into new
    test and s3-test groups, which dev includes. A plain uv sync resolves
    to exactly what it did before; the split exists so CI can build a partial
    environment. The optional dependencies themselves need no group — the tiers
    install the published ase/s3 extras, the way a user would.
  • The tier jobs install a single wheel built once by a new build-wheel job
    rather than building their own, so they need no Rust toolchain and exercise the
    same abi3 artifact a user installs.
  • A test-gate fan-in job, mirroring wheels-gate, is now the one status check
    the branch ruleset needs from this workflow. With matrix contexts named
    directly, every reshape had to be mirrored by hand in the ruleset — and got it
    wrong in both directions, stranding required checks that would never report
    again and adding new ones unprotected.
  • Coverage is unchanged and still measured only on the full dependency set; the
    tiers never pass --cov, since a partial run is not a coverage figure.
  • uv pinned to 0.12.17, in pyproject.toml and every setup-uv step. The
    lockfile is unchanged under it.
  • Every workflow action re-pinned to its latest release, rust-toolchain to the
    current tip of stable, and zizmor to 1.30.1. The two download-artifact
    pins, which had drifted to different majors, now agree.
  • Three skip guards did not guard. tests/test_errors.py tested
    find_spec("metatomic.torch"), which imports the parent package and so raises
    ModuleNotFoundError when metatomic is absent instead of returning None —
    aborting collection of the module rather than skipping one test.
    tests/test_compressed.py used importorskip("oxyz.ase"), which stopped
    skipping when pytest 9.1 narrowed the default exc_type to
    ModuleNotFoundError: oxyz.ase imports fine and raises a plain
    ImportError carrying its install hint, so pytest now propagates it as a
    failure. Both are within the project's declared pytest>=9.0.3 range. The ty
    canary asserted ty was on PATH rather than skipping without it. None of
    these were visible in CI, because every job installed every dependency.
  • Tests for the optional targets' import guards: that a missing dependency
    raises ImportError naming both the module and the extra to install, and
    chains the original cause. The imports are blocked in-process, so these run —
    and are measured by coverage — whether or not the optional dependency is
    installed, and the guard branches are no longer dead lines in the report.
  • CI runs the test suite on deliberately incomplete dependency
    environments
    : base (no optional dependencies), ase, and s3, pinned to
    3.12, the abi3 floor, plus base on the newest supported interpreter as a
    forward-compatibility check on the single cp312-abi3 wheel. A tier canary
    keyed on OXYZ_TEST_TIER asserts the environment is the one CI declared, so a
    tier that installs too much, or a guard that skips for the wrong reason, fails
    instead of passing over nothing. The python and coverage jobs declare
    full and are asserted the same way.