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
3 changes: 3 additions & 0 deletions src/projspec/proj/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def __init__(
else:
storage_options = fs.storage_options
self.storage_options = storage_options or {}
assert (
fs is not None
) # guaranteed by the if/else above; url_to_fs lacks return annotation
self.fs = fs
self.url = path # this is the FS-specific variant
self.specs = AttrDict()
Expand Down
18 changes: 18 additions & 0 deletions src/projspec/proj/conda_project.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import yaml

from projspec.proj import ProjectSpec
Expand All @@ -13,6 +15,22 @@ class CondaProject(ProjectSpec):
# not a spec, but a howto:
spec_doc = "https://conda-incubator.github.io/conda-project/tutorial.html"

@staticmethod
def _create(path: str) -> None:
name = os.path.basename(path)
env_file = "environment.yml"
with open(f"{path}/{env_file}", "wt") as f:
f.write("channels:\n - conda-forge\ndependencies:\n - python >=3.10\n")
with open(f"{path}/conda-project.yml", "wt") as f:
f.write(
f"name: {name}\n"
"environments:\n"
f" default:\n"
f" - {env_file}\n"
"variables: {}\n"
"commands: {}\n"
)

def match(self) -> bool:
# TODO: a .condarc or environment.yml file is actually enough, e.g.,
# https://github.com/conda-incubator/conda-project/tree/main/examples/condarc-settings
Expand Down
1 change: 1 addition & 0 deletions tests/test_roundtrips.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"pixi",
"uv",
"briefcase",
"conda_project",
],
)
def test_compliant(tmpdir, cls_name):
Expand Down
Loading