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
4 changes: 3 additions & 1 deletion alpacloud/argocdkit/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pex_binary(
python_distribution(
name="alpacloud.argocdkit",
repositories=["@alpacloud.argocdkit"],
dependencies=[":argocdkit"],
dependencies=[":argocdkit", ":py.typed"],
long_description_path="alpacloud/argocdkit/readme.md",
provides=python_artifact(
name="alpacloud.argocdkit",
Expand All @@ -42,3 +42,5 @@ python_distribution(
long_description_content_type="text/markdown",
),
)

resource(name="py.typed", source="py.typed")
Empty file added alpacloud/argocdkit/py.typed
Empty file.
4 changes: 3 additions & 1 deletion alpacloud/crdvis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ python_tests(
python_distribution(
name="alpacloud.crdvis",
repositories=["@alpacloud.crdvis"],
dependencies=[":crdvis"],
dependencies=[":crdvis", ":py.typed"],
long_description_path="alpacloud/crdvis/readme.md",
provides=python_artifact(
name="alpacloud.crdvis",
Expand All @@ -29,3 +29,5 @@ python_distribution(
long_description_content_type="text/markdown",
),
)

resource(name="py.typed", source="py.typed")
10 changes: 7 additions & 3 deletions alpacloud/crdvis/crd.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import requests
import yaml
from pydantic import ValidationError
from requests import RequestException

from alpacloud.crdvis.models import CustomResourceDefinition

Expand All @@ -32,10 +33,13 @@ def read_path(path: str) -> CustomResourceDefinition:
if url.netloc == "github.com":
req.params["raw"] = "true"

response = requests.Session().send(req.prepare(), timeout=30)
try:
response = requests.Session().send(req.prepare(), timeout=30)
if not response.ok:
raise CRDReadError(f"Failed to fetch CRD from {path}: {response.status_code}")
except RequestException as e:
raise CRDReadError(f"Failed to fetch CRD from {path}: {e}")

if not response.ok:
raise CRDReadError(f"Failed to fetch CRD from {path}: {response.status_code}")
content = response.text
elif path.startswith("file://") or os.path.exists(path):
disk_path = path.rsplit("://", 1)[-1]
Expand Down
Empty file added alpacloud/crdvis/py.typed
Empty file.
10 changes: 6 additions & 4 deletions alpacloud/eztag/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ python_tests(
# dependencies=["./test_resources:k8s_objs"],
)

python_test_utils(
name="test_utils",
)
# python_test_utils(
# name="test_utils",
# )

python_distribution(
name="alpacloud.eztag",
repositories=["@alpacloud.eztag"],
dependencies=[":eztag"],
dependencies=[":eztag", ":py.typed"],
long_description_path="alpacloud/eztag/readme.md",
provides=python_artifact(
name="alpacloud_eztag",
Expand All @@ -33,3 +33,5 @@ python_distribution(
long_description_content_type="text/markdown",
),
)

resource(name="py.typed", source="py.typed")
Empty file added alpacloud/eztag/py.typed
Empty file.
4 changes: 3 additions & 1 deletion alpacloud/lens/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ python_test_utils(
python_distribution(
name="alpacloud.lens",
repositories=["@alpacloud.lens"],
dependencies=[":lens"],
dependencies=[":lens", ":py.typed"],
long_description_path="alpacloud/lens/readme.md",
provides=python_artifact(
name="alpacloud.lens",
Expand All @@ -32,3 +32,5 @@ python_distribution(
long_description_content_type="text/markdown",
),
)

resource(name="py.typed", source="py.typed")
13 changes: 13 additions & 0 deletions alpacloud/lens/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 0

## 0.2

### 0.2.0

- feature : make BoundLens Callable

## 0.1

### 0.1.0

- release!
7 changes: 7 additions & 0 deletions alpacloud/lens/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ def __mod__(self, other: BoundLensT[S, T, A, B]):
def map(self, s: S) -> T:
"""Modify the focus of this lens."""

def __call__(self, s: S) -> T:
"""Modify the focus of this lens."""
return self.map(s)

@staticmethod
def const(l: LensT[S, T, A, B], v: B) -> BoundLens[S, T, A, B]:
"""Set the focus of this lens to a constant value."""
Expand All @@ -162,6 +166,9 @@ def get(self, s: S) -> A:
def map(self, s: S) -> T:
return self.lens.l_map(s, self.f)

def __call__(self, s: S) -> T:
return self.lens.l_map(s, self.f)


@dataclass
class CombinedBoundLens(BoundLensT[S, S, A, B]):
Expand Down
1 change: 1 addition & 0 deletions alpacloud/lens/models_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def test_combined(self):

combined = l0 % l1
assert combined.map(v) == [9, 8]
assert combined(v) == [9, 8], "Callable syntax didn't work"

def test_combined_coalesce(self):
"""Test that a CombinedBoundLens will be extended when combined with single items"""
Expand Down
Empty file added alpacloud/lens/py.typed
Empty file.
2 changes: 2 additions & 0 deletions alpacloud/lens/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ You can bind the mapping function to easily apply the same transformation multip
# note how we can re-use `replicas` from above
add_replica = replicas @ (lambda n: n + 1)
add_replica.map(my_deployment)
# or as a Callable
add_replica(my_deployment)
```

You can combine several bound lenses to create pipelines
Expand Down
4 changes: 3 additions & 1 deletion alpacloud/promls/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ python_tests(
python_distribution(
name="alpacloud.promls",
repositories=["@alpacloud.promls"],
dependencies=[":promls"],
dependencies=[":promls", ":py.typed"],
long_description_path="alpacloud/promls/readme.md",
provides=python_artifact(
name="alpacloud_promls",
Expand All @@ -31,3 +31,5 @@ python_distribution(
long_description_content_type="text/markdown",
),
)

resource(name="py.typed", source="py.typed")
12 changes: 6 additions & 6 deletions alpacloud/promls/changelog.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# 0

# 0.3
## 0.3

# 0.3.0
### 0.3.0

- fix : parser can parse escaped sequences
- feature : parser can report errors and is more robust
- feature : show labels in browser
- ui : tweaks for browser tree
- feature : combine submetrics of summaries and histograms

# 0.2
## 0.2

## 0.2.0
### 0.2.0

- refactor : drop jank fuzzy finder

# 0.1
## 0.1

## 0.1.0
### 0.1.0

- release
Empty file added alpacloud/promls/py.typed
Empty file.
Loading