Skip to content

Commit

Permalink
feat: updated deps and switched from poetry to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
clementpoiret committed Oct 29, 2024
1 parent dfa2df6 commit 6c8be01
Show file tree
Hide file tree
Showing 12 changed files with 1,196 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_url "https://raw.githubusercontent.com/cachix/devenv/82c0147677e510b247d8b9165c54f73d32dfd899/direnvrc" "sha256-7u4iDd1nZpxL4tCzmPG0dQgC5V+/44Ba+tHkPob1v2k="

use devenv
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,12 @@ poetry.lock
# Ignore all local history of files
.history
.ionide
# Devenv
.devenv*
devenv.local.nix

# direnv
.direnv

# pre-commit
.pre-commit-config.yaml
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[email protected]
2 changes: 0 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ It requires the following packages:

- ANTs (Can be a system installation or anaconda installation),
- ANTsPyX,
- importlib_resources,
- Pandas,
- Rich.


Expand Down
116 changes: 116 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1730028891,
"owner": "cachix",
"repo": "devenv",
"rev": "a337f8862efa9bde348c48a48b5b943f710604dd",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1729980323,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "86e78d3d2084ff87688da662cf78c2af085d8e73",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1729973466,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "cd3e8833d70618c4eea8df06f95b364b016d4950",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1729104314,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
}
},
"root": "root",
"version": 7
}
22 changes: 22 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ pkgs, lib, config, inputs, ... }:
let
buildInputs = with pkgs; [
pythonManylinuxPackages.manylinux2014Package
stdenv.cc.cc
libuv
zlib
];
in {
# https://devenv.sh/packages/
#packages = [ pkgs.git ];
env = { LD_LIBRARY_PATH = "${with pkgs; lib.makeLibraryPath buildInputs}"; };

# https://devenv.sh/languages/
languages.python = {
enable = true;
uv = {
enable = true;
sync = { enable = true; };
};
};
}
15 changes: 15 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable

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

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

# If you have more than one devenv you can merge them
#imports:
# - ./backend
48 changes: 26 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
[tool.poetry]
name = "ROILoc"
version = "0.2.9"
[project]
name = "roiloc"
version = "0.3.0"
description = "A simple package to center and crop T1w & T2w MRIs around a given region of interest by its name."
license = "MIT"
readme = "README.rst"
authors = ["Clément POIRET <[email protected]>"]
license = {text = "MIT License"}
readme = {file = "README.rst", content-type = "text/x-rst"}
authors = [
{name = "Clément POIRET", email = "[email protected]"}
]
keywords = ["mri", "brain", "t1w", "t2w", "registration"]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Image Processing"
]
homepage = "https://hippomnesis.dev"
repository = "https://github.com/clementpoiret/ROILoc"

[tool.poetry.dependencies]
python = "^3.7"
antspyx = ">=0.2.7"
pandas = "^1.3.0"
rich = "^11.0.0"
importlib-resources = "^5.2.0"
urls = {homepage = "https://hippomnesis.dev", repository = "https://github.com/clementpoiret/ROILoc"}
requires-python = ">=3.9"
dependencies = [
"antspyx>=0.5.0",
"pandas>=2.0.0",
"rich>=11.0.0",
]

[tool.poetry.scripts]
roiloc = 'roiloc.roiloc:start'
[dependency-groups]
dev = [
"pytest"
]
lint = [
"ruff"
]

[tool.poetry.dev-dependencies]
pytest = "^5.2"
[project.scripts]
roiloc = "roiloc.roiloc:start"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.uv]
package = true
2 changes: 1 addition & 1 deletion roiloc/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.9"
__version__ = "0.3.0"
8 changes: 4 additions & 4 deletions roiloc/template.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import importlib
import ants
import importlib_resources
import pandas as pd
from ants.core.ants_image import ANTsImage

Expand All @@ -22,7 +22,7 @@ def get_mni(contrast: str, bet: bool) -> ANTsImage:
betstr = "bet" if bet else ""

template = f"mni_icbm152_{contrast}{betstr}_tal_nlin_sym_09c.nii"
res = importlib_resources.files("roiloc")
res = importlib.resources.files("roiloc")
data = str(res / "MNI" / "icbm152" / template)
return ants.image_read(str(data), pixeltype="float", reorient="LPI")

Expand All @@ -38,7 +38,7 @@ def get_roi_indices(roi: str) -> list:
"""
roi = roi.title()

res = importlib_resources.files("roiloc")
res = importlib.resources.files("roiloc")
data = str(res / "MNI" / "cerebra" / "CerebrA_LabelDetails.csv")
cerebra = pd.read_csv(data, index_col="Label Name")

Expand All @@ -51,7 +51,7 @@ def get_atlas() -> ANTsImage:
Returns:
ANTsImage: CerebrA atlas
"""
res = importlib_resources.files("roiloc")
res = importlib.resources.files("roiloc")
data = str(res / "MNI" / "cerebra" /
"mni_icbm152_CerebrA_tal_nlin_sym_09c.nii")
return ants.image_read(data, pixeltype="unsigned int", reorient="LPI")
2 changes: 1 addition & 1 deletion tests/test_roiloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def test_version():
assert __version__ == '0.2.9'
assert __version__ == "0.3.0"
Loading

0 comments on commit 6c8be01

Please sign in to comment.