Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
51 changes: 5 additions & 46 deletions .importlinter
Original file line number Diff line number Diff line change
Expand Up @@ -90,50 +90,9 @@ layers =
afno | dlwp | dlwp_healpix | domino | dpot | fengwu | figconvnet | fno | graphcast | meshgraphnet | pangu | pix2pix | rnn | srrn | swinvrnn | topodiff | transolver | vfgn
unet | diffusion | dlwp_healpix_layers

[importlinter:contract:physicsnemo-core-external-imports]
name = Prevent Non-listed external imports in physicsnemo core
[importlinter:contract:physicsnemo-external-imports]
name = Prevent Non-listed external imports in physicsnemo
type = forbidden_import
container = physicsnemo.core
dependency_group = core

[importlinter:contract:physicsnemo-distributed-external-imports]
name = Prevent Non-listed external imports in physicsnemo distributed
type = forbidden_import
container = physicsnemo.distributed
dependency_group = distributed

[importlinter:contract:physicsnemo-utils-external-imports]
name = Prevent Non-listed external imports in physicsnemo utils
type = forbidden_import
container = physicsnemo.utils
dependency_group = utils

[importlinter:contract:physicsnemo-nn-external-imports]
name = Prevent Non-listed external imports in physicsnemo nn
type = forbidden_import
container = physicsnemo.nn
dependency_group = nn

[importlinter:contract:physicsnemo-models-external-imports]
name = Prevent Non-listed external imports in physicsnemo models
type = forbidden_import
container = physicsnemo.models
dependency_group = models

[importlinter:contract:physicsnemo-metrics-external-imports]
name = Prevent Non-listed external imports in physicsnemo metrics
type = forbidden_import
container = physicsnemo.metrics
dependency_group = metrics

; [importlinter:contract:physicsnemo-datapipes-external-imports]
; name = Prevent Non-listed external imports in physicsnemo datapipes
; type = forbidden_import
; container = physicsnemo.datapipes
; dependency_group = datapipes

[importlinter:contract:physicsnemo-domain_parallel-external-imports]
name = Prevent Non-listed external imports in physicsnemo domain_parallel
type = forbidden_import
container = physicsnemo.domain_parallel
dependency_group = domain_parallel
container = physicsnemo
exclude =
datapipes
183 changes: 71 additions & 112 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#####################################################################
# Core Project metadata
#####################################################################
[project]
name = "nvidia-physicsnemo"
authors = [
Expand All @@ -10,31 +13,32 @@ readme = "README.md"
requires-python = ">=3.10"

license = "Apache-2.0"
# NOTE: this is meant to move to `uv` off of dependency-groups.
# This is just informational here:
#_dependencies = [
# "certifi>=2023.7.22",
# "einops>=0.8.0",
# "fsspec>=2023.1.0",
# "numpy>=1.22.4",
# "onnx>=1.14.0",
# "packaging>=24.2",
# "requests>=2.32.2",
# "s3fs>=2023.5.0",
# "setuptools>=77.0.3",
# "timm>=1.0.0",
# "torch>=2.4.0",
# "tqdm>=4.60.0",
# "treelib>=1.2.5",
# "xarray>=2023.1.0",
# "zarr>=2.14.2",
# ]

classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
dynamic = ["version", "optional_dependencies"]

dependencies = [
"termcolor",
"onnx>=1.14.0",
"warp-lang",
"pandas",
"nvtx",
"treelib>=1.2.5",
"numpy>=1.22.4",
"torch>=2.4.0",
"tqdm>=4.60.0",
"requests>=2.32.2",
"GitPython",
"s3fs>=2023.5.0",
"packaging>=24.2",
"h5py",
"jaxtyping",
"cftime"
]

[project.urls]
Homepage = "https://github.com/NVIDIA/physicsnemo"
Documentation = "https://docs.nvidia.com/physicsnemo/index.html#core"
Expand All @@ -43,17 +47,32 @@ Changelog = "https://github.com/NVIDIA/physicsnemo/blob/main/CHANGELOG.md"



[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
#####################################################################
# Flags for UV compatibility
#####################################################################

[tool.uv]
no-build-isolation-package = [
"torch_scatter",
"torch_cluster",
]
managed = true
default-groups = ["physicsnemo"]

# torch-sparse requires us to tell uv about it's dependency on torch.
[tool.uv.extra-build-dependencies]
torch-sparse = ["torch"]

# Earth2 grid is not on pypi ....
[tool.uv.sources]
earth2grid = { url = "https://github.com/NVlabs/earth2grid/archive/main.tar.gz" }

#####################################################################
# Flags Controlling the local build of physicsnemo
#####################################################################
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"


[tool.hatch.version]
path = "physicsnemo/__init__.py"
Expand All @@ -71,129 +90,69 @@ exclude = [
]


# The dependency-group tree is critically important for physicsnemo.
# Here, we list_dependencies for each physicsnemo pacakge. Optional
#_dependencies are listed with the name `package`-extras. _Dependencies
# are chained together: for example, everything in core is a dep of the
# entire repo, but utils-extra only shows up for subsequent *-extra
# lists.
#
# We do this to ensure a consistent install path for targeted levels of the
# repository. If you just want the distributed manager, for example, you can
# target `distributed` instead of `physicsnemo` and you're up and running.
#
# These lists are the SINGLE SOURCE OF TRUTH. Models are also included
# below, to make single-model installation easier.
#
# In general, we do not draw a finer line than "required" and "extra".
# So, physicsnemo.nn's requirements do not include scipy and cuml, but the
# "extra" version includes BOTH.
#####################################################################
# Local Development Requirements (pytest, etc)
#####################################################################

[dependency-groups]
core = [
"torch>=2.4.0",
"tqdm>=4.60.0", # done
"requests>=2.32.2",
"GitPython",
"s3fs>=2023.5.0",
"packaging>=24.2",
]
# no core-extras
distributed = [
"treelib>=1.2.5",
"numpy>=1.22.4",
{include-group = "core"}
]
# no distributed-extras
utils = [
"termcolor",
"onnx>=1.14.0",
"warp-lang",
"pandas",
"nvtx",
{include-group = "distributed"},
dev = [
"pytest",
"import-linter"
]

#####################################################################
# Optional Dependency groups
#####################################################################

# These groups are self-referential. So, they chain together as you
# move up the physicsnemo hierarchy. A new extra dep in `physicsnemo/nn`
# will also be an extra dep in `physicsnemo/models`, but not the other
# direction.

[project.optional-dependencies]
utils-extras = [
"wandb",
"mlflow",
"line_profiler",
"vtx",
"vtk",
"stl",
"rmm",
"cupy",
]
nn = [
"einops>=0.8.0",
"timm>=1.0.0",
{include-group= "utils"}
]
nn-extras = [
"cuml",
"transformer_engine",
"transformer_engine[pytorch]",
"scipy",
{include-group = "nn"},
{include-group = "utils-extras"},
]
models = [
"cftime",
"hydra-core",
"omegaconf",
"xarray>=2023.1.0",
"zarr>=2.14.2",
"jaxtyping",
{include-group="nn"},
"nvidia-physicsnemo[utils-extras]",
]
models-extras = [
"transformer_engine",
model-extras = [
"nvidia-physicsnemo[nn-extras]",
"transformer_engine[pytorch]",
"netCDF4",
"pyvista",
"vtk",
{include-group="models"},
{include-group="nn-extras"},
]
metrics = [
{include-group="models"},
]
datapipes = [
"h5py",
{include-group="metrics"},
]
datapipes-extras = [
"dask",
"tensorflow",
{include-group="datapipes"},
{include-group="models-extras"},
]
domain_parallel = [
{include-group = "nn"}
]
physicsnemo = [
{include-group = "domain-parallel"},
{include-group = "datapipes"},
"nvidia-physicsnemo[model-extras]",
]
physicsnemo-extras = [
{include-group = "physicsnemo"},
# {include-group = "models-extras"},
]
dev = [
"pytest",
"import-linter"
]

[project.optional_dependencies]
gnns = [
"torch_geometric",
"torch_scatter",
"torch_sparse",
"torch_cluster",
"pylibcugraphops",
"nvfuser",
"nvidia-physicsnemo[model-extras]",
]

healpix = [
"earth2grid",
]

#####################################################################
# Linting configuration
#####################################################################

[tool.ruff]
# Enable flake8/pycodestyle (`E`), Pyflakes (`F`), flake8-bandit (`S`),
# isort (`I`), and performance 'PERF' rules.
Expand Down
Loading