Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: publish to PyPI

on:
release:
types: [published]

jobs:
test:
uses: ./.github/workflows/test.yml

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Check version matches the release tag
run: |
PKG_VERSION=$(grep -oP '__version__ = "\K[^"]+' nt2/__init__.py)
TAG="${{ github.event.release.tag_name }}"
TAG="${TAG#v}" # allow tags like v0.1.0
if [ "$PKG_VERSION" != "$TAG" ]; then
echo "::error::package version ($PKG_VERSION) != release tag ($TAG)"
exit 1
fi

- name: Build sdist and wheel
run: uv build

- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

publish:
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/nt2py
permissions:
id-token: write # required for PyPI Trusted Publishing (OIDC)
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
16 changes: 6 additions & 10 deletions .github/workflows/unittests.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: Unit tests

on: [push]
on:
push:
workflow_call:

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
lfs: true

Expand All @@ -28,9 +30,3 @@ jobs:
- name: Test with `pytest`
run: |
pytest

- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.python-version == '3.14'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
.*cache/
cover/

# Translations
Expand Down Expand Up @@ -155,3 +155,15 @@ nt2/tests/testdata
test/
temp/
*.bak
.*venv

# LLM
.codex
.agents
.claude

# devenv
.devenv*
devenv.local.nix
devenv.local.yaml
.direnv
4 changes: 3 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"recommendations": [
"ms-python.python",
"ms-python.black-formatter"
"meta.pyrefly",
"charliermarsh.ruff",
"github.vscode-github-actions"
]
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2025, Entity development team
Copyright (c) 2026, Entity development team

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
65 changes: 65 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1789480904,
"narHash": "sha256-anHWHTkxI7423/eUroN9Rc4+H8VIGyIUWq/hV1egBDQ=",
"owner": "cachix",
"repo": "devenv",
"rev": "0fd5e6d3a9b2ae6f10205a3e95e0ca58d526c5a6",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"nixpkgs": {
"inputs": {
"nixpkgs-src": "nixpkgs-src"
},
"locked": {
"lastModified": 1787753358,
"narHash": "sha256-Tl77VbWyAKrOfRNQhL6JbQtb/MLzbYa/1RG1gWWfICk=",
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "256551e45f6303e142ab4a98be1bf243feb77dc0",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs-src": {
"flake": false,
"locked": {
"lastModified": 1787394516,
"narHash": "sha256-pRGOQSClnXNI2iLUG6DYpsGvYcuw0drOutVZFTJNw90=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c8f90650c15282fa8656a041bfbbd2403997a9a7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
43 changes: 43 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{ pkgs, lib, ... }:

let
# override with
# devenv shell -O languages.python.package:pkg python312
py = "313";
in
{
name = "nt2dev";

languages.python = {
enable = true;
package = pkgs."python${py}";

venv = {
enable = true;
requirements = ''
ipykernel
jupyterlab
pytest
-e .
'';
};
};

# https://devenv.sh/packages/
packages = with pkgs; [
black
pyright
taplo
vscode-langservers-extracted
zlib
];

env.LD_LIBRARY_PATH = lib.makeLibraryPath [
pkgs.stdenv.cc.cc
pkgs.zlib
];

enterShell = ''
echo "nt2dev devenv activated: $DEVENV_STATE/venv/bin/python"
'';
}
4 changes: 4 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
Binary file removed dist/nt2py-0.2.1.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-0.2.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-0.3.0.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-0.3.1.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-0.4.0.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-0.4.1.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-0.5.0-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-0.5.0.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-0.5.1-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-0.5.1.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-0.5.2-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-0.5.2.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-0.5.3-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-0.5.3.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-0.6.0-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-0.6.0.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-1.0.1-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-1.0.1.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-1.1.0-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-1.1.0.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-1.2.0-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-1.2.0.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-1.2.1-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-1.2.1.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-1.3.0-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-1.3.0.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-1.4.0-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-1.4.0.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-1.5.0-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-1.5.0.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-1.5.1-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-1.5.1.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-1.5.2-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-1.5.2.tar.gz
Binary file not shown.
Binary file removed dist/nt2py-1.5.3-py3-none-any.whl
Binary file not shown.
Binary file removed dist/nt2py-1.5.3.tar.gz
Binary file not shown.
Empty file added legacy/containers/__init__.py
Empty file.
39 changes: 38 additions & 1 deletion nt2/containers/container.py → legacy/containers/container.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Callable, Optional, Dict, Tuple
from typing import Callable, Optional, Dict, Tuple, List

from nt2.readers.base import BaseReader

Expand All @@ -10,6 +10,9 @@ class BaseContainer:
__reader: BaseReader
__remap: Optional[Dict[str, Callable[[str], str]]]

__valid_steps: Dict[str, List[int]]
__valid_files: Dict[str, List[str]]

def __init__(
self,
path: str,
Expand Down Expand Up @@ -48,6 +51,40 @@ def remap(self) -> Optional[Dict[str, Callable[[str], str]]]:
"""{ str: (str) -> str } : The coordinate/field remap dictionary."""
return self.__remap

@property
def valid_steps(self) -> Dict[str, List[int]]:
"""dict[str, list[int]]: The valid steps for each category."""
return self.__valid_steps

@property
def valid_files(self) -> Dict[str, List[str]]:
"""dict[str, list[str]]: The valid files for each category."""
return self.__valid_files

@valid_steps.setter
def valid_steps(self, value: Dict[str, List[int]]) -> None:
"""Set the valid steps for each category.

Parameters
----------
value : dict[str, list[int]]
The valid steps for each category.

"""
self.__valid_steps = value

@valid_files.setter
def valid_files(self, value: Dict[str, List[str]]) -> None:
"""Set the valid files for each category.

Parameters
----------
value : dict[str, list[str]]
The valid files for each category.

"""
self.__valid_files = value

def __dask_tokenize__(self) -> Tuple[str, str, str]:
"""Provide a deterministic Dask token for container instances."""
return (
Expand Down
Loading
Loading