Skip to content
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

feat(mdk): mdk python #707

Merged
merged 5 commits into from
May 22, 2024
Merged

feat(mdk): mdk python #707

merged 5 commits into from
May 22, 2024

Conversation

michael-0acf4
Copy link
Contributor

@michael-0acf4 michael-0acf4 commented May 3, 2024

Mdk for python runtime

Migration notes

None

Summary by CodeRabbit

  • New Features

    • Introduced new functionalities for generating Python code based on configurations, including handling of templates and required objects.
    • Added Python script templates for defining typed functions and structured objects with comprehensive data type handling.
    • Enhanced type management and priority handling in utility functions.
  • Documentation

    • Provided detailed summaries and documentation for new functionalities and templates.
  • Refactor

    • Implemented new structures and methods for efficient code generation and type handling.
  • Tests

    • Added tests for defining typegraph structures and policies in Python.
  • Chores

    • Updated URLs in the .ghjk/deno.lock file to reflect new changes in the codebase.

Copy link

linear bot commented May 3, 2024

MET-491 (mdk) python

@michael-0acf4
Copy link
Contributor Author

michael-0acf4 commented May 3, 2024

I ended up using class approach

Example output
scripts/example.py (entry point)

from .example_types import Output, Object26, typed_duplicate, Input, typed_add, TypeAddResult


@typed_duplicate
def duplicate(inp: Input) -> Output:
    # TODO: write your logic here
    raise Exception("duplicate not implemented")

@typed_add
def add(inp: Object26) -> TypeAddResult:
    # TODO: write your logic here
    raise Exception("add not implemented")

scripts/example_types.py

from types import NoneType
from typing import Callable, List, Union, get_origin, ForwardRef
from dataclasses import dataclass, asdict, fields

FORWARD_REFS = {}

class Struct:
    def try_new(dt_class, val: any):
        # Object
        ftypes = {f.name: f.type for f in fields(dt_class)}
        attrs = {}
        for f in val:
            fval = val[f]
            ftype = ftypes[f]
            serialized = False
            # Union
            if get_origin(ftype) is Union:
                try:
                    attrs[f] = Struct.try_union(ftype.__args__, fval)
                    serialized = True
                except Exception as _e:
                    pass
            # List
            elif get_origin(ftype) is list:
                try:
                    attrs[f] = Struct.try_typed_list(ftype.__args__, fval)
                    serialized = True
                except Exception as _e:
                    pass
            # Any
            if not serialized:
                if type(ftype) is str and ftype in FORWARD_REFS:
                    klass = FORWARD_REFS[ftype]
                    attrs[f] = Struct.new(klass, fval)
                else:
                    attrs[f] = Struct.new(ftype, fval)
        return dt_class(**attrs)

    def try_typed_list(tpe: any, items: any):
        hint = tpe.__args__[0]
        klass = FORWARD_REFS[hint.__forward_arg__] if type(hint) is ForwardRef else hint
        return [Struct.new(klass, v) for v in items]

    def try_union(variants: List[any], val: any):
        errors = []
        for variant in variants:
            try:
                if variant is NoneType:
                    if val is None:
                        return None
                    else:
                        continue
                if get_origin(variant) is list:
                    if type(val) is list:
                        return Struct.try_typed_list(variant, val)
                    else:
                        continue
                klass = FORWARD_REFS[variant.__forward_arg__]
                return Struct.try_new(klass, val)
            except Exception as e:
                errors.append(str(e))
        raise Exception("\n".join(errors))


    def new(dt_class: any, val: any):
        try:
            return Struct.try_new(dt_class, val)
        except:
            return val

    def repr(self):
        return asdict(self)


@dataclass
class Input(Struct):
    string: str
    integer: int
    email: Union[str, None]
    list_integer: List[int]
    opt_union_flat: Union[Union[float, int], None]
    reference: Union[List['References'], None]
    self: Union[List['Example'], None]
    

FORWARD_REFS['Input'] = Input

@dataclass
class References(Struct):
    string: str
    example: Union['Example', None]
    

FORWARD_REFS['References'] = References

@dataclass
class Example(Struct):
    string: str
    integer: int
    email: Union[str, None]
    list_integer: List[int]
    opt_union_flat: Union[Union[int, float], None]
    reference: Union[List['References'], None]
    self: Union[List['Example'], None]
    

FORWARD_REFS['Example'] = Example

@dataclass
class Output(Struct):
    string: str
    integer: int
    email: Union[str, None]
    list_integer: List[int]
    opt_union_flat: Union[Union[float, int], None]
    reference: Union[List['References'], None]
    self: Union[List['Example'], None]
    

FORWARD_REFS['Output'] = Output

@dataclass
class Object26(Struct):
    a: int
    b: int
    

FORWARD_REFS['Object26'] = Object26

TypeAddResult = int


def __repr(value: any):
        if isinstance(value, Struct):
            return value.repr()
        return value


def typed_duplicate(user_fn: Callable[[Input], Output]):
    def exported_wrapper(raw_inp):
        inp: Input = Struct.new(Input, raw_inp)
        out: Output = user_fn(inp)
        if type(out) is list:
            return [__repr(v) for v in out]
        return __repr(out)
    return exported_wrapper

def typed_add(user_fn: Callable[[Object26], TypeAddResult]):
    def exported_wrapper(raw_inp):
        inp: Object26 = Struct.new(Object26, raw_inp)
        out: TypeAddResult = user_fn(inp)
        if type(out) is list:
            return [__repr(v) for v in out]
        return __repr(out)
    return exported_wrapper

typegraph.py

from typegraph import typegraph, Policy, t, Graph
from typegraph.runtimes.python import PythonRuntime


@typegraph()
def example(g: Graph):
    references = t.struct(
        {"string": t.string(), "example": g.ref("Example").optional()},
        name="References",
    )
    example = t.struct(
        {
            "string": t.string(),
            "integer": t.integer(),
            "email": t.email().optional(),
            "list_integer": t.list(t.integer()),
            "opt_union_flat": t.union([t.integer(), t.integer(), t.float()]).optional(),
            "reference": t.list(references).optional(),
            "self": t.list(g.ref("Example")).optional(),
        },
        name="Example",
    )
    python = PythonRuntime()
    pub = Policy.public()
    g.expose(
        pub,
        duplicate=python.import_(
            example.rename("Input"),
            example.rename("Output"),
            name="duplicate",
            module="scripts/example.py",
        ),
        add=python.import_(
            t.struct({"a": t.integer(), "b": t.integer() }),
            t.integer().rename("AddResult"),
            name="add",
            module="scripts/example.py",
        ),
    )

Copy link
Member

@zifeo zifeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

libs/metagen/Cargo.toml Show resolved Hide resolved
libs/metagen/src/mdk_python/static/main.py.jinja Outdated Show resolved Hide resolved
libs/metagen/src/mdk_python/static/main.py.jinja Outdated Show resolved Hide resolved
libs/metagen/Cargo.toml Show resolved Hide resolved
@zifeo
Copy link
Member

zifeo commented May 5, 2024

@CodiumAI-Agent /review

@CodiumAI-Agent
Copy link

PR Review 🔍

⏱️ Estimated effort to review [1-5]

4, due to the complexity and size of the PR, which includes multiple new modules, complex logic, and integration with existing systems. The PR introduces a new Python generator and modifies the core generator handling logic, requiring careful review to ensure correctness and maintainability.

🧪 Relevant tests

No

⚡ Possible issues

Possible Bug: The GeneratorHandler struct and its method handle might not correctly handle errors from the generator functions. The current implementation directly calls the function and returns its result, but there is no error handling or logging in case of failures.

Performance Concern: The generate_target function now iterates over all generators to find a match for each generation request. This could be inefficient if the list of generators grows large.

🔒 Security concerns

No

Code feedback:
relevant filelibs/metagen/src/lib.rs
suggestion      

Consider implementing error handling or logging within the GeneratorHandler::handle method to improve reliability and debuggability. [important]

relevant line(*self.f)(value)

relevant filelibs/metagen/src/lib.rs
suggestion      

Optimize the generator lookup in generate_target by using a HashMap or another efficient data structure to map generator names to their handlers, instead of iterating over a list. [important]

relevant line.find(|g| g.name.eq(gen_name))

relevant filelibs/metagen/src/mdk_python/mod.rs
suggestion      

Add error handling for potential failures in the new method of PythonGenerator, especially considering the validation of configuration which might throw errors. [important]

relevant lineconfig.validate(&())?;

relevant filelibs/metagen/src/mdk_python/mod.rs
suggestion      

Consider adding more specific error messages or custom error types to improve the debugging experience and error traceability in the visit_type function. [medium]

relevant line_ => bail!("Unsupported type {:?}", tpe.type_name()),

Copy link
Contributor

coderabbitai bot commented May 6, 2024

Walkthrough

The recent updates across various modules enhance Python code generation capabilities, introduce new type handling functionalities, and improve type prioritization mechanisms. These changes include the addition of new structures and methods across Rust and Python files, aimed at better configuration management, dynamic type generation, and efficient template rendering for Python code generation.

Changes

File Path Change Summary
.../mdk_python/mod.rs Added configurations, generator struct, and methods for Python code generation.
.../mdk_python/static/main.py.jinja Introduced typed function templates in Python.
.../mdk_python/static/types.py.jinja Enhanced Struct class for advanced type handling.
.../mdk_python/utils.rs Developed utilities for managing type generation and prioritization.
typegate/tests/metagen/typegraphs/python.py Added functionality for defining typegraphs with specified structures.
.ghjk/deno.lock Updated URLs for various TypeScript modules.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot]
coderabbitai bot previously approved these changes May 6, 2024
Copy link

codecov bot commented May 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.85%. Comparing base (24963ce) to head (ad5fada).
Report is 1 commits behind head on main.

Current head ad5fada differs from pull request most recent head 6fe428a

Please upload reports for the commit 6fe428a to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #707      +/-   ##
==========================================
+ Coverage   73.52%   73.85%   +0.32%     
==========================================
  Files         120      120              
  Lines       14142    13777     -365     
  Branches     1416     1393      -23     
==========================================
- Hits        10398    10175     -223     
+ Misses       3717     3576     -141     
+ Partials       27       26       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

coderabbitai[bot]
coderabbitai bot previously approved these changes May 7, 2024
@michael-0acf4 michael-0acf4 marked this pull request as ready for review May 7, 2024 20:02
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

libs/metagen/src/mdk_python/static/main.py.jinja Outdated Show resolved Hide resolved
libs/metagen/src/mdk_python/static/types.py.jinja Outdated Show resolved Hide resolved
libs/metagen/src/mdk_python/utils.rs Outdated Show resolved Hide resolved
libs/metagen/src/mdk_python/types.rs Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Out of diff range and nitpick comments (1)
typegate/tests/metagen/typegraphs/python.py (1)

5-35: Ensure consistent naming conventions and type definitions.

The type definitions and the structure of the typegraph are well-defined. However, consider using more descriptive names for the types and variables to enhance readability and maintainability.

typegate/tests/metagen/typegraphs/python.py Outdated Show resolved Hide resolved
Yohe-Am
Yohe-Am previously approved these changes May 7, 2024
Copy link
Contributor

@Yohe-Am Yohe-Am left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would love a demo for this but looking good. Curious how you'll tackle re-generation for the user modified files.

libs/metagen/src/lib.rs Outdated Show resolved Hide resolved
libs/metagen/src/mdk_python/utils.rs Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

libs/metagen/src/mdk_python/mod.rs Outdated Show resolved Hide resolved
libs/metagen/src/mdk_python/mod.rs Outdated Show resolved Hide resolved
libs/metagen/src/mdk_python/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

libs/metagen/src/mdk_python/mod.rs Show resolved Hide resolved
@michael-0acf4 michael-0acf4 requested a review from Yohe-Am May 8, 2024 18:31
Copy link
Contributor

@Yohe-Am Yohe-Am left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful. Some comments but not blocking and feel free to merge.

libs/metagen/src/mdk_python/mod.rs Show resolved Hide resolved
libs/metagen/src/mdk_python/mod.rs Show resolved Hide resolved
@Yohe-Am
Copy link
Contributor

Yohe-Am commented May 8, 2024

Oh man. Am I glad to see the test-full timeout happening on this PR as well. I was loosing hair over here thinking it was the deadlock bug.

@Yohe-Am
Copy link
Contributor

Yohe-Am commented May 8, 2024

Looks like something wrong with serialization of python modules looking at the logs of runs on both PRs.

zifeo
zifeo previously approved these changes May 17, 2024
Copy link
Member

@zifeo zifeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Yohe-Am added a commit that referenced this pull request May 22, 2024
Expose metagen features to `typegraph/sdk`

Depends on #707 and #696

#### Migration notes

None

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced new `Metagen` class for code generation tasks in both
TypeScript and Python SDKs.
- Added functionality for defining policies and structures for
deployment examples using Node.js.

- **Improvements**
- Enhanced `Metagen` class with methods for simulating and executing
code generation tasks.
- Simplified file reading and writing functions for better performance
and maintainability.

- **Bug Fixes**
- Refined `compress_and_encode` function to streamline file handling
processes.

- **Tests**
- Added comprehensive tests for `Metagen` functionality in both
TypeScript and Python SDKs.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Teo Stocco <zifeo@users.noreply.github.com>
Co-authored-by: Teo Stocco <teo@zifeo.com>
Co-authored-by: Teo Stocco <zifeo@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Estifanos Bireda <77430541+destifo@users.noreply.github.com>
Co-authored-by: Yohe-Am <56622350+Yohe-Am@users.noreply.github.com>
Yohe-Am added a commit that referenced this pull request May 22, 2024
wip: python mdk

feat: represent union, either with Union

feat: solve cycles, order python types by priority

fix: self-reference

fix: premature checks

docs: add a comparison b/n metatype and other similar solutions/products. (#697)

<!--
Pull requests are squash merged using:
- their title as the commit message
- their description as the commit body

Having a good title and description is important for the users to get
readable changelog.
-->

<!-- 1. Explain below WHAT the change is -->
- Adds a comparison table between metatype and other similar services.
- Add artifact upload protocol to `Architecture` section in docs.

<!-- 2. Explain below WHY the change cannot be made simpler -->

<!-- 3. Explain below WHY the was made or link an issue number -->

[MET-443](https://linear.app/metatypedev/issue/MET-443/include-comparisons-with-other-products-similar-to-metatype)

<!-- 4. Explain HOW users should update their code or remove that
section -->

_No Migration Needed_

<!-- 5. Readiness checklist
- [ ] The change come with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change
-->

refactor(gate): wasi 0.2 pyrt (#687)

- Rewrites the PythonRuntime host using a `componentize-py` based
component.
- Leaf through this
[memo](https://hackmd.io/@SC-qT-WXTROceKYdNA-Lpg/ryyAXiQlC/edit) for a
mental model.

Todo:
- [x] `PythonRuntime.import_` support #699
- [x] ~~Add `pyrt.wasm` to release job~~ obviated by `build.rs`

Items for other PRs:
- Implemen `hostcall`

MET-404.

_No end-user changes required_

- [x] The change come with new or modified tests
- [x] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change

---------

Co-authored-by: afmika <afmichael73@gmail.com>

cleanups

fix: pre-commit

fix: forward-refs

fix: top level simple types

test(metagen): python mdk

cleanups and small fixes

feat(metagen): codegen decorator and some cleanups

feat(metagen): always merge defs if refered file is the same

fix(metagen): prioritize relto typegraph path only if base.path is empty

feat: Artifact removal (#668)

- Add GC: remove artifacts when unreferenced by any deployed typegraph
- Improve resource management: use `AsyncDisposable` and
`AsyncDisposableStack`
- Improve testability (for parallel testing): always read the tmpDir
config from the `Typegate` object

[MET-433](https://linear.app/metatypedev/issue/MET-433/file-removal)

_N/A_

- [x] The change come with new or modified tests
- [x] Hard-to-understand functions have explanatory comments
- [x] End-user documentation is updated to reflect the change

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **New Features**
  - Enhanced search functionality with the addition of a new search bar.
  - Introduced new test configurations to improve script execution.
- Updated artifact storage documentation to clarify management
processes.
  - Added new extensions to support improved code commenting.

- **Bug Fixes**
- Removed outdated Deno import mapping settings to streamline
development environment setup.

- **Documentation**
- Expanded documentation on artifact tracking and management, including
reference counting and garbage collection mechanisms.

- **Refactor**
- Implemented interface changes in `QueryEngine` for better async
disposal management.
- Code restructuring in artifact management for enhanced performance and
maintainability.

- **Chores**
- Adjusted settings and configurations in the development environment to
align with current best practices.

- **Tests**
- Introduced new test cases for artifact upload and management
functionalities.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Natoandro <anatoandro@hotmail.com>
Co-authored-by: destifo <estifanosbireda@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

chore(release): prepare 0.4.0 (#710)

Bumps version to release 0.4.0.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **New Features**
- Updated the software across various components to version 0.4.0,
enhancing functionality and potentially introducing new features or
fixes.
- **Documentation**
- Updated version documentation in multiple configuration files to
reflect new version 0.4.0.
- **Bug Fixes**
- Adjusted version constants and dependencies to ensure compatibility
and stability with the new software version 0.4.0.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Natoandro <anatoandro@hotmail.com>

chore(docs): final polish to comparison table. (#709)

some changes to comparison table(docs)

_No Migrations Needed_

<!-- 5. Readiness checklist
- [ ] The change come with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change
-->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **Documentation**
- Introduced a new section on Artifact Tracking Protocol in the
architecture documentation, explaining artifact classification and
tracking modes in Metatype.
- Updated comparisons documentation with additional platforms, criteria
for choosing Metatype, and detailed feature comparison tables.
- Renamed project directory for clarity and consistency in project setup
documentation.
- **Bug Fixes**
  - Removed outdated `TODO` comment in installation documentation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

chore: bump to version 0.4.1-0 (#713)

- Bumps version to 0.4.1-0.
- Fixes broken release CI.
- #719
- Adds 20 minutes to test-full timeout.

<!-- 5. Readiness checklist
- [ ] The change come with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change
-->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **New Features**
- Updated platform support for better compatibility with "x86_64-linux".

- **Bug Fixes**
- Minor version updates across multiple configurations to enhance
stability.

- **Chores**
- Updated version numbers from "0.4.0" to "0.4.1-0" across various files
and configurations.

- **Refactor**
- Adjusted build and test scripts for improved efficiency and
compatibility.

- **Documentation**
- Enhanced internal documentation to reflect version and platform
changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Yohe-Am <56622350+Yohe-Am@users.noreply.github.com>

feat: polish documentation and project (#696)

<!--
Pull requests are squash merged using:
- their title as the commit message
- their description as the commit body

Having a good title and description is important for the users to get
readable changelog.
-->

<!-- 1. Explain below WHAT the change is -->

- update the headline, the overviews and many other documentation areas
- upgrades the dependencies.

<!-- 2. Explain below WHY the change cannot be made simpler -->

<!-- 4. Explain HOW users should update their code or remove that
section -->

- [ ] The change come with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [x] End-user documentation is updated to reflect the change

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **Bug Fixes**
- Updated Docker image version for the `typegate` service to ensure
stability and compatibility.

- **Documentation**
- Revised `TAGLINE` for better clarity on supported languages: WASM,
Typescript, and Python.
- Updated version declarations for improved consistency and
functionality across multiple files.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Teo Stocco <zifeo@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

feat(sdk): expose metagen to `typegraph/sdk` (#718)

Expose metagen features to `typegraph/sdk`

Depends on #707 and #696

None

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **New Features**
- Introduced new `Metagen` class for code generation tasks in both
TypeScript and Python SDKs.
- Added functionality for defining policies and structures for
deployment examples using Node.js.

- **Improvements**
- Enhanced `Metagen` class with methods for simulating and executing
code generation tasks.
- Simplified file reading and writing functions for better performance
and maintainability.

- **Bug Fixes**
- Refined `compress_and_encode` function to streamline file handling
processes.

- **Tests**
- Added comprehensive tests for `Metagen` functionality in both
TypeScript and Python SDKs.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Teo Stocco <zifeo@users.noreply.github.com>
Co-authored-by: Teo Stocco <teo@zifeo.com>
Co-authored-by: Teo Stocco <zifeo@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Estifanos Bireda <77430541+destifo@users.noreply.github.com>
Co-authored-by: Yohe-Am <56622350+Yohe-Am@users.noreply.github.com>
@Yohe-Am Yohe-Am force-pushed the met-491-mdk-python branch from 057d97a to 9ffe44d Compare May 22, 2024 16:19
wip: python mdk

feat: represent union, either with Union

feat: solve cycles, order python types by priority

fix: self-reference

fix: premature checks

docs: add a comparison b/n metatype and other similar solutions/products. (#697)

<!--
Pull requests are squash merged using:
- their title as the commit message
- their description as the commit body

Having a good title and description is important for the users to get
readable changelog.
-->

<!-- 1. Explain below WHAT the change is -->
- Adds a comparison table between metatype and other similar services.
- Add artifact upload protocol to `Architecture` section in docs.

<!-- 2. Explain below WHY the change cannot be made simpler -->

<!-- 3. Explain below WHY the was made or link an issue number -->

[MET-443](https://linear.app/metatypedev/issue/MET-443/include-comparisons-with-other-products-similar-to-metatype)

<!-- 4. Explain HOW users should update their code or remove that
section -->

_No Migration Needed_

<!-- 5. Readiness checklist
- [ ] The change come with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change
-->

refactor(gate): wasi 0.2 pyrt (#687)

- Rewrites the PythonRuntime host using a `componentize-py` based
component.
- Leaf through this
[memo](https://hackmd.io/@SC-qT-WXTROceKYdNA-Lpg/ryyAXiQlC/edit) for a
mental model.

Todo:
- [x] `PythonRuntime.import_` support #699
- [x] ~~Add `pyrt.wasm` to release job~~ obviated by `build.rs`

Items for other PRs:
- Implemen `hostcall`

MET-404.

_No end-user changes required_

- [x] The change come with new or modified tests
- [x] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change

---------

Co-authored-by: afmika <afmichael73@gmail.com>

cleanups

fix: pre-commit

fix: forward-refs

fix: top level simple types

test(metagen): python mdk

cleanups and small fixes

feat(metagen): codegen decorator and some cleanups

feat(metagen): always merge defs if refered file is the same

fix(metagen): prioritize relto typegraph path only if base.path is empty

feat: Artifact removal (#668)

- Add GC: remove artifacts when unreferenced by any deployed typegraph
- Improve resource management: use `AsyncDisposable` and
`AsyncDisposableStack`
- Improve testability (for parallel testing): always read the tmpDir
config from the `Typegate` object

[MET-433](https://linear.app/metatypedev/issue/MET-433/file-removal)

_N/A_

- [x] The change come with new or modified tests
- [x] Hard-to-understand functions have explanatory comments
- [x] End-user documentation is updated to reflect the change

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **New Features**
  - Enhanced search functionality with the addition of a new search bar.
  - Introduced new test configurations to improve script execution.
- Updated artifact storage documentation to clarify management
processes.
  - Added new extensions to support improved code commenting.

- **Bug Fixes**
- Removed outdated Deno import mapping settings to streamline
development environment setup.

- **Documentation**
- Expanded documentation on artifact tracking and management, including
reference counting and garbage collection mechanisms.

- **Refactor**
- Implemented interface changes in `QueryEngine` for better async
disposal management.
- Code restructuring in artifact management for enhanced performance and
maintainability.

- **Chores**
- Adjusted settings and configurations in the development environment to
align with current best practices.

- **Tests**
- Introduced new test cases for artifact upload and management
functionalities.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Natoandro <anatoandro@hotmail.com>
Co-authored-by: destifo <estifanosbireda@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

chore(release): prepare 0.4.0 (#710)

Bumps version to release 0.4.0.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **New Features**
- Updated the software across various components to version 0.4.0,
enhancing functionality and potentially introducing new features or
fixes.
- **Documentation**
- Updated version documentation in multiple configuration files to
reflect new version 0.4.0.
- **Bug Fixes**
- Adjusted version constants and dependencies to ensure compatibility
and stability with the new software version 0.4.0.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Natoandro <anatoandro@hotmail.com>

chore(docs): final polish to comparison table. (#709)

some changes to comparison table(docs)

_No Migrations Needed_

<!-- 5. Readiness checklist
- [ ] The change come with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change
-->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **Documentation**
- Introduced a new section on Artifact Tracking Protocol in the
architecture documentation, explaining artifact classification and
tracking modes in Metatype.
- Updated comparisons documentation with additional platforms, criteria
for choosing Metatype, and detailed feature comparison tables.
- Renamed project directory for clarity and consistency in project setup
documentation.
- **Bug Fixes**
  - Removed outdated `TODO` comment in installation documentation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

chore: bump to version 0.4.1-0 (#713)

- Bumps version to 0.4.1-0.
- Fixes broken release CI.
- #719
- Adds 20 minutes to test-full timeout.

<!-- 5. Readiness checklist
- [ ] The change come with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change
-->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **New Features**
- Updated platform support for better compatibility with "x86_64-linux".

- **Bug Fixes**
- Minor version updates across multiple configurations to enhance
stability.

- **Chores**
- Updated version numbers from "0.4.0" to "0.4.1-0" across various files
and configurations.

- **Refactor**
- Adjusted build and test scripts for improved efficiency and
compatibility.

- **Documentation**
- Enhanced internal documentation to reflect version and platform
changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Yohe-Am <56622350+Yohe-Am@users.noreply.github.com>

feat: polish documentation and project (#696)

<!--
Pull requests are squash merged using:
- their title as the commit message
- their description as the commit body

Having a good title and description is important for the users to get
readable changelog.
-->

<!-- 1. Explain below WHAT the change is -->

- update the headline, the overviews and many other documentation areas
- upgrades the dependencies.

<!-- 2. Explain below WHY the change cannot be made simpler -->

<!-- 4. Explain HOW users should update their code or remove that
section -->

- [ ] The change come with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [x] End-user documentation is updated to reflect the change

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **Bug Fixes**
- Updated Docker image version for the `typegate` service to ensure
stability and compatibility.

- **Documentation**
- Revised `TAGLINE` for better clarity on supported languages: WASM,
Typescript, and Python.
- Updated version declarations for improved consistency and
functionality across multiple files.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Teo Stocco <zifeo@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

feat(sdk): expose metagen to `typegraph/sdk` (#718)

Expose metagen features to `typegraph/sdk`

Depends on #707 and #696

None

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **New Features**
- Introduced new `Metagen` class for code generation tasks in both
TypeScript and Python SDKs.
- Added functionality for defining policies and structures for
deployment examples using Node.js.

- **Improvements**
- Enhanced `Metagen` class with methods for simulating and executing
code generation tasks.
- Simplified file reading and writing functions for better performance
and maintainability.

- **Bug Fixes**
- Refined `compress_and_encode` function to streamline file handling
processes.

- **Tests**
- Added comprehensive tests for `Metagen` functionality in both
TypeScript and Python SDKs.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Teo Stocco <zifeo@users.noreply.github.com>
Co-authored-by: Teo Stocco <teo@zifeo.com>
Co-authored-by: Teo Stocco <zifeo@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Estifanos Bireda <77430541+destifo@users.noreply.github.com>
Co-authored-by: Yohe-Am <56622350+Yohe-Am@users.noreply.github.com>
@Yohe-Am Yohe-Am force-pushed the met-491-mdk-python branch from 9ffe44d to 7d9106e Compare May 22, 2024 17:13
destifo
destifo previously approved these changes May 22, 2024
@Yohe-Am Yohe-Am enabled auto-merge (squash) May 22, 2024 23:37
@Yohe-Am Yohe-Am merged commit 1f2f7ce into main May 22, 2024
5 of 11 checks passed
@Yohe-Am Yohe-Am deleted the met-491-mdk-python branch May 22, 2024 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants