Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/optional-dependencies #16

Merged
merged 3 commits into from
Nov 30, 2024
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
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ $ pip install uv
uv sync
```

if you need to install Pytorch(cpu) and torchvision, run the following command.

```
uv sync --extra cpu
```

if you need to install Pytorch(cu121) and torchvision, run the following command.

```
uv sync --extra cu121
```

3. activate pre-commit

```
Expand Down
44 changes: 32 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,24 @@ dependencies = [
"hydra-core>=1.3.2",
"scipy>=1.10.1",
"pandas>=2.0.3",
"polars[gpu]>=1.5.0",
"polars>=1.5.0",
"scikit-learn>=1.3.0",
"loguru>=0.7.2",
"tqdm>=4.64.1",
"lightning==2.4.0",
"matplotlib>=3.8.4",
"seaborn>=0.13.2",
"japanize_matplotlib>=1.1.3",
"wandb>=0.16.6",
"torch>=2.4.1",
]
readme = "README.md"
requires-python = ">= 3.10"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src"]

[tool.uv.pip]
index-url = "https://download.pytorch.org/whl/cu121"
[project.optional-dependencies]
cpu = ["torch>=2.5.1", "torchvision>=0.20.1", "lightning==2.4.0"]
cu121 = ["torch>=2.5.1", "torchvision>=0.20.1", "lightning==2.4.0"]

[tool.uv]
conflicts = [[{ extra = "cpu" }, { extra = "cu121" }]]
managed = true
dev-dependencies = [
"jupyter>=1.1.1",
Expand All @@ -42,6 +35,33 @@ dev-dependencies = [
"ruff>=0.6.9",
]

[tool.uv.sources]
torch = [
{ index = "pytorch-cpu", extra = "cpu", marker = "platform_system != 'Darwin'" },
{ index = "pytorch-cu121", extra = "cu121" },
]
torchvision = [
{ index = "pytorch-cpu", extra = "cpu", marker = "platform_system != 'Darwin'" },
{ index = "pytorch-cu121", extra = "cu121" },
]

[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

[[tool.uv.index]]
name = "pytorch-cu121"
url = "https://download.pytorch.org/whl/cu121"
explicit = true

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src"]

[tool.mypy]
allow_redefinition = true
allow_untyped_globals = false
Expand Down
Loading