Commit 7a403db9 authored by Yann Beauxis's avatar Yann Beauxis
Browse files

Merge branch 'PathHandler' into 'master'

PathHandler

See merge request !8
parents d73892da 0ffae232
......@@ -934,17 +934,6 @@ typing-extensions = ">=3.7.4.3"
dotenv = ["python-dotenv (>=0.10.4)"]
email = ["email-validator (>=1.0.3)"]
[[package]]
name = "pydot"
version = "1.4.2"
description = "Python interface to Graphviz's Dot"
category = "main"
optional = true
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[package.dependencies]
pyparsing = ">=2.1.4"
[[package]]
name = "pyflakes"
version = "2.4.0"
......@@ -1352,7 +1341,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
[metadata]
lock-version = "1.1"
python-versions = "^3.8"
content-hash = "9b6708bb370f5064a52002be79bc254a96bd016a9ae09573f3d1be6c92959bbb"
content-hash = "5aa89db30a370b9497a3f6892c09d54e6e06568d0befeb5b4ce08e965ce01303"
[metadata.files]
aiohttp = [
......@@ -2278,10 +2267,6 @@ pydantic = [
{file = "pydantic-1.9.0-py3-none-any.whl", hash = "sha256:085ca1de245782e9b46cefcf99deecc67d418737a1fd3f6a4f511344b613a5b3"},
{file = "pydantic-1.9.0.tar.gz", hash = "sha256:742645059757a56ecd886faf4ed2441b9c0cd406079c2b4bee51bcc3fbcd510a"},
]
pydot = [
{file = "pydot-1.4.2-py2.py3-none-any.whl", hash = "sha256:66c98190c65b8d2e2382a441b4c0edfdb4f4c025ef9cb9874de478fb0793a451"},
{file = "pydot-1.4.2.tar.gz", hash = "sha256:248081a39bcb56784deb018977e428605c1c758f10897a339fce1dd728ff007d"},
]
pyflakes = [
{file = "pyflakes-2.4.0-py2.py3-none-any.whl", hash = "sha256:3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e"},
{file = "pyflakes-2.4.0.tar.gz", hash = "sha256:05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c"},
......
[tool.poetry]
name = "sinagot"
version = "0.5.2"
version = "0.5.3"
description = "Python lightweight workflow management framework with data exploration features"
authors = ["Yann Beauxis <pro@yannbeauxis.net>"]
maintainers = ["Yann Beauxis <pro@yannbeauxis.net>"]
......@@ -14,7 +14,6 @@ documentation = "https://gitlab.com/YannBeauxis/sinagot"
python = "^3.8"
ray = "^1.9.1"
pandas = "^1.3.5"
pydot = { version = "^1.4.2", optional = true }
pydantic = "^1.9.0"
[tool.poetry.dev-dependencies]
......
......@@ -133,3 +133,8 @@ class DataFrameHandler(TypeHandler, data_type=pd.DataFrame):
def write(self, path: Path, data: Any) -> None:
data.to_csv(path, **self.write_kwargs)
class PathHandler(TypeHandler, data_type=Path):
def read(self, path: Path) -> Any:
return path
from pathlib import Path
import sinagot as sg
def test_path_seed() -> None:
ROOT_PATH = "/root"
TEST_PATH = "test/path"
@sg.step
def convert_path_to_str(path: Path) -> str:
return str(path)
class TestWokflow(sg.Workflow):
path: Path = sg.seed()
path_str = convert_path_to_str.step(path=path)
class TestWorkspace(sg.Workspace[TestWokflow]):
path = sg.LocalStorage(TEST_PATH)
ws = TestWorkspace(ROOT_PATH)
assert ws["1"].path_str == str(Path(ROOT_PATH, TEST_PATH))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment