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
5 changes: 1 addition & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
enable-cache: true

- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Run linter
run: uv run ruff check
run: uvx nox -s lint
actionlint:
name: actionlint
runs-on: ubuntu-latest
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
enable-cache: true

- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Run type checker
run: uv run mypy leanframe tests
run: uvx nox -s mypy
11 changes: 7 additions & 4 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ jobs:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
ibis-version:
- "11"
- "12"

steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
Expand All @@ -27,9 +31,8 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
enable-cache: true

- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Run tests
run: uv run pytest tests/unit
env:
NOX_SESSION: "unit-${{ matrix.python-version }}(ibis='${{ matrix.ibis-version }}')"
run: uvx nox -s "$NOX_SESSION"
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,14 @@ scratch/
vault/
.python-version
*scratch*

# Devenv
.devenv*
devenv.local.nix
devenv.local.yaml

# direnv
.direnv

# pre-commit
.pre-commit-config.yaml
117 changes: 117 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1792414651,
"narHash": "sha256-2KKD5s7ZHwhFToFLAxRtezSIYevuo8Tpvl41E7LgfPU=",
"owner": "cachix",
"repo": "devenv",
"rev": "ff0d7e76dc83bef8eb4f83f7985ff2d792234440",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"nixpkgs": {
"inputs": {
"nixpkgs-src": "nixpkgs-src"
},
"locked": {
"lastModified": 1791812882,
"narHash": "sha256-4AdYH2HoD21mys5lk9NoDcM2Z7iPeEUjxJeGE3Pw278=",
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "760b85220489f69855e6df78a6d1dad5873f8bf6",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs-python": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1792505437,
"narHash": "sha256-e/5WngU/ROQs3GlAl0KgvuXRcNmnvkuWM6cM8lTFt1s=",
"owner": "cachix",
"repo": "nixpkgs-python",
"rev": "bea6c222d16b6b8b8d0f658b69e447266acd5461",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "nixpkgs-python",
"type": "github"
}
},
"nixpkgs-src": {
"flake": false,
"locked": {
"lastModified": 1791487292,
"narHash": "sha256-tqM7xDEsaeK1p6VvRygeZ9LkQRpUUkbRT02BHv6hnTM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8edc0c72e3a38faf5434e40d1f19431125fe4b30",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1782847189,
"narHash": "sha256-twXPFqFsrrY5r28Zh7Homgcp2gUMBgQ6WDS98Q/3xFI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b6018f87da91d19d0ab4cf979885689b469cdd41",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"nixpkgs-python": "nixpkgs-python"
}
}
},
"root": "root",
"version": 7
}
51 changes: 51 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
pkgs,
lib,
config,
inputs,
...
}:

let
nixLibraryPath = lib.makeLibraryPath [
pkgs.stdenv.cc.cc.lib
pkgs.zlib
];
pythonEnvClean = ''
export LD_LIBRARY_PATH="${nixLibraryPath}"
unset PYTHONPATH _PYTHON_HOST_PLATFORM _PYTHON_SYSCONFIGDATA_NAME
'';
in
{
# https://devenv.sh/basics/
env = {
GREET = "devenv";
UV_PYTHON_PREFERENCE = "only-system";
UV_PYTHON_DOWNLOADS = "never";
};

# https://devenv.sh/packages/
packages = [
pkgs.git
inputs.nixpkgs-python.packages.${pkgs.stdenv.system}."3.11"
inputs.nixpkgs-python.packages.${pkgs.stdenv.system}."3.12"
inputs.nixpkgs-python.packages.${pkgs.stdenv.system}."3.13"
inputs.nixpkgs-python.packages.${pkgs.stdenv.system}."3.14"

pkgs.nox
pkgs.uv
];

# https://devenv.sh/basics/
enterShell = ''
${pythonEnvClean}
'';

# https://devenv.sh/tests/
enterTest = ''
${pythonEnvClean}
nox
'';

# See full reference at https://devenv.sh/reference/options/
}
20 changes: 20 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
nixpkgs-python:
url: github:cachix/nixpkgs-python

# If you're using non-OSS software, you can set allow_unfree to true.
# allow_unfree: true

# If you're not willing to allow unsupported packages:
# allow_unsupported_system: false

# If you're willing to use a package that's vulnerable
# permitted_insecure_packages:
# - "openssl-1.1.1w"

# If you have more than one devenv you can merge them
#imports:
# - ./backend
82 changes: 82 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Copyright 2026 LeanFrame Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import annotations

import os

import nox

DEFAULT_PYTHON_VERSION = "3.13"
UNIT_TEST_PYTHON_VERSIONS = ["3.11", "3.12", "3.13", "3.14"]
IBIS_VERSIONS = ["11", "12"]

nox.options.default_venv_backend = "uv"
nox.options.sessions = ["lint", "mypy", "unit"]

# Ensure host pyenv shared libraries or Nix Python hook variables do not
# interfere with the Nix-provided Python interpreters used by uv and nox.
for _var in ("PYTHONPATH", "_PYTHON_HOST_PLATFORM", "_PYTHON_SYSCONFIGDATA_NAME"):
os.environ.pop(_var, None)
if "LD_LIBRARY_PATH" in os.environ:
os.environ["LD_LIBRARY_PATH"] = os.pathsep.join(
p
for p in os.environ["LD_LIBRARY_PATH"].split(os.pathsep)
if p and ".pyenv" not in p
)


def _sync_env(session: nox.Session) -> None:
"""Sync locked dependencies into the session's virtual environment."""
python_arg = (
f"--python={session.python}"
if isinstance(session.python, str)
else f"--python={session.virtualenv.location}"
)
session.run_install(
"uv",
"sync",
"--locked",
"--all-extras",
"--dev",
python_arg,
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint(session: nox.Session) -> None:
"""Run ruff linter."""
_sync_env(session)
session.run("ruff", "check", *session.posargs)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def mypy(session: nox.Session) -> None:
"""Run mypy static type checker."""
_sync_env(session)
target_paths = session.posargs if session.posargs else ["leanframe", "tests"]
session.run("mypy", *target_paths)


@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
@nox.parametrize("ibis", IBIS_VERSIONS)
def unit(session: nox.Session, ibis: str) -> None:
"""Run unit tests against multiple Python and Ibis versions."""
_sync_env(session)
session.install(f"ibis-framework[bigquery,duckdb]=={ibis}.*")
test_paths = (
session.posargs if session.posargs else [os.path.join("tests", "unit")]
)
session.run("pytest", *test_paths)
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ requires-python = ">=3.11"
dependencies = [
"pandas >=2.2.0",
"pyarrow >=15.0.2",
"ibis-framework>=11.0.0,<12.0.0",
"ibis-framework>=11.0.0,<13.0.0",
"pyopenssl>=26.1.0",
]

Expand All @@ -16,14 +16,15 @@ dev = [
"ibis-framework[bigquery,duckdb]>=10.6.0",
"ipython>=8.37.0",
"mypy>=1.17.1",
"nox>=2025.2.9",
"pandas-stubs>=2.3.0.250703",
"pytest>=8.4.1",
"ruff>=0.12.4",
"ruff>=0.12.4,<1.0.0",
"twine>=6.2.0",
]

[build-system]
requires = ["uv_build>=0.11.2,<0.12.0"]
requires = ["uv_build>=0.11.2,<0.13.0"]
build-backend = "uv_build"

[tool.uv.build-backend]
Expand Down
Loading
Loading