-
Notifications
You must be signed in to change notification settings - Fork 3
Set up uv workspace #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,16 +5,21 @@ description = "A lightweight dependency for authoring LynxKite operations and ex | |
| readme = "README.md" | ||
| requires-python = ">=3.11" | ||
| dependencies = [ | ||
| "pydantic>=2.11.7", | ||
| ] | ||
| classifiers = ["License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)"] | ||
|
|
||
| [project.urls] | ||
| Homepage = "https://github.com/lynxkite/lynxkite-2000/" | ||
|
|
||
| [project.optional-dependencies] | ||
| dev = [ | ||
| "pytest", | ||
| ] | ||
| [tool.deptry.per_rule_ignores] | ||
| DEP001 = ["matplotlib", "griffe", "pycrdt"] | ||
| DEP003 = ["matplotlib", "griffe", "pycrdt"] | ||
|
Comment on lines
+16
to
+17
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are conditional imports. Optional dependencies. |
||
|
|
||
| [build-system] | ||
| requires = ["setuptools", "wheel", "setuptools-scm"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [tool.pytest.ini_options] | ||
| asyncio_mode = "auto" | ||
| [tool.setuptools.packages.find] | ||
| namespaces = true | ||
| where = ["src"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,9 +15,7 @@ | |
| import typing | ||
| from dataclasses import dataclass | ||
|
|
||
| import joblib | ||
| import pydantic | ||
| from typing_extensions import Annotated | ||
|
|
||
| if typing.TYPE_CHECKING: | ||
| from . import workspace | ||
|
|
@@ -26,10 +24,17 @@ | |
| Catalogs = dict[str, Catalog] | ||
| CATALOGS: Catalogs = {} | ||
| EXECUTORS = {} | ||
| mem = joblib.Memory(".joblib-cache") | ||
|
|
||
| typeof = type # We have some arguments called "type". | ||
|
|
||
| CACHE_WRAPPER = None # Overwrite this to configure a caching mechanism. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To keep |
||
|
|
||
|
|
||
| def _cache_wrap(func): | ||
| if CACHE_WRAPPER is None: | ||
| return func | ||
| return CACHE_WRAPPER(func) | ||
|
|
||
|
|
||
| def type_to_json(t): | ||
| if isinstance(t, type) and issubclass(t, enum.Enum): | ||
|
|
@@ -39,10 +44,10 @@ def type_to_json(t): | |
| return {"type": str(t)} | ||
|
|
||
|
|
||
| Type = Annotated[typing.Any, pydantic.PlainSerializer(type_to_json, return_type=dict)] | ||
| LongStr = Annotated[str, {"format": "textarea"}] | ||
| Type = typing.Annotated[typing.Any, pydantic.PlainSerializer(type_to_json, return_type=dict)] | ||
| LongStr = typing.Annotated[str, {"format": "textarea"}] | ||
| """LongStr is a string type for parameters that will be displayed as a multiline text area in the UI.""" | ||
| PathStr = Annotated[str, {"format": "path"}] | ||
| PathStr = typing.Annotated[str, {"format": "path"}] | ||
| # https://github.com/python/typing/issues/182#issuecomment-1320974824 | ||
| ReadOnlyJSON: typing.TypeAlias = ( | ||
| typing.Mapping[str, "ReadOnlyJSON"] | ||
|
|
@@ -239,12 +244,12 @@ def compute_id(self): | |
| def op( | ||
| env: str, | ||
| *names: str, | ||
| view="basic", | ||
| outputs=None, | ||
| params=None, | ||
| slow=False, | ||
| color=None, | ||
| cache=None, | ||
| view: str = "basic", | ||
| outputs: list[str] | None = None, | ||
| params: list[Parameter] | None = None, | ||
| slow: bool = False, | ||
| color: str | None = None, | ||
| cache: bool | None = None, | ||
|
Comment on lines
+247
to
+252
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To address Griffe warnings, which I saw when I checked if |
||
| ): | ||
| """ | ||
| Decorator for defining an operation. | ||
|
|
@@ -275,7 +280,7 @@ def decorator(func): | |
| if slow: | ||
| func = make_async(func) | ||
| if cache is not False: | ||
| func = mem.cache(func) | ||
| func = _cache_wrap(func) | ||
| # Positional arguments are inputs. | ||
| inputs = [ | ||
| Input(name=name, type=param.annotation) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, running
deptry .in the root doesn't work. osprey-oss/deptry#1060 (comment)