Skip to content

Commit 5a93d55

Browse files
committed
feat: deploy to pypi
1 parent c6b4c15 commit 5a93d55

9 files changed

Lines changed: 112 additions & 23 deletions

File tree

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on tags like v1.0.0, v1.2.3, etc.
7+
8+
permissions:
9+
id-token: write # IMPORTANT: mandatory for trusted publishing
10+
11+
jobs:
12+
build:
13+
name: Build distribution
14+
runs-on: ubuntu-latest
15+
environment:
16+
name: pypi
17+
url: https://pypi.org/p/laygo
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v4
28+
with:
29+
enable-cache: true
30+
31+
- name: Build package
32+
run: uv build
33+
34+
- name: Publish to PyPI
35+
uses: pypa/gh-action-pypi-publish@release/v1

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Ringolds Lescinskis
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

laygo/__init__.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
"""
2-
Laygo
2+
Laygo - A lightweight Python library for building resilient, in-memory data pipelines
33
"""
44

55
__version__ = "0.1.0"
6+
7+
from .errors import ErrorHandler
8+
from .helpers import PipelineContext
9+
from .pipeline import Pipeline
10+
from .transformers.parallel import ParallelTransformer
11+
from .transformers.transformer import Transformer
12+
13+
__all__ = [
14+
"Pipeline",
15+
"Transformer",
16+
"ParallelTransformer",
17+
"PipelineContext",
18+
"ErrorHandler",
19+
]

laygo/helpers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
from collections.abc import Callable
22
import inspect
33
from typing import Any
4-
from typing import TypedDict
54
from typing import TypeGuard
65

76

8-
class PipelineContext(TypedDict):
7+
class PipelineContext(dict):
98
"""Generic, untyped context available to all pipeline operations."""
109

1110
pass

pyproject.toml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,32 @@ path = "laygo/__init__.py"
88
[project]
99
name = "laygo"
1010
dynamic = ["version"]
11-
description = "A Python CLI application"
11+
description = "A lightweight Python library for building resilient, in-memory data pipelines with elegant, chainable syntax"
1212
readme = "README.md"
1313
requires-python = ">=3.12"
14+
license = {text = "MIT"}
1415
authors = [
1516
{name = "Ringolds Lescinskis", email = "ringolds@lescinskis.com"},
1617
]
18+
keywords = ["pipeline", "data-processing", "etl", "functional", "chaining"]
19+
classifiers = [
20+
"Development Status :: 4 - Beta",
21+
"Intended Audience :: Developers",
22+
"License :: OSI Approved :: MIT License",
23+
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3.12",
25+
"Programming Language :: Python :: 3.13",
26+
"Topic :: Software Development :: Libraries :: Python Modules",
27+
"Topic :: Scientific/Engineering :: Information Analysis",
28+
"Topic :: Utilities",
29+
"Typing :: Typed",
30+
]
31+
32+
[project.urls]
33+
Homepage = "https://github.com/ringoldsdev/laygo-python"
34+
Documentation = "https://github.com/ringoldsdev/laygo-python/wiki"
35+
Repository = "https://github.com/ringoldsdev/laygo-python.git"
36+
Issues = "https://github.com/ringoldsdev/laygo-python/issues"
1737

1838
[project.optional-dependencies]
1939
dev = [

tests/test_integration.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import threading
44

5-
from laygo.pipeline import Pipeline
6-
from laygo.transformers.parallel import ParallelTransformer
7-
from laygo.transformers.transformer import PipelineContext
8-
from laygo.transformers.transformer import Transformer
5+
from laygo import ParallelTransformer
6+
from laygo import Pipeline
7+
from laygo import PipelineContext
8+
from laygo import Transformer
99

1010

1111
class TestPipelineTransformerBasics:
@@ -19,7 +19,7 @@ def test_basic_pipeline_transformer_integration(self):
1919

2020
def test_pipeline_context_sharing(self):
2121
"""Test that context is properly shared between pipeline and transformers."""
22-
context = {"multiplier": 3, "threshold": 5}
22+
context = PipelineContext({"multiplier": 3, "threshold": 5})
2323
transformer = Transformer().map(lambda x, ctx: x * ctx["multiplier"]).filter(lambda x, ctx: x > ctx["threshold"])
2424
result = Pipeline([1, 2, 3]).context(context).apply(transformer).to_list()
2525
assert result == [6, 9]

tests/test_parallel_transformer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import time
55
from unittest.mock import patch
66

7-
from laygo.errors import ErrorHandler
8-
from laygo.transformers.parallel import ParallelTransformer
9-
from laygo.transformers.transformer import PipelineContext
10-
from laygo.transformers.transformer import Transformer
7+
from laygo import ErrorHandler
8+
from laygo import ParallelTransformer
9+
from laygo import PipelineContext
10+
from laygo import Transformer
1111

1212

1313
class TestParallelTransformerBasics:
@@ -76,7 +76,7 @@ def test_chained_operations(self):
7676

7777
def test_flatten_operation(self):
7878
"""Test flatten operation with concurrent execution."""
79-
transformer = ParallelTransformer[list, int](max_workers=2, chunk_size=2).flatten()
79+
transformer = ParallelTransformer[list[int], list[int]](max_workers=2, chunk_size=2).flatten()
8080
result = list(transformer([[1, 2], [3, 4], [5, 6]]))
8181
assert result == [1, 2, 3, 4, 5, 6]
8282

@@ -308,7 +308,7 @@ def test_safe_with_error_isolation(self):
308308
errored_chunks = []
309309
transformer = ParallelTransformer.init(int, chunk_size=1).catch(
310310
lambda t: t.map(lambda x: x / 0), # Division by zero
311-
on_error=lambda chunk, error, context: errored_chunks.append(chunk),
311+
on_error=lambda chunk, error, context: errored_chunks.append(chunk), # type: ignore
312312
)
313313
result = list(transformer([1, 2, 3]))
314314

tests/test_pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Tests for the Pipeline class."""
22

3-
from laygo.pipeline import Pipeline
4-
from laygo.transformers.transformer import Transformer
3+
from laygo import Pipeline
4+
from laygo import Transformer
55

66

77
class TestPipelineBasics:

tests/test_transformer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import pytest
44

5-
from laygo.errors import ErrorHandler
6-
from laygo.transformers.transformer import PipelineContext
7-
from laygo.transformers.transformer import Transformer
5+
from laygo import ErrorHandler
6+
from laygo import PipelineContext
7+
from laygo import Transformer
88

99

1010
class TestTransformerBasics:
@@ -216,7 +216,7 @@ def test_catch_with_error_isolation(self):
216216
errored_chunks = []
217217
transformer = Transformer.init(int, chunk_size=1).catch(
218218
lambda t: t.map(lambda x: x / 0), # Division by zero
219-
on_error=lambda chunk, error, context: errored_chunks.append(chunk),
219+
on_error=lambda chunk, error, context: errored_chunks.append(chunk), # type: ignore
220220
)
221221
result = list(transformer([1, 2, 3]))
222222

@@ -244,7 +244,7 @@ def set_error_flag(_chunk, _error, context):
244244
Transformer.init(int, chunk_size=1)
245245
.catch(
246246
lambda t: t.map(lambda x: x / 0),
247-
on_error=set_error_flag,
247+
on_error=set_error_flag, # type: ignore
248248
)
249249
.short_circuit(lambda ctx: ctx.get("error_occurred", False))
250250
)
@@ -266,7 +266,7 @@ def raise_on_error(ctx):
266266
Transformer.init(int, chunk_size=1)
267267
.catch(
268268
lambda t: t.map(lambda x: x / 0),
269-
on_error=set_error_flag,
269+
on_error=set_error_flag, # type: ignore
270270
)
271271
.short_circuit(raise_on_error)
272272
)

0 commit comments

Comments
 (0)