From fdfd731d7729d505fba003b281230ba417cd5d8c Mon Sep 17 00:00:00 2001 From: scosman Date: Sun, 18 Aug 2024 19:39:10 -0400 Subject: [PATCH 01/10] Working monorepo! Needs polish but getting there --- .vscode/settings.json | 9 +- checks.sh | 26 ++-- core/tests/test_example.py | 10 -- {src/core => libs/kiln_ai}/LICENSE.txt | 0 libs/kiln_ai/kilnai/__init.__.py | 3 + libs/kiln_ai/kilnai/coreadd.py | 3 + libs/kiln_ai/kilnai/datamodel/__init__.py | 3 + libs/kiln_ai/kilnai/datamodel/project.py | 15 +++ libs/kiln_ai/poetry.lock | 101 ++++++++++++++++ libs/kiln_ai/pyproject.toml | 21 ++++ libs/kiln_ai/setup.cfg | 1 + libs/kiln_ai/tests/test_project.py | 11 ++ {src => libs}/studio/LICENSE.txt | 0 {src => libs}/studio/dev.sh | 0 .../studio/kiln_studio}/server.py | 2 +- libs/studio/poetry.lock | 114 ++++++++++++++++++ libs/studio/pyproject.toml | 21 ++++ libs/studio/requirements.txt | 1 + libs/studio/setup.cfg | 1 + libs/studio/tests/test_import.py | 7 ++ requirements.txt | 4 +- src/core/__about__.py | 2 - src/core/__init__.py | 1 - src/core/coreadd.py | 3 - src/studio/__about__.py | 2 - src/studio/__init__.py | 1 - 26 files changed, 325 insertions(+), 37 deletions(-) delete mode 100644 core/tests/test_example.py rename {src/core => libs/kiln_ai}/LICENSE.txt (100%) create mode 100644 libs/kiln_ai/kilnai/__init.__.py create mode 100644 libs/kiln_ai/kilnai/coreadd.py create mode 100644 libs/kiln_ai/kilnai/datamodel/__init__.py create mode 100644 libs/kiln_ai/kilnai/datamodel/project.py create mode 100644 libs/kiln_ai/poetry.lock create mode 100644 libs/kiln_ai/pyproject.toml create mode 100644 libs/kiln_ai/setup.cfg create mode 100644 libs/kiln_ai/tests/test_project.py rename {src => libs}/studio/LICENSE.txt (100%) rename {src => libs}/studio/dev.sh (100%) rename {src/studio => libs/studio/kiln_studio}/server.py (96%) create mode 100644 libs/studio/poetry.lock create mode 100644 libs/studio/pyproject.toml create mode 100644 libs/studio/requirements.txt create mode 100644 libs/studio/setup.cfg create mode 100644 libs/studio/tests/test_import.py delete mode 100644 src/core/__about__.py delete mode 100644 src/core/__init__.py delete mode 100644 src/core/coreadd.py delete mode 100644 src/studio/__about__.py delete mode 100644 src/studio/__init__.py diff --git a/.vscode/settings.json b/.vscode/settings.json index e5db53c..9cef872 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,6 +6,9 @@ "eslint.validate": ["javascript", "javascriptreact", "svelte"], // Svelte, JS, TS files "[javascript, typescript, svelte, json]": { - "editor.defaultFormatter": "svelte.svelte-vscode", - } -} \ No newline at end of file + "editor.defaultFormatter": "svelte.svelte-vscode" + }, + "python.testing.pytestArgs": ["."], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true +} diff --git a/checks.sh b/checks.sh index ecfeac6..a6330c2 100755 --- a/checks.sh +++ b/checks.sh @@ -29,20 +29,20 @@ else fi echo "${headerStart}Checking Core: build, test${headerEnd}" -cd core -hatch build -hatch test -cd .. +#cd core +#hatch build +#hatch test +#cd .. echo "${headerStart}Checking Studio: build, test${headerEnd}" -cd studio -hatch build -hatch test -cd .. +#cd studio +#hatch build +#hatch test +#cd .. echo "${headerStart}Checking Types${headerEnd}" -cd src/core -mypy --install-types --non-interactive . -cd ../studio -mypy --install-types --non-interactive . -cd ../.. +#cd src/core +#mypy --install-types --non-interactive . +#cd ../studio +#mypy --install-types --non-interactive . +#cd ../.. diff --git a/core/tests/test_example.py b/core/tests/test_example.py deleted file mode 100644 index 0740a97..0000000 --- a/core/tests/test_example.py +++ /dev/null @@ -1,10 +0,0 @@ -import unittest - - -class TestExample(unittest.TestCase): - def test_a(self): - self.assertEqual(42, 42) - - -if __name__ == "__main__": - unittest.main() diff --git a/src/core/LICENSE.txt b/libs/kiln_ai/LICENSE.txt similarity index 100% rename from src/core/LICENSE.txt rename to libs/kiln_ai/LICENSE.txt diff --git a/libs/kiln_ai/kilnai/__init.__.py b/libs/kiln_ai/kilnai/__init.__.py new file mode 100644 index 0000000..7d1d66f --- /dev/null +++ b/libs/kiln_ai/kilnai/__init.__.py @@ -0,0 +1,3 @@ +import coreadd + +__all__ = ["coreadd"] diff --git a/libs/kiln_ai/kilnai/coreadd.py b/libs/kiln_ai/kilnai/coreadd.py new file mode 100644 index 0000000..98b66f2 --- /dev/null +++ b/libs/kiln_ai/kilnai/coreadd.py @@ -0,0 +1,3 @@ +# TODO_P0: remove example function +def add(a, b) -> int: + return a + b + 1 diff --git a/libs/kiln_ai/kilnai/datamodel/__init__.py b/libs/kiln_ai/kilnai/datamodel/__init__.py new file mode 100644 index 0000000..c645670 --- /dev/null +++ b/libs/kiln_ai/kilnai/datamodel/__init__.py @@ -0,0 +1,3 @@ +from .project import KilnProject + +__all__ = ["KilnProject"] diff --git a/libs/kiln_ai/kilnai/datamodel/project.py b/libs/kiln_ai/kilnai/datamodel/project.py new file mode 100644 index 0000000..a40cc95 --- /dev/null +++ b/libs/kiln_ai/kilnai/datamodel/project.py @@ -0,0 +1,15 @@ +from pydantic import BaseModel +from typing import Optional + + +class KilnProject(BaseModel): + version: int = 1 + name: str + path: Optional[str] = None + + def __init__(self, name: str, path: Optional[str] = None): + # TODO: learn about pydantic init + super().__init__(name=name, path=path) + if path is not None and name is not None: + # path and name are mutually exclusive for constructor, name comes from path if passed + raise ValueError("path and name are mutually exclusive") diff --git a/libs/kiln_ai/poetry.lock b/libs/kiln_ai/poetry.lock new file mode 100644 index 0000000..de7e7a2 --- /dev/null +++ b/libs/kiln_ai/poetry.lock @@ -0,0 +1,101 @@ +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.2.2" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "packaging" +version = "24.1" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, + {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, +] + +[[package]] +name = "pluggy" +version = "1.5.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pytest" +version = "7.4.4" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[metadata] +lock-version = "2.0" +python-versions = ">=3.9" +content-hash = "9f9bb02ab63f5f8c459b66ca2adc203e62ff4f325b4ca6ef45afee57179d2674" diff --git a/libs/kiln_ai/pyproject.toml b/libs/kiln_ai/pyproject.toml new file mode 100644 index 0000000..87f3848 --- /dev/null +++ b/libs/kiln_ai/pyproject.toml @@ -0,0 +1,21 @@ +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry] +name = "kilnai" +version = "0.0.3" +description = 'Kiln AI' +authors = [ + "Steve Cosman, Chesterfield Laboratories Inc ", +] +license = "Proprietary" +homepage = "https://kiln-ai.com" +repository = "https://github.com/Kiln-AI/kiln" + + +[tool.poetry.dependencies] +python = ">=3.9" + +[tool.poetry.dev-dependencies] +pytest = "^7.2" diff --git a/libs/kiln_ai/setup.cfg b/libs/kiln_ai/setup.cfg new file mode 100644 index 0000000..661ccfa --- /dev/null +++ b/libs/kiln_ai/setup.cfg @@ -0,0 +1 @@ +# empty, but needed by setuptools \ No newline at end of file diff --git a/libs/kiln_ai/tests/test_project.py b/libs/kiln_ai/tests/test_project.py new file mode 100644 index 0000000..180a914 --- /dev/null +++ b/libs/kiln_ai/tests/test_project.py @@ -0,0 +1,11 @@ +import kilnai.coreadd as coreadd +import kilnai.datamodel as datamodel + + +def test_coreadd(): + assert coreadd.add(1, 1) == 3 + + +def test_project_init(): + project = datamodel.KilnProject(name="test") + assert project.name == "test" diff --git a/src/studio/LICENSE.txt b/libs/studio/LICENSE.txt similarity index 100% rename from src/studio/LICENSE.txt rename to libs/studio/LICENSE.txt diff --git a/src/studio/dev.sh b/libs/studio/dev.sh similarity index 100% rename from src/studio/dev.sh rename to libs/studio/dev.sh diff --git a/src/studio/server.py b/libs/studio/kiln_studio/server.py similarity index 96% rename from src/studio/server.py rename to libs/studio/kiln_studio/server.py index e0361f7..53f64b6 100644 --- a/src/studio/server.py +++ b/libs/studio/kiln_studio/server.py @@ -16,7 +16,7 @@ def studio_path(): except Exception: base_path = os.path.join(os.path.dirname(__file__), "..") - return os.path.join(base_path, "web_ui/build") + return os.path.join(base_path, "../../src/web_ui/build") app = FastAPI() diff --git a/libs/studio/poetry.lock b/libs/studio/poetry.lock new file mode 100644 index 0000000..8510c5d --- /dev/null +++ b/libs/studio/poetry.lock @@ -0,0 +1,114 @@ +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.2.2" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "kilnai" +version = "0.0.3" +description = "Kiln AI" +optional = false +python-versions = "*" +files = [] +develop = true + +[package.source] +type = "directory" +url = "../kiln_ai" + +[[package]] +name = "packaging" +version = "24.1" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, + {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, +] + +[[package]] +name = "pluggy" +version = "1.5.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pytest" +version = "7.4.4" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[metadata] +lock-version = "2.0" +python-versions = ">=3.9" +content-hash = "14aaa010f1cc147d5080335645797a86fffbe4443ce973f3e40272e1caffc3cd" diff --git a/libs/studio/pyproject.toml b/libs/studio/pyproject.toml new file mode 100644 index 0000000..5c243cf --- /dev/null +++ b/libs/studio/pyproject.toml @@ -0,0 +1,21 @@ +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry] +name = "kiln_studio" +version = "0.0.1" +description = 'Kiln Studio' +authors = [ + "Steve Cosman, Chesterfield Laboratories Inc ", +] +license = "Proprietary" +homepage = "https://kiln-ai.com" +repository = "https://github.com/Kiln-AI/kiln" + +[tool.poetry.dependencies] +python = ">=3.9" +kilnai = "*" + +[tool.poetry.dev-dependencies] +pytest = "^7.2.1" diff --git a/libs/studio/requirements.txt b/libs/studio/requirements.txt new file mode 100644 index 0000000..affde80 --- /dev/null +++ b/libs/studio/requirements.txt @@ -0,0 +1 @@ +-e ../core \ No newline at end of file diff --git a/libs/studio/setup.cfg b/libs/studio/setup.cfg new file mode 100644 index 0000000..661ccfa --- /dev/null +++ b/libs/studio/setup.cfg @@ -0,0 +1 @@ +# empty, but needed by setuptools \ No newline at end of file diff --git a/libs/studio/tests/test_import.py b/libs/studio/tests/test_import.py new file mode 100644 index 0000000..9182dbc --- /dev/null +++ b/libs/studio/tests/test_import.py @@ -0,0 +1,7 @@ +import kiln_studio.server as server +import kilnai.coreadd as coreadd + + +def test_import() -> None: + assert server.studio_path() != "" + assert coreadd.add(1, 1) == 3 diff --git a/requirements.txt b/requirements.txt index 40ab1df..83ad9e5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,6 +13,7 @@ mypy-extensions==1.0.0 ordered-set==4.1.0 pathspec==0.12.1 pipenv==2024.0.1 +pydantic==2.8.2 pycodestyle==2.12.1 pyinstaller==6.9.0 pystray==0.19.5 @@ -23,4 +24,5 @@ tomli==2.0.1 tomlkit==0.13.0 watchfiles==0.22.0 websockets==12.0 -hatch==1.12.0 \ No newline at end of file +hatch==1.12.0 +pytest==8.3.2 \ No newline at end of file diff --git a/src/core/__about__.py b/src/core/__about__.py deleted file mode 100644 index 3e94310..0000000 --- a/src/core/__about__.py +++ /dev/null @@ -1,2 +0,0 @@ -# SPDX-FileCopyrightText: 2024-present scosman -__version__ = "0.0.3" diff --git a/src/core/__init__.py b/src/core/__init__.py deleted file mode 100644 index 5caaa52..0000000 --- a/src/core/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# SPDX-FileCopyrightText: 2024-present scosman diff --git a/src/core/coreadd.py b/src/core/coreadd.py deleted file mode 100644 index a0aec19..0000000 --- a/src/core/coreadd.py +++ /dev/null @@ -1,3 +0,0 @@ -# TODO_P0: remove example function -def add(a, b): - return a + b diff --git a/src/studio/__about__.py b/src/studio/__about__.py deleted file mode 100644 index 893ab6c..0000000 --- a/src/studio/__about__.py +++ /dev/null @@ -1,2 +0,0 @@ -# SPDX-FileCopyrightText: 2024-present scosman -__version__ = "0.0.1" diff --git a/src/studio/__init__.py b/src/studio/__init__.py deleted file mode 100644 index 5caaa52..0000000 --- a/src/studio/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# SPDX-FileCopyrightText: 2024-present scosman From c70e339593895150b1389d82bf3a3aae432bf219 Mon Sep 17 00:00:00 2001 From: scosman Date: Sun, 18 Aug 2024 20:03:48 -0400 Subject: [PATCH 02/10] rename kilnai back to kiln_ai --- libs/{kiln_ai => core}/LICENSE.txt | 0 {core => libs/core}/README.md | 2 +- .../kilnai => core/kiln_ai}/__init.__.py | 0 libs/{kiln_ai/kilnai => core/kiln_ai}/coreadd.py | 2 +- .../kiln_ai}/datamodel/__init__.py | 0 .../kilnai => core/kiln_ai}/datamodel/project.py | 0 libs/{kiln_ai => core}/poetry.lock | 0 libs/{kiln_ai => core}/pyproject.toml | 7 +++++-- libs/{kiln_ai => core}/setup.cfg | 0 libs/{kiln_ai => core}/tests/test_project.py | 2 +- libs/studio/poetry.lock | 16 +++++++--------- libs/studio/pyproject.toml | 6 +++++- libs/studio/requirements.txt | 1 - libs/studio/tests/test_import.py | 4 ++-- requirements.txt | 4 ++-- 15 files changed, 24 insertions(+), 20 deletions(-) rename libs/{kiln_ai => core}/LICENSE.txt (100%) rename {core => libs/core}/README.md (94%) rename libs/{kiln_ai/kilnai => core/kiln_ai}/__init.__.py (100%) rename libs/{kiln_ai/kilnai => core/kiln_ai}/coreadd.py (73%) rename libs/{kiln_ai/kilnai => core/kiln_ai}/datamodel/__init__.py (100%) rename libs/{kiln_ai/kilnai => core/kiln_ai}/datamodel/project.py (100%) rename libs/{kiln_ai => core}/poetry.lock (100%) rename libs/{kiln_ai => core}/pyproject.toml (71%) rename libs/{kiln_ai => core}/setup.cfg (100%) rename libs/{kiln_ai => core}/tests/test_project.py (85%) delete mode 100644 libs/studio/requirements.txt diff --git a/libs/kiln_ai/LICENSE.txt b/libs/core/LICENSE.txt similarity index 100% rename from libs/kiln_ai/LICENSE.txt rename to libs/core/LICENSE.txt diff --git a/core/README.md b/libs/core/README.md similarity index 94% rename from core/README.md rename to libs/core/README.md index b02dfe5..885ce94 100644 --- a/core/README.md +++ b/libs/core/README.md @@ -12,5 +12,5 @@ ## Installation ```console -pip install kiln-ai +pip install kiln_ai ``` diff --git a/libs/kiln_ai/kilnai/__init.__.py b/libs/core/kiln_ai/__init.__.py similarity index 100% rename from libs/kiln_ai/kilnai/__init.__.py rename to libs/core/kiln_ai/__init.__.py diff --git a/libs/kiln_ai/kilnai/coreadd.py b/libs/core/kiln_ai/coreadd.py similarity index 73% rename from libs/kiln_ai/kilnai/coreadd.py rename to libs/core/kiln_ai/coreadd.py index 98b66f2..e81fb6b 100644 --- a/libs/kiln_ai/kilnai/coreadd.py +++ b/libs/core/kiln_ai/coreadd.py @@ -1,3 +1,3 @@ # TODO_P0: remove example function def add(a, b) -> int: - return a + b + 1 + return a + b diff --git a/libs/kiln_ai/kilnai/datamodel/__init__.py b/libs/core/kiln_ai/datamodel/__init__.py similarity index 100% rename from libs/kiln_ai/kilnai/datamodel/__init__.py rename to libs/core/kiln_ai/datamodel/__init__.py diff --git a/libs/kiln_ai/kilnai/datamodel/project.py b/libs/core/kiln_ai/datamodel/project.py similarity index 100% rename from libs/kiln_ai/kilnai/datamodel/project.py rename to libs/core/kiln_ai/datamodel/project.py diff --git a/libs/kiln_ai/poetry.lock b/libs/core/poetry.lock similarity index 100% rename from libs/kiln_ai/poetry.lock rename to libs/core/poetry.lock diff --git a/libs/kiln_ai/pyproject.toml b/libs/core/pyproject.toml similarity index 71% rename from libs/kiln_ai/pyproject.toml rename to libs/core/pyproject.toml index 87f3848..52e30fc 100644 --- a/libs/kiln_ai/pyproject.toml +++ b/libs/core/pyproject.toml @@ -3,8 +3,8 @@ requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" [tool.poetry] -name = "kilnai" -version = "0.0.3" +name = "kiln-ai" +version = "0.0.4" description = 'Kiln AI' authors = [ "Steve Cosman, Chesterfield Laboratories Inc ", @@ -12,7 +12,10 @@ authors = [ license = "Proprietary" homepage = "https://kiln-ai.com" repository = "https://github.com/Kiln-AI/kiln" +documentation = "https://github.com/Kiln-AI/kiln#readme" +[tool.poetry.urls] +"Bug Tracker" = "https://github.com/Kiln-AI/kiln/issues" [tool.poetry.dependencies] python = ">=3.9" diff --git a/libs/kiln_ai/setup.cfg b/libs/core/setup.cfg similarity index 100% rename from libs/kiln_ai/setup.cfg rename to libs/core/setup.cfg diff --git a/libs/kiln_ai/tests/test_project.py b/libs/core/tests/test_project.py similarity index 85% rename from libs/kiln_ai/tests/test_project.py rename to libs/core/tests/test_project.py index 180a914..60b4bcf 100644 --- a/libs/kiln_ai/tests/test_project.py +++ b/libs/core/tests/test_project.py @@ -3,7 +3,7 @@ def test_coreadd(): - assert coreadd.add(1, 1) == 3 + assert coreadd.add(1, 1) == 2 def test_project_init(): diff --git a/libs/studio/poetry.lock b/libs/studio/poetry.lock index 8510c5d..efbf3e8 100644 --- a/libs/studio/poetry.lock +++ b/libs/studio/poetry.lock @@ -37,17 +37,15 @@ files = [ ] [[package]] -name = "kilnai" +name = "kiln-ai" version = "0.0.3" description = "Kiln AI" optional = false -python-versions = "*" -files = [] -develop = true - -[package.source] -type = "directory" -url = "../kiln_ai" +python-versions = ">=3.8" +files = [ + {file = "kiln_ai-0.0.3-py3-none-any.whl", hash = "sha256:266630551c777f853d11b6a5e1e9982e4d52e1285d62002f3b4964c73c7f8b05"}, + {file = "kiln_ai-0.0.3.tar.gz", hash = "sha256:810964f7ab5d4695814b0d800aba62645aef69a1b4e6b79f9460509da1204b1f"}, +] [[package]] name = "packaging" @@ -111,4 +109,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = ">=3.9" -content-hash = "14aaa010f1cc147d5080335645797a86fffbe4443ce973f3e40272e1caffc3cd" +content-hash = "604195bebd9b13eb149a5b78114b1a56d02b30ff21411c7a3c7ded58a9a105d5" diff --git a/libs/studio/pyproject.toml b/libs/studio/pyproject.toml index 5c243cf..f3ccc04 100644 --- a/libs/studio/pyproject.toml +++ b/libs/studio/pyproject.toml @@ -12,10 +12,14 @@ authors = [ license = "Proprietary" homepage = "https://kiln-ai.com" repository = "https://github.com/Kiln-AI/kiln" +documentation = "https://github.com/Kiln-AI/kiln#readme" + +[tool.poetry.urls] +"Bug Tracker" = "https://github.com/Kiln-AI/kiln/issues" [tool.poetry.dependencies] python = ">=3.9" -kilnai = "*" +kiln-ai = "*" [tool.poetry.dev-dependencies] pytest = "^7.2.1" diff --git a/libs/studio/requirements.txt b/libs/studio/requirements.txt deleted file mode 100644 index affde80..0000000 --- a/libs/studio/requirements.txt +++ /dev/null @@ -1 +0,0 @@ --e ../core \ No newline at end of file diff --git a/libs/studio/tests/test_import.py b/libs/studio/tests/test_import.py index 9182dbc..ad6586b 100644 --- a/libs/studio/tests/test_import.py +++ b/libs/studio/tests/test_import.py @@ -1,7 +1,7 @@ import kiln_studio.server as server -import kilnai.coreadd as coreadd +import kiln_ai.coreadd as coreadd def test_import() -> None: assert server.studio_path() != "" - assert coreadd.add(1, 1) == 3 + assert coreadd.add(1, 1) == 2 diff --git a/requirements.txt b/requirements.txt index 83ad9e5..021fe2d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,5 +24,5 @@ tomli==2.0.1 tomlkit==0.13.0 watchfiles==0.22.0 websockets==12.0 -hatch==1.12.0 -pytest==8.3.2 \ No newline at end of file +pytest==8.3.2 +poetry==1.8.3 \ No newline at end of file From 8c87b0ed28b747be2442658de9e280eb04ffdc77 Mon Sep 17 00:00:00 2001 From: scosman Date: Sun, 18 Aug 2024 20:29:55 -0400 Subject: [PATCH 03/10] Monorepo improvements --- checks.sh | 18 ++++---- core/pyproject.toml | 67 ----------------------------- libs/core/pyproject.toml | 1 + libs/core/tests/test_project.py | 4 +- {studio => libs/studio}/README.md | 0 libs/studio/poetry.lock | 8 ++-- libs/studio/pyproject.toml | 1 + studio/pyproject.toml | 66 ---------------------------- studio/tests/test_studio_example.py | 10 ----- 9 files changed, 18 insertions(+), 157 deletions(-) delete mode 100644 core/pyproject.toml rename {studio => libs/studio}/README.md (100%) delete mode 100644 studio/pyproject.toml delete mode 100644 studio/tests/test_studio_example.py diff --git a/checks.sh b/checks.sh index a6330c2..9ce25e6 100755 --- a/checks.sh +++ b/checks.sh @@ -29,16 +29,18 @@ else fi echo "${headerStart}Checking Core: build, test${headerEnd}" -#cd core -#hatch build -#hatch test -#cd .. +cd libs/core +poetry install +python3 -m pytest tests/ +cd ../.. echo "${headerStart}Checking Studio: build, test${headerEnd}" -#cd studio -#hatch build -#hatch test -#cd .. +cd libs/studio +# note: don't install, or it will fetch pypi version of core instead of local +python3 -m pytest tests/ +cd ../.. + +# TODO test build? echo "${headerStart}Checking Types${headerEnd}" #cd src/core diff --git a/core/pyproject.toml b/core/pyproject.toml deleted file mode 100644 index 8c75027..0000000 --- a/core/pyproject.toml +++ /dev/null @@ -1,67 +0,0 @@ -[build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" - -[project] -name = "kiln_ai" -dynamic = ["version"] -description = 'Kiln AI' -readme = "README.md" -requires-python = ">=3.8" -license = {file = "../src/core/LICENSE.txt"} -keywords = [] -authors = [ - { name = "Steve Cosman, Chesterfield Laboratories Inc", email = "scosman@users.noreply.github.com" }, -] -classifiers = [ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", -] -dependencies = [] - -[tool.hatch.build.targets.sdist.force-include] -"../src/core" = "src/core" - -[tool.hatch.build.targets.wheel] -packages = ["src/core"] - -[project.urls] -Documentation = "https://github.com/Kiln-AI/kiln#readme" -Issues = "https://github.com/Kiln-AI/kiln/issues" -Source = "https://github.com/Kiln-AI/kiln" - -[tool.hatch.version] -path = "../src/core/__about__.py" - -[tool.hatch.envs.types] -extra-dependencies = [ - "mypy>=1.0.0", -] -[tool.hatch.envs.types.scripts] -check = "mypy --install-types --non-interactive {args:src/kiln_ai tests}" - -[tool.coverage.run] -source_pkgs = ["kiln_ai", "tests"] -branch = true -parallel = true -omit = [ - "src/kiln_ai/__about__.py", -] - -[tool.coverage.paths] -kiln_ai = ["src/kiln_ai", "*/kiln-ai/src/kiln_ai"] -tests = ["tests", "*/kiln-ai/tests"] - -[tool.coverage.report] -exclude_lines = [ - "no cov", - "if __name__ == .__main__.:", - "if TYPE_CHECKING:", -] diff --git a/libs/core/pyproject.toml b/libs/core/pyproject.toml index 52e30fc..391767a 100644 --- a/libs/core/pyproject.toml +++ b/libs/core/pyproject.toml @@ -5,6 +5,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "kiln-ai" version = "0.0.4" +readme = "README.md" description = 'Kiln AI' authors = [ "Steve Cosman, Chesterfield Laboratories Inc ", diff --git a/libs/core/tests/test_project.py b/libs/core/tests/test_project.py index 60b4bcf..aa9def4 100644 --- a/libs/core/tests/test_project.py +++ b/libs/core/tests/test_project.py @@ -1,5 +1,5 @@ -import kilnai.coreadd as coreadd -import kilnai.datamodel as datamodel +import kiln_ai.coreadd as coreadd +import kiln_ai.datamodel as datamodel def test_coreadd(): diff --git a/studio/README.md b/libs/studio/README.md similarity index 100% rename from studio/README.md rename to libs/studio/README.md diff --git a/libs/studio/poetry.lock b/libs/studio/poetry.lock index efbf3e8..a328b71 100644 --- a/libs/studio/poetry.lock +++ b/libs/studio/poetry.lock @@ -38,13 +38,13 @@ files = [ [[package]] name = "kiln-ai" -version = "0.0.3" +version = "0.0.4" description = "Kiln AI" optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "kiln_ai-0.0.3-py3-none-any.whl", hash = "sha256:266630551c777f853d11b6a5e1e9982e4d52e1285d62002f3b4964c73c7f8b05"}, - {file = "kiln_ai-0.0.3.tar.gz", hash = "sha256:810964f7ab5d4695814b0d800aba62645aef69a1b4e6b79f9460509da1204b1f"}, + {file = "kiln_ai-0.0.4-py3-none-any.whl", hash = "sha256:0b4720624b88e6f375115283630a7652cd1b549b55a27a38c2ad3eca20f9d52d"}, + {file = "kiln_ai-0.0.4.tar.gz", hash = "sha256:5b64de1296467d6187280d207a0797e98732180c0e8d0a2d024f0aa08513e382"}, ] [[package]] diff --git a/libs/studio/pyproject.toml b/libs/studio/pyproject.toml index f3ccc04..c8117c5 100644 --- a/libs/studio/pyproject.toml +++ b/libs/studio/pyproject.toml @@ -6,6 +6,7 @@ build-backend = "poetry.core.masonry.api" name = "kiln_studio" version = "0.0.1" description = 'Kiln Studio' +readme = "README.md" authors = [ "Steve Cosman, Chesterfield Laboratories Inc ", ] diff --git a/studio/pyproject.toml b/studio/pyproject.toml deleted file mode 100644 index 2c82681..0000000 --- a/studio/pyproject.toml +++ /dev/null @@ -1,66 +0,0 @@ -[build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" - -[project] -name = "kiln_studio" -dynamic = ["version"] -description = 'Kiln Studio' -readme = "README.md" -requires-python = ">=3.8" -license = { file = "../src/studio/LICENSE.txt" } -keywords = [] -authors = [ - { name = "scosman", email = "scosman@users.noreply.github.com" }, -] -classifiers = [ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", -] -dependencies = [] - -[tool.hatch.build.targets.sdist.force-include] -"../src/studio" = "src/studio" - -[tool.hatch.build.targets.wheel] -packages = ["src/studio"] - -[project.urls] -Documentation = "https://kiln-ai.com" -Issues = "https://github.com/Kiln-AI/kiln/issues" -Source = "https://github.com/Kiln-AI/kiln" -[tool.hatch.version] -path = "../src/studio/__about__.py" - -[tool.hatch.envs.types] -extra-dependencies = [ - "mypy>=1.0.0", -] -[tool.hatch.envs.types.scripts] -check = "mypy --install-types --non-interactive {args:src/studio tests}" - -[tool.coverage.run] -source_pkgs = ["studio", "tests"] -branch = true -parallel = true -omit = [ - "src/studio/__about__.py", -] - -[tool.coverage.paths] -studio = ["src/studio", "*/studio/src/studio"] -tests = ["tests", "*/studio/tests"] - -[tool.coverage.report] -exclude_lines = [ - "no cov", - "if __name__ == .__main__.:", - "if TYPE_CHECKING:", -] diff --git a/studio/tests/test_studio_example.py b/studio/tests/test_studio_example.py deleted file mode 100644 index 0740a97..0000000 --- a/studio/tests/test_studio_example.py +++ /dev/null @@ -1,10 +0,0 @@ -import unittest - - -class TestExample(unittest.TestCase): - def test_a(self): - self.assertEqual(42, 42) - - -if __name__ == "__main__": - unittest.main() From f9d1d3885c72673b730f05b1ca4a2682ab7891b4 Mon Sep 17 00:00:00 2001 From: scosman Date: Sun, 18 Aug 2024 20:36:30 -0400 Subject: [PATCH 04/10] CI fixes --- .github/workflows/build_and_test.yml | 30 ++++++++++++++++------------ checks.sh | 2 +- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 0fae296..5812a16 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -16,26 +16,30 @@ jobs: - run: pip install -r requirements.txt + - name: Install Core + run: poetry install + working-directory: ./libs/core + - name: Build Core - run: hatch build - working-directory: ./core + run: poetry build + working-directory: ./libs/core - name: Test Core - run: hatch test - working-directory: ./core + run: python3 -m pytest tests/ + working-directory: ./libs/core - - name: Check Types Core - run: mypy --install-types --non-interactive . - working-directory: ./src/core + - name: Test Studio + run: python3 -m pytest tests/ + working-directory: ./libs/studio - name: Build Studio - run: hatch build - working-directory: ./studio + run: poetry build + working-directory: ./libs/studio - - name: Test Studio - run: hatch test - working-directory: ./studio + - name: Check Types Core + run: mypy --install-types --non-interactive . + working-directory: ./libs/core - name: Check Types Studio run: mypy --install-types --non-interactive . - working-directory: ./src/studio + working-directory: ./libs/studio diff --git a/checks.sh b/checks.sh index 9ce25e6..d1686e8 100755 --- a/checks.sh +++ b/checks.sh @@ -43,7 +43,7 @@ cd ../.. # TODO test build? echo "${headerStart}Checking Types${headerEnd}" -#cd src/core +#cd libs/core #mypy --install-types --non-interactive . #cd ../studio #mypy --install-types --non-interactive . From 889a4fbc007329bd92c413d70168dbc756a612c6 Mon Sep 17 00:00:00 2001 From: scosman Date: Sun, 18 Aug 2024 20:43:35 -0400 Subject: [PATCH 05/10] Fix CI --- .github/workflows/build_and_test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 5812a16..da3cf94 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -28,6 +28,10 @@ jobs: run: python3 -m pytest tests/ working-directory: ./libs/core + # Remove this later: needed as server expects this dir to exist + - name: Mock Studio Web UI + run: mkdir -p ./src/web_ui/build + - name: Test Studio run: python3 -m pytest tests/ working-directory: ./libs/studio From adf7faecea0266c49d817e33e91aa4da535c1c1b Mon Sep 17 00:00:00 2001 From: scosman Date: Sun, 18 Aug 2024 20:53:09 -0400 Subject: [PATCH 06/10] Try explicit requirement --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 021fe2d..a3eff8d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,4 +25,5 @@ tomlkit==0.13.0 watchfiles==0.22.0 websockets==12.0 pytest==8.3.2 -poetry==1.8.3 \ No newline at end of file +poetry==1.8.3 +kiln-ai==0.0.4 From 487bee912838e675620eb7f25ced63839113b226 Mon Sep 17 00:00:00 2001 From: scosman Date: Sun, 18 Aug 2024 21:01:51 -0400 Subject: [PATCH 07/10] CI fixes --- .github/workflows/build_and_test.yml | 6 +++--- requirements.txt | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index da3cf94..449fb64 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -20,9 +20,9 @@ jobs: run: poetry install working-directory: ./libs/core - - name: Build Core - run: poetry build - working-directory: ./libs/core + #- name: Build Core + # run: poetry build + # working-directory: ./libs/core - name: Test Core run: python3 -m pytest tests/ diff --git a/requirements.txt b/requirements.txt index a3eff8d..bb31cad 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,4 +26,3 @@ watchfiles==0.22.0 websockets==12.0 pytest==8.3.2 poetry==1.8.3 -kiln-ai==0.0.4 From 5ff56c8758b74b93a337f499d306d029a3bdec00 Mon Sep 17 00:00:00 2001 From: scosman Date: Sun, 18 Aug 2024 21:05:08 -0400 Subject: [PATCH 08/10] Explicity install local kiln_ai dep --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 449fb64..dd8def8 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -33,7 +33,7 @@ jobs: run: mkdir -p ./src/web_ui/build - name: Test Studio - run: python3 -m pytest tests/ + run: pip install -e ../core && python3 -m pytest tests/ working-directory: ./libs/studio - name: Build Studio From 0f9e329b7c9ba22f5ebe7cfc044f46c6ed16ac0a Mon Sep 17 00:00:00 2001 From: scosman Date: Sun, 18 Aug 2024 21:07:48 -0400 Subject: [PATCH 09/10] Fix how we import local dependency on kiln_a- from studio --- .github/workflows/build_and_test.yml | 2 +- requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index dd8def8..449fb64 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -33,7 +33,7 @@ jobs: run: mkdir -p ./src/web_ui/build - name: Test Studio - run: pip install -e ../core && python3 -m pytest tests/ + run: python3 -m pytest tests/ working-directory: ./libs/studio - name: Build Studio diff --git a/requirements.txt b/requirements.txt index bb31cad..3853a8e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +-e libs/core astroid==3.2.4 backports.tarfile==1.2.0 dill==0.3.8 From e60332d637394b2d99f77291b4d958a63e8c9433 Mon Sep 17 00:00:00 2001 From: scosman Date: Sun, 18 Aug 2024 21:31:30 -0400 Subject: [PATCH 10/10] Add pyright for type checking and fix type errors. CI checked and working, as is checks.sh --- .github/workflows/build_and_test.yml | 10 +++++----- checks.sh | 12 +++++------- libs/core/kiln_ai/__init.__.py | 3 --- libs/core/pyproject.toml | 4 ++++ libs/studio/kiln_studio/server.py | 4 ++-- libs/studio/pyproject.toml | 4 ++++ requirements.txt | 3 +-- 7 files changed, 21 insertions(+), 19 deletions(-) delete mode 100644 libs/core/kiln_ai/__init.__.py diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 449fb64..365f5da 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -20,9 +20,9 @@ jobs: run: poetry install working-directory: ./libs/core - #- name: Build Core - # run: poetry build - # working-directory: ./libs/core + - name: Build Core + run: poetry build + working-directory: ./libs/core - name: Test Core run: python3 -m pytest tests/ @@ -41,9 +41,9 @@ jobs: working-directory: ./libs/studio - name: Check Types Core - run: mypy --install-types --non-interactive . + run: pyright . working-directory: ./libs/core - name: Check Types Studio - run: mypy --install-types --non-interactive . + run: pyright . working-directory: ./libs/studio diff --git a/checks.sh b/checks.sh index d1686e8..5faf088 100755 --- a/checks.sh +++ b/checks.sh @@ -40,11 +40,9 @@ cd libs/studio python3 -m pytest tests/ cd ../.. -# TODO test build? - echo "${headerStart}Checking Types${headerEnd}" -#cd libs/core -#mypy --install-types --non-interactive . -#cd ../studio -#mypy --install-types --non-interactive . -#cd ../.. +cd libs/core +pyright . +cd ../studio +pyright . +cd ../.. diff --git a/libs/core/kiln_ai/__init.__.py b/libs/core/kiln_ai/__init.__.py deleted file mode 100644 index 7d1d66f..0000000 --- a/libs/core/kiln_ai/__init.__.py +++ /dev/null @@ -1,3 +0,0 @@ -import coreadd - -__all__ = ["coreadd"] diff --git a/libs/core/pyproject.toml b/libs/core/pyproject.toml index 391767a..e5025eb 100644 --- a/libs/core/pyproject.toml +++ b/libs/core/pyproject.toml @@ -23,3 +23,7 @@ python = ">=3.9" [tool.poetry.dev-dependencies] pytest = "^7.2" + +[tool.pyright] +strictListInference = true +reportMissingTypeArgument = true diff --git a/libs/studio/kiln_studio/server.py b/libs/studio/kiln_studio/server.py index 53f64b6..3fc56e6 100644 --- a/libs/studio/kiln_studio/server.py +++ b/libs/studio/kiln_studio/server.py @@ -12,7 +12,7 @@ # TODO would rather this get passed. This class shouldn't know about desktop def studio_path(): try: - base_path = sys._MEIPASS + base_path = sys._MEIPASS # type: ignore except Exception: base_path = os.path.join(os.path.dirname(__file__), "..") @@ -38,7 +38,7 @@ def load_settings(): @app.post("/setting") -def update_settings(new_settings: dict): +def update_settings(new_settings: dict[str, int | float | str | bool]): settings = load_settings() settings.update(new_settings) with open(settings_path(), "w") as f: diff --git a/libs/studio/pyproject.toml b/libs/studio/pyproject.toml index c8117c5..6980ffc 100644 --- a/libs/studio/pyproject.toml +++ b/libs/studio/pyproject.toml @@ -24,3 +24,7 @@ kiln-ai = "*" [tool.poetry.dev-dependencies] pytest = "^7.2.1" + +[tool.pyright] +reportMissingTypeArgument = true +strictListInference = true diff --git a/requirements.txt b/requirements.txt index 3853a8e..be38177 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,8 +9,6 @@ importlib-resources==6.4.0 isort==5.13.2 jaraco.text==3.12.1 mccabe==0.7.0 -mypy==1.11.1 -mypy-extensions==1.0.0 ordered-set==4.1.0 pathspec==0.12.1 pipenv==2024.0.1 @@ -27,3 +25,4 @@ watchfiles==0.22.0 websockets==12.0 pytest==8.3.2 poetry==1.8.3 +pyright==1.1.376