Skip to content

Commit

Permalink
feat: str representation of env spec
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Jul 5, 2024
1 parent 33613c9 commit 9050a9e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dep_logic/tags/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ class EnvSpec:
platform: Platform | None = None
implementation: Implementation | None = None

def __str__(self) -> str:
parts = [str(self.requires_python)]
if self.platform is not None:
parts.append(str(self.platform))
if self.implementation is not None:
parts.append(self.implementation.name)
return f"({', '.join(parts)})"

def as_dict(self) -> dict[str, str | bool]:
result: dict[str, str | bool] = {"requires_python": str(self.requires_python)}
if self.platform is not None:
Expand Down

0 comments on commit 9050a9e

Please sign in to comment.