From b4055908347a04e160b52b754923c7a482f7b737 Mon Sep 17 00:00:00 2001 From: 8ball030 <8baller@station.codes> Date: Sun, 13 Oct 2024 15:33:55 +0000 Subject: [PATCH 1/4] feat:ensured-nix-compatibility --- .../data/repo/templates/autonomy/install.sh | 2 +- .../autonomy/pyproject.toml.template | 2 +- auto_dev/protocols/scaffolder.py | 188 +++++++++++--- auto_dev/test.py | 29 +-- poetry.lock | 238 +++++++++--------- 5 files changed, 294 insertions(+), 165 deletions(-) diff --git a/auto_dev/data/repo/templates/autonomy/install.sh b/auto_dev/data/repo/templates/autonomy/install.sh index 550a5a7f..ca8f4f86 100755 --- a/auto_dev/data/repo/templates/autonomy/install.sh +++ b/auto_dev/data/repo/templates/autonomy/install.sh @@ -137,7 +137,7 @@ function install_poetry_deps() { echo "Installing package dependencies via poetry..." echo "Using poetry executable: $poetry_executable" - poetry install > /dev/null || exit 1 + poetry install --no-root > /dev/null || exit 1 echo "Checking if aea is installed" poetry run aea --version echo "Done installing dependencies" diff --git a/auto_dev/data/repo/templates/autonomy/pyproject.toml.template b/auto_dev/data/repo/templates/autonomy/pyproject.toml.template index 748798da..86646f56 100644 --- a/auto_dev/data/repo/templates/autonomy/pyproject.toml.template +++ b/auto_dev/data/repo/templates/autonomy/pyproject.toml.template @@ -15,6 +15,7 @@ classifiers = [ 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', ] +packages = [{{ include = "packages", from = "" }},] [tool.poetry.dependencies] python = ">=3.9,<3.12" @@ -28,7 +29,6 @@ open-aea-test-autonomy = "==0.16.1" open-autonomy = "==0.16.1" autonomy-dev = {{extras = ["all"], version = ">=0.2.64,<=0.2.78"}} - [tool.poetry.dev-dependencies] diff --git a/auto_dev/protocols/scaffolder.py b/auto_dev/protocols/scaffolder.py index 05569e16..dcf62dca 100644 --- a/auto_dev/protocols/scaffolder.py +++ b/auto_dev/protocols/scaffolder.py @@ -16,7 +16,7 @@ from aea.protocols.generator.base import ProtocolGenerator from auto_dev.fmt import Formatter -from auto_dev.utils import currenttz, get_logger, remove_prefix, camel_to_snake +from auto_dev.utils import currenttz, get_logger, remove_prefix, camel_to_snake, snake_to_camel from auto_dev.constants import DEFAULT_TZ, DEFAULT_ENCODING, JINJA_TEMPLATE_FOLDER from auto_dev.data.connections.template import HEADER @@ -418,12 +418,12 @@ def generate_base_models(self, protocol_path, protocol_name, protocol): ] content = content.replace( - f"class {protocol_name.capitalize()}Dialogues(", - f"class Base{protocol_name.capitalize()}Dialogues(Dialogues, ABC):", + f"class {snake_to_camel(protocol_name.capitalize())}Dialogues(Dialogues, ABC):", + f"class Base{snake_to_camel(protocol_name.capitalize())}Dialogues(Dialogues, ABC):", ) if len(protocol.speech_acts["roles"]) > 1: - raise UserWarning("We currently only support one role in the protocol.") + self.logger.error("We do not fully generate all dilogiues classes only support one role in the protocol.") role = list(protocol.speech_acts["roles"].keys())[0] content = content.replace( @@ -446,7 +446,7 @@ def generate_base_models(self, protocol_path, protocol_name, protocol): def _role_from_first_message(message: Message, sender: Address) -> Dialogue.Role: '''Infer the role of the agent from an incoming/outgoing first message''' del sender, message - return {protocol_name.capitalize()}Dialogue.Role.{role.upper()} + return {snake_to_camel(protocol_name.capitalize())}Dialogue.Role.{role.upper()} """) dialogues_class_ast = ast.parse(dialogues_class_str) dialogues_class_str = ast.unparse(dialogues_class_ast) @@ -458,15 +458,21 @@ def _role_from_first_message(message: Message, sender: Address) -> Dialogue.Role + content_lines[import_end_line:] ) + # noqa + base_cls_name = f"Base{snake_to_camel(protocol_name.capitalize())}" + dialogues_class_str = textwrap.dedent(f""" - class {protocol_name.capitalize()}Dialogues(Base{protocol_name.capitalize()}Dialogues, Model): + class {snake_to_camel(protocol_name.capitalize())}Dialogues({base_cls_name}Dialogues, Model): '''This class defines the dialogues used in {protocol_name.capitalize()}.''' def __init__(self, **kwargs): '''Initialize dialogues.''' Model.__init__(self, keep_terminal_state_dialogues=False, **kwargs) - Base{protocol_name.capitalize()}Dialogues.__init__(self, self_address=str(self.context.skill_id)) + Base{snake_to_camel(protocol_name.capitalize())}Dialogues.__init__(self, + self_address=str(self.context.skill_id)) """) + # noqa + dialogues_class_ast = ast.parse(dialogues_class_str) dialogues_class_str = ast.unparse(dialogues_class_ast) @@ -476,10 +482,6 @@ def __init__(self, **kwargs): # We also need to update the dialogues tests dialogues_tests = protocol_path / "tests" / f"test_{protocol_name}_dialogues.py" content = dialogues_tests.read_text(encoding=DEFAULT_ENCODING) - content = content.replace( - f" {protocol_name.capitalize()}Dialogues", - f" Base{protocol_name.capitalize()}Dialogues as {protocol_name.capitalize()}Dialogues", - ) dialogues_tests.write_text(content, encoding=DEFAULT_ENCODING) # We just need to perform a simple updating of the dialogues. @@ -532,20 +534,37 @@ def generate_pydantic_models(self, protocol_path, protocol_name, protocol): dummy_data_path = protocol_path / "tests" / "dummy_data.yaml" dummy_data_path.write_text(yaml.dump(all_dummy_data), encoding=DEFAULT_ENCODING) - self.output_pydantic_models(pydantic_output, protocol_path, required_type_imports) + self.output_pydantic_models( + pydantic_output, + protocol_path, + required_type_imports, + ) - def output_pydantic_models(self, pydantic_output, protocol_path, required_type_imports): + def output_pydantic_models( + self, + pydantic_output, + protocol_path, + required_type_imports, + ): """ Ouput the pydantic models to the custom_types.py file. """ new_ast = ast.parse(pydantic_output) - imports = [] - classes = [] + new_imports = {} + new_classes = {} + new_assignments = {} for node in new_ast.body: if isinstance(node, ast.Import): - imports.append(node) - classes.append(node) + new_imports[node.names[0].name] = node + continue + if isinstance(node, ast.Assign): + new_assignments[node.targets[0].id] = node + continue + if isinstance(node, ast.ClassDef): + new_classes[node.name] = node + continue + raise ValueError(f"Unknown node type: {node}") # We now read in the custom_types.py file custom_types_path = protocol_path / "custom_types.py" @@ -553,23 +572,44 @@ def output_pydantic_models(self, pydantic_output, protocol_path, required_type_i root = ast.parse(content) # We now update the classes - base_model_class = classes.pop(0) - for node in classes: - for i, existing_node in enumerate(root.body): - if isinstance(node, ast.Assign): - continue - if isinstance(existing_node, ast.ClassDef): - if existing_node.name == node.name: - root.body[i] = node - break - else: - root.body.append(node) + + classes = {} + assignments = {} + imports = {} + + for node in root.body: + if isinstance(node, ast.ImportFrom): + imports[node.names[0].name] = node + continue + if isinstance(node, ast.ClassDef): + classes[node.name] = node + continue + if isinstance(node, ast.Assign): + assignments[node.targets[0].id] = node + continue + if isinstance(node, ast.Expr): + continue + + # We now create a set of new data, such that the new data is added to the custom_types.py file + + new_body = ( + [i for i in imports.values() if i.names[0].name not in new_imports] + + list(new_imports.values()) + + [i for i in classes.values() if i.name not in new_classes] + + list(new_classes.values()) + + [i for i in assignments.values() if i.targets[0].id not in new_assignments] + + list(new_assignments.values()) + ) + + root.body = new_body # We now write the updated content to the custom_types.py file updated_content = ast.unparse(root) # We add in the imports typing_import_line = textwrap.dedent( """ + '''Custom types for the protocol.''' + from enum import Enum from pydantic import BaseModel """ ) @@ -578,11 +618,8 @@ def output_pydantic_models(self, pydantic_output, protocol_path, required_type_i typing_import_line += f"\nfrom typing import {', '.join(set(required_type_imports))}" updated_content_lines = updated_content.split("\n") - updated_content_lines.insert(2, typing_import_line) + updated_content_lines.insert(0, typing_import_line) - base_model_code = ast.unparse(base_model_class) - base_model_code_lines = base_model_code.split("\n") - updated_content_lines = updated_content_lines[:4] + base_model_code_lines + updated_content_lines[4:] updated_content = "\n".join(updated_content_lines) custom_types_path.write_text(updated_content) Formatter(verbose=False, remote=False).format(custom_types_path) @@ -591,6 +628,15 @@ def clean_tests( self, protocol_path, protocol, + ) -> None: + """Clean tests.""" + self.clean_tests_messages(protocol_path, protocol) + self.clean_tests_dialogues(protocol_path, protocol) + + def clean_tests_messages( + self, + protocol_path, + protocol, ) -> None: """Clean tests.""" # We need to remove the test files @@ -632,7 +678,7 @@ def load_data(custom_type): start_line = ix import_defs = textwrap.dedent( - f""" + """ from typing import Any """ ) @@ -673,3 +719,79 @@ def load_data(custom_type): tests_path.write_text(content, encoding=DEFAULT_ENCODING) Formatter(verbose=False, remote=False).format(tests_path) + + def clean_tests_dialogues( + self, + protocol_path, + protocol, + ) -> None: + """Clean tests.""" + # We need to remove the test files + tests_path = protocol_path / "tests" / f"test_{protocol_path.name}_dialogues.py" + + content = tests_path.read_text() + + # We just need to find the custom types, and make sure that we use the new data loader function + + enum_imports = [] + + for custom_type in protocol.custom_types: + if protocol.custom_types[custom_type].startswith("enum"): + ct_name = custom_type.split(":")[1] + content = content.replace(f"{ct_name}()", f"{ct_name}(0)") + msg = ( + f"from packages.{protocol.metadata['author']}" + + f".protocols.{protocol_path.name}.custom_types import {ct_name}" + ) + enum_imports.append(msg) + continue + # We build the line to load the data types; + ct_name = custom_type[3:] + replace_line = f"{ct_name}(**load_data('{ct_name}'))" + search_line = f"{ct_name}()" + content = content.replace(search_line, replace_line) + + # We update the import to import the BaseDialogues class + + for string, replace_line in [ + ( + f"{snake_to_camel(protocol_path.name.capitalize())}Dialogues", + f"Base{snake_to_camel(protocol_path.name.capitalize())}Dialogues", + ), + ]: + content = content.replace( + string, + replace_line, + ) + + # We update the imports + original_content = content.split("\n") + new_content = [] + start_line = 0 + for ix, line in enumerate(original_content): + if line.startswith("class"): + break + start_line = ix + + test_data_loader = textwrap.dedent( + """ + import os + import yaml + def load_data(custom_type): + '''Load test data.''' + with open(f"{os.path.dirname(__file__)}/dummy_data.yaml", "r", encoding="utf-8") as f: + return yaml.safe_load(f)[custom_type] + + """ + ) + + new_content.extend(original_content[:start_line]) + new_content.extend(enum_imports) + new_content.extend(test_data_loader.split("\n")) + new_content.extend(original_content[start_line:]) + content = "\n".join(new_content) + + # We write the updated content to the file + tests_path.write_text(content, encoding=DEFAULT_ENCODING) + + Formatter(verbose=False, remote=False).format(tests_path) diff --git a/auto_dev/test.py b/auto_dev/test.py index 922ecb9d..680a6f45 100644 --- a/auto_dev/test.py +++ b/auto_dev/test.py @@ -2,7 +2,8 @@ from multiprocessing import cpu_count -from auto_dev.cli_executor import CommandExecutor +# We execute using the pytest command. +import pytest def test_path( @@ -15,17 +16,17 @@ def test_path( :param path: The path to check. """ extra_args = [] + + if verbose: + extra_args.append("-v") + + if watch: + extra_args.append("-w") + if multiple: - extra_args = ["-n", str(cpu_count())] - command = CommandExecutor( - [ - "poetry", - "run", - "pytest", - str(path), - "-vv", - ] - + (["-w"] if watch else []) - + extra_args - ) - return command.execute(verbose=verbose, stream=True) + extra_args.append("-n") + extra_args.append(str(cpu_count())) + + args = [path] + extra_args + res = pytest.main(args) + return bool(res == 0) diff --git a/poetry.lock b/poetry.lock index 770ee8ed..36eea910 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1692,13 +1692,13 @@ files = [ [[package]] name = "griffe" -version = "1.3.2" +version = "1.4.1" description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API." optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "griffe-1.3.2-py3-none-any.whl", hash = "sha256:2e34b5e46507d615915c8e6288bb1a2234bd35dee44d01e40a2bc2f25bd4d10c"}, - {file = "griffe-1.3.2.tar.gz", hash = "sha256:1ec50335aa507ed2445f2dd45a15c9fa3a45f52c9527e880571dfc61912fd60c"}, + {file = "griffe-1.4.1-py3-none-any.whl", hash = "sha256:84295ee0b27743bd880aea75632830ef02ded65d16124025e4c263bb826ab645"}, + {file = "griffe-1.4.1.tar.gz", hash = "sha256:911a201b01dc92e08c0e84c38a301e9da5ec067f00e7d9f2e39bc24dbfa3c176"}, ] [package.dependencies] @@ -3760,29 +3760,29 @@ files = [ [[package]] name = "pywin32" -version = "307" +version = "308" description = "Python for Window Extensions" optional = false python-versions = "*" files = [ - {file = "pywin32-307-cp310-cp310-win32.whl", hash = "sha256:f8f25d893c1e1ce2d685ef6d0a481e87c6f510d0f3f117932781f412e0eba31b"}, - {file = "pywin32-307-cp310-cp310-win_amd64.whl", hash = "sha256:36e650c5e5e6b29b5d317385b02d20803ddbac5d1031e1f88d20d76676dd103d"}, - {file = "pywin32-307-cp310-cp310-win_arm64.whl", hash = "sha256:0c12d61e0274e0c62acee79e3e503c312426ddd0e8d4899c626cddc1cafe0ff4"}, - {file = "pywin32-307-cp311-cp311-win32.whl", hash = "sha256:fec5d27cc893178fab299de911b8e4d12c5954e1baf83e8a664311e56a272b75"}, - {file = "pywin32-307-cp311-cp311-win_amd64.whl", hash = "sha256:987a86971753ed7fdd52a7fb5747aba955b2c7fbbc3d8b76ec850358c1cc28c3"}, - {file = "pywin32-307-cp311-cp311-win_arm64.whl", hash = "sha256:fd436897c186a2e693cd0437386ed79f989f4d13d6f353f8787ecbb0ae719398"}, - {file = "pywin32-307-cp312-cp312-win32.whl", hash = "sha256:07649ec6b01712f36debf39fc94f3d696a46579e852f60157a729ac039df0815"}, - {file = "pywin32-307-cp312-cp312-win_amd64.whl", hash = "sha256:00d047992bb5dcf79f8b9b7c81f72e0130f9fe4b22df613f755ab1cc021d8347"}, - {file = "pywin32-307-cp312-cp312-win_arm64.whl", hash = "sha256:b53658acbfc6a8241d72cc09e9d1d666be4e6c99376bc59e26cdb6223c4554d2"}, - {file = "pywin32-307-cp313-cp313-win32.whl", hash = "sha256:ea4d56e48dc1ab2aa0a5e3c0741ad6e926529510516db7a3b6981a1ae74405e5"}, - {file = "pywin32-307-cp313-cp313-win_amd64.whl", hash = "sha256:576d09813eaf4c8168d0bfd66fb7cb3b15a61041cf41598c2db4a4583bf832d2"}, - {file = "pywin32-307-cp313-cp313-win_arm64.whl", hash = "sha256:b30c9bdbffda6a260beb2919f918daced23d32c79109412c2085cbc513338a0a"}, - {file = "pywin32-307-cp37-cp37m-win32.whl", hash = "sha256:5101472f5180c647d4525a0ed289ec723a26231550dbfd369ec19d5faf60e511"}, - {file = "pywin32-307-cp37-cp37m-win_amd64.whl", hash = "sha256:05de55a7c110478dc4b202230e98af5e0720855360d2b31a44bb4e296d795fba"}, - {file = "pywin32-307-cp38-cp38-win32.whl", hash = "sha256:13d059fb7f10792542082f5731d5d3d9645320fc38814759313e5ee97c3fac01"}, - {file = "pywin32-307-cp38-cp38-win_amd64.whl", hash = "sha256:7e0b2f93769d450a98ac7a31a087e07b126b6d571e8b4386a5762eb85325270b"}, - {file = "pywin32-307-cp39-cp39-win32.whl", hash = "sha256:55ee87f2f8c294e72ad9d4261ca423022310a6e79fb314a8ca76ab3f493854c6"}, - {file = "pywin32-307-cp39-cp39-win_amd64.whl", hash = "sha256:e9d5202922e74985b037c9ef46778335c102b74b95cec70f629453dbe7235d87"}, + {file = "pywin32-308-cp310-cp310-win32.whl", hash = "sha256:796ff4426437896550d2981b9c2ac0ffd75238ad9ea2d3bfa67a1abd546d262e"}, + {file = "pywin32-308-cp310-cp310-win_amd64.whl", hash = "sha256:4fc888c59b3c0bef905ce7eb7e2106a07712015ea1c8234b703a088d46110e8e"}, + {file = "pywin32-308-cp310-cp310-win_arm64.whl", hash = "sha256:a5ab5381813b40f264fa3495b98af850098f814a25a63589a8e9eb12560f450c"}, + {file = "pywin32-308-cp311-cp311-win32.whl", hash = "sha256:5d8c8015b24a7d6855b1550d8e660d8daa09983c80e5daf89a273e5c6fb5095a"}, + {file = "pywin32-308-cp311-cp311-win_amd64.whl", hash = "sha256:575621b90f0dc2695fec346b2d6302faebd4f0f45c05ea29404cefe35d89442b"}, + {file = "pywin32-308-cp311-cp311-win_arm64.whl", hash = "sha256:100a5442b7332070983c4cd03f2e906a5648a5104b8a7f50175f7906efd16bb6"}, + {file = "pywin32-308-cp312-cp312-win32.whl", hash = "sha256:587f3e19696f4bf96fde9d8a57cec74a57021ad5f204c9e627e15c33ff568897"}, + {file = "pywin32-308-cp312-cp312-win_amd64.whl", hash = "sha256:00b3e11ef09ede56c6a43c71f2d31857cf7c54b0ab6e78ac659497abd2834f47"}, + {file = "pywin32-308-cp312-cp312-win_arm64.whl", hash = "sha256:9b4de86c8d909aed15b7011182c8cab38c8850de36e6afb1f0db22b8959e3091"}, + {file = "pywin32-308-cp313-cp313-win32.whl", hash = "sha256:1c44539a37a5b7b21d02ab34e6a4d314e0788f1690d65b48e9b0b89f31abbbed"}, + {file = "pywin32-308-cp313-cp313-win_amd64.whl", hash = "sha256:fd380990e792eaf6827fcb7e187b2b4b1cede0585e3d0c9e84201ec27b9905e4"}, + {file = "pywin32-308-cp313-cp313-win_arm64.whl", hash = "sha256:ef313c46d4c18dfb82a2431e3051ac8f112ccee1a34f29c263c583c568db63cd"}, + {file = "pywin32-308-cp37-cp37m-win32.whl", hash = "sha256:1f696ab352a2ddd63bd07430080dd598e6369152ea13a25ebcdd2f503a38f1ff"}, + {file = "pywin32-308-cp37-cp37m-win_amd64.whl", hash = "sha256:13dcb914ed4347019fbec6697a01a0aec61019c1046c2b905410d197856326a6"}, + {file = "pywin32-308-cp38-cp38-win32.whl", hash = "sha256:5794e764ebcabf4ff08c555b31bd348c9025929371763b2183172ff4708152f0"}, + {file = "pywin32-308-cp38-cp38-win_amd64.whl", hash = "sha256:3b92622e29d651c6b783e368ba7d6722b1634b8e70bd376fd7610fe1992e19de"}, + {file = "pywin32-308-cp39-cp39-win32.whl", hash = "sha256:7873ca4dc60ab3287919881a7d4f88baee4a6e639aa6962de25a98ba6b193341"}, + {file = "pywin32-308-cp39-cp39-win_amd64.whl", hash = "sha256:71b3322d949b4cc20776436a9c9ba0eeedcbc9c650daa536df63f0ff111bb920"}, ] [[package]] @@ -4782,103 +4782,109 @@ watchdog = ["watchdog"] [[package]] name = "yarl" -version = "1.14.0" +version = "1.15.1" description = "Yet another URL library" optional = false python-versions = ">=3.8" files = [ - {file = "yarl-1.14.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:1bfc25aa6a7c99cf86564210f79a0b7d4484159c67e01232b116e445b3036547"}, - {file = "yarl-1.14.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0cf21f46a15d445417de8fc89f2568852cf57fe8ca1ab3d19ddb24d45c0383ae"}, - {file = "yarl-1.14.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1dda53508df0de87b6e6b0a52d6718ff6c62a5aca8f5552748404963df639269"}, - {file = "yarl-1.14.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:587c3cc59bc148a9b1c07a019346eda2549bc9f468acd2f9824d185749acf0a6"}, - {file = "yarl-1.14.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3007a5b75cb50140708420fe688c393e71139324df599434633019314ceb8b59"}, - {file = "yarl-1.14.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:06ff23462398333c78b6f4f8d3d70410d657a471c2c5bbe6086133be43fc8f1a"}, - {file = "yarl-1.14.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:689a99a42ee4583fcb0d3a67a0204664aa1539684aed72bdafcbd505197a91c4"}, - {file = "yarl-1.14.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b0547ab1e9345dc468cac8368d88ea4c5bd473ebc1d8d755347d7401982b5dd8"}, - {file = "yarl-1.14.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:742aef0a99844faaac200564ea6f5e08facb285d37ea18bd1a5acf2771f3255a"}, - {file = "yarl-1.14.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:176110bff341b6730f64a1eb3a7070e12b373cf1c910a9337e7c3240497db76f"}, - {file = "yarl-1.14.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:46a9772a1efa93f9cd170ad33101c1817c77e0e9914d4fe33e2da299d7cf0f9b"}, - {file = "yarl-1.14.0-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:ee2c68e4f2dd1b1c15b849ba1c96fac105fca6ffdb7c1e8be51da6fabbdeafb9"}, - {file = "yarl-1.14.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:047b258e00b99091b6f90355521f026238c63bd76dcf996d93527bb13320eefd"}, - {file = "yarl-1.14.0-cp310-cp310-win32.whl", hash = "sha256:0aa92e3e30a04f9462a25077db689c4ac5ea9ab6cc68a2e563881b987d42f16d"}, - {file = "yarl-1.14.0-cp310-cp310-win_amd64.whl", hash = "sha256:d9baec588f015d0ee564057aa7574313c53a530662ffad930b7886becc85abdf"}, - {file = "yarl-1.14.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:07f9eaf57719d6721ab15805d85f4b01a5b509a0868d7320134371bcb652152d"}, - {file = "yarl-1.14.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c14b504a74e58e2deb0378b3eca10f3d076635c100f45b113c18c770b4a47a50"}, - {file = "yarl-1.14.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:16a682a127930f3fc4e42583becca6049e1d7214bcad23520c590edd741d2114"}, - {file = "yarl-1.14.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:73bedd2be05f48af19f0f2e9e1353921ce0c83f4a1c9e8556ecdcf1f1eae4892"}, - {file = "yarl-1.14.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f3ab950f8814f3b7b5e3eebc117986f817ec933676f68f0a6c5b2137dd7c9c69"}, - {file = "yarl-1.14.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b693c63e7e64b524f54aa4888403c680342d1ad0d97be1707c531584d6aeeb4f"}, - {file = "yarl-1.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:85cb3e40eaa98489f1e2e8b29f5ad02ee1ee40d6ce6b88d50cf0f205de1d9d2c"}, - {file = "yarl-1.14.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4f24f08b6c9b9818fd80612c97857d28f9779f0d1211653ece9844fc7b414df2"}, - {file = "yarl-1.14.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:29a84a46ec3ebae7a1c024c055612b11e9363a8a23238b3e905552d77a2bc51b"}, - {file = "yarl-1.14.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:5cd5dad8366e0168e0fd23d10705a603790484a6dbb9eb272b33673b8f2cce72"}, - {file = "yarl-1.14.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:a152751af7ef7b5d5fa6d215756e508dd05eb07d0cf2ba51f3e740076aa74373"}, - {file = "yarl-1.14.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:3d569f877ed9a708e4c71a2d13d2940cb0791da309f70bd970ac1a5c088a0a92"}, - {file = "yarl-1.14.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:6a615cad11ec3428020fb3c5a88d85ce1b5c69fd66e9fcb91a7daa5e855325dd"}, - {file = "yarl-1.14.0-cp311-cp311-win32.whl", hash = "sha256:bab03192091681d54e8225c53f270b0517637915d9297028409a2a5114ff4634"}, - {file = "yarl-1.14.0-cp311-cp311-win_amd64.whl", hash = "sha256:985623575e5c4ea763056ffe0e2d63836f771a8c294b3de06d09480538316b13"}, - {file = "yarl-1.14.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:fc2c80bc87fba076e6cbb926216c27fba274dae7100a7b9a0983b53132dd99f2"}, - {file = "yarl-1.14.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:55c144d363ad4626ca744556c049c94e2b95096041ac87098bb363dcc8635e8d"}, - {file = "yarl-1.14.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b03384eed107dbeb5f625a99dc3a7de8be04fc8480c9ad42fccbc73434170b20"}, - {file = "yarl-1.14.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f72a0d746d38cb299b79ce3d4d60ba0892c84bbc905d0d49c13df5bace1b65f8"}, - {file = "yarl-1.14.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8648180b34faaea4aa5b5ca7e871d9eb1277033fa439693855cf0ea9195f85f1"}, - {file = "yarl-1.14.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9557c9322aaa33174d285b0c1961fb32499d65ad1866155b7845edc876c3c835"}, - {file = "yarl-1.14.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f50eb3837012a937a2b649ec872b66ba9541ad9d6f103ddcafb8231cfcafd22"}, - {file = "yarl-1.14.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8892fa575ac9b1b25fae7b221bc4792a273877b9b56a99ee2d8d03eeb3dbb1d2"}, - {file = "yarl-1.14.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e6a2c5c5bb2556dfbfffffc2bcfb9c235fd2b566d5006dfb2a37afc7e3278a07"}, - {file = "yarl-1.14.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:ab3abc0b78a5dfaa4795a6afbe7b282b6aa88d81cf8c1bb5e394993d7cae3457"}, - {file = "yarl-1.14.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:47eede5d11d669ab3759b63afb70d28d5328c14744b8edba3323e27dc52d298d"}, - {file = "yarl-1.14.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:fe4d2536c827f508348d7b40c08767e8c7071614250927233bf0c92170451c0a"}, - {file = "yarl-1.14.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0fd7b941dd1b00b5f0acb97455fea2c4b7aac2dd31ea43fb9d155e9bc7b78664"}, - {file = "yarl-1.14.0-cp312-cp312-win32.whl", hash = "sha256:99ff3744f5fe48288be6bc402533b38e89749623a43208e1d57091fc96b783b9"}, - {file = "yarl-1.14.0-cp312-cp312-win_amd64.whl", hash = "sha256:1ca3894e9e9f72da93544f64988d9c052254a338a9f855165f37f51edb6591de"}, - {file = "yarl-1.14.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:5d02d700705d67e09e1f57681f758f0b9d4412eeb70b2eb8d96ca6200b486db3"}, - {file = "yarl-1.14.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:30600ba5db60f7c0820ef38a2568bb7379e1418ecc947a0f76fd8b2ff4257a97"}, - {file = "yarl-1.14.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:e85d86527baebb41a214cc3b45c17177177d900a2ad5783dbe6f291642d4906f"}, - {file = "yarl-1.14.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:37001e5d4621cef710c8dc1429ca04e189e572f128ab12312eab4e04cf007132"}, - {file = "yarl-1.14.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f4f4547944d4f5cfcdc03f3f097d6f05bbbc915eaaf80a2ee120d0e756de377d"}, - {file = "yarl-1.14.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:75ff4c819757f9bdb35de049a509814d6ce851fe26f06eb95a392a5640052482"}, - {file = "yarl-1.14.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:68ac1a09392ed6e3fd14be880d39b951d7b981fd135416db7d18a6208c536561"}, - {file = "yarl-1.14.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:96952f642ac69075e44c7d0284528938fdff39422a1d90d3e45ce40b72e5e2d9"}, - {file = "yarl-1.14.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a56fbe3d7f3bce1d060ea18d2413a2ca9ca814eea7cedc4d247b5f338d54844e"}, - {file = "yarl-1.14.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:7e2637d75e92763d1322cb5041573279ec43a80c0f7fbbd2d64f5aee98447b17"}, - {file = "yarl-1.14.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:9abe80ae2c9d37c17599557b712e6515f4100a80efb2cda15f5f070306477cd2"}, - {file = "yarl-1.14.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:217a782020b875538eebf3948fac3a7f9bbbd0fd9bf8538f7c2ad7489e80f4e8"}, - {file = "yarl-1.14.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b9cfef3f14f75bf6aba73a76caf61f9d00865912a04a4393c468a7ce0981b519"}, - {file = "yarl-1.14.0-cp313-cp313-win32.whl", hash = "sha256:d8361c7d04e6a264481f0b802e395f647cd3f8bbe27acfa7c12049efea675bd1"}, - {file = "yarl-1.14.0-cp313-cp313-win_amd64.whl", hash = "sha256:bc24f968b82455f336b79bf37dbb243b7d76cd40897489888d663d4e028f5069"}, - {file = "yarl-1.14.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:91d875f75fabf76b3018c5f196bf3d308ed2b49ddcb46c1576d6b075754a1393"}, - {file = "yarl-1.14.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:4009def9be3a7e5175db20aa2d7307ecd00bbf50f7f0f989300710eee1d0b0b9"}, - {file = "yarl-1.14.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:582cedde49603f139be572252a318b30dc41039bc0b8165f070f279e5d12187f"}, - {file = "yarl-1.14.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dbd9ff43a04f8ffe8a959a944c2dca10d22f5f99fc6a459f49c3ebfb409309d9"}, - {file = "yarl-1.14.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b9f805e37ed16cc212fdc538a608422d7517e7faf539bedea4fe69425bc55d76"}, - {file = "yarl-1.14.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:95e16e9eaa2d7f5d87421b8fe694dd71606aa61d74b824c8d17fc85cc51983d1"}, - {file = "yarl-1.14.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:816d24f584edefcc5ca63428f0b38fee00b39fe64e3c5e558f895a18983efe96"}, - {file = "yarl-1.14.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cd2660c01367eb3ef081b8fa0a5da7fe767f9427aa82023a961a5f28f0d4af6c"}, - {file = "yarl-1.14.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:94b2bb9bcfd5be9d27004ea4398fb640373dd0c1a9e219084f42c08f77a720ab"}, - {file = "yarl-1.14.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:c2089a9afef887664115f7fa6d3c0edd6454adaca5488dba836ca91f60401075"}, - {file = "yarl-1.14.0-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:2192f718db4a8509f63dd6d950f143279211fa7e6a2c612edc17d85bf043d36e"}, - {file = "yarl-1.14.0-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:8385ab36bf812e9d37cf7613999a87715f27ef67a53f0687d28c44b819df7cb0"}, - {file = "yarl-1.14.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:b4c1ecba93e7826dc71ddba75fb7740cdb52e7bd0be9f03136b83f54e6a1f511"}, - {file = "yarl-1.14.0-cp38-cp38-win32.whl", hash = "sha256:e749af6c912a7bb441d105c50c1a3da720474e8acb91c89350080dd600228f0e"}, - {file = "yarl-1.14.0-cp38-cp38-win_amd64.whl", hash = "sha256:147e36331f6f63e08a14640acf12369e041e0751bb70d9362df68c2d9dcf0c87"}, - {file = "yarl-1.14.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7a9f917966d27f7ce30039fe8d900f913c5304134096554fd9bea0774bcda6d1"}, - {file = "yarl-1.14.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8a2f8fb7f944bcdfecd4e8d855f84c703804a594da5123dd206f75036e536d4d"}, - {file = "yarl-1.14.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:8f4e475f29a9122f908d0f1f706e1f2fc3656536ffd21014ff8a6f2e1b14d1d8"}, - {file = "yarl-1.14.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8089d4634d8fa2b1806ce44fefa4979b1ab2c12c0bc7ef3dfa45c8a374811348"}, - {file = "yarl-1.14.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1b16f6c75cffc2dc0616ea295abb0e1967601bd1fb1e0af6a1de1c6c887f3439"}, - {file = "yarl-1.14.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:498b3c55087b9d762636bca9b45f60d37e51d24341786dc01b81253f9552a607"}, - {file = "yarl-1.14.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e3f8bfc1db82589ef965ed234b87de30d140db8b6dc50ada9e33951ccd8ec07a"}, - {file = "yarl-1.14.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:625f207b1799e95e7c823f42f473c1e9dbfb6192bd56bba8695656d92be4535f"}, - {file = "yarl-1.14.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:781e2495e408a81e4eaeedeb41ba32b63b1980dddf8b60dbbeff6036bcd35049"}, - {file = "yarl-1.14.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:659603d26d40dd4463200df9bfbc339fbfaed3fe32e5c432fe1dc2b5d4aa94b4"}, - {file = "yarl-1.14.0-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:4e0d45ebf975634468682c8bec021618b3ad52c37619e5c938f8f831fa1ac5c0"}, - {file = "yarl-1.14.0-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:a2e4725a08cb2b4794db09e350c86dee18202bb8286527210e13a1514dc9a59a"}, - {file = "yarl-1.14.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:19268b4fec1d7760134f2de46ef2608c2920134fb1fa61e451f679e41356dc55"}, - {file = "yarl-1.14.0-cp39-cp39-win32.whl", hash = "sha256:337912bcdcf193ade64b9aae5a4017a0a1950caf8ca140362e361543c6773f21"}, - {file = "yarl-1.14.0-cp39-cp39-win_amd64.whl", hash = "sha256:b6d0147574ce2e7b812c989e50fa72bbc5338045411a836bd066ce5fc8ac0bce"}, - {file = "yarl-1.14.0-py3-none-any.whl", hash = "sha256:c8ed4034f0765f8861620c1f2f2364d2e58520ea288497084dae880424fc0d9f"}, - {file = "yarl-1.14.0.tar.gz", hash = "sha256:88c7d9d58aab0724b979ab5617330acb1c7030b79379c8138c1c8c94e121d1b3"}, + {file = "yarl-1.15.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7d94d8a3927516c10be9958caa72a4148d9c99fc4de3442fa00873870d58d430"}, + {file = "yarl-1.15.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:fa0c603f007bf3f54bcd7f011f46134995a129a8f0c8e70f0ad8330228ff02d7"}, + {file = "yarl-1.15.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:069de3a78672043e84b37078dbc250c5fff1b16ee1b584de5d684d402cc51703"}, + {file = "yarl-1.15.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:70b34ba1be6d0726efdc0da9c477e5363132d2ac97d0951926b6046a7c24c70e"}, + {file = "yarl-1.15.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:31397f4ea5700dfcb1b3ce6fdb24407ea874494fd546926f13a7449999180b67"}, + {file = "yarl-1.15.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ef6b02ebc4b05c9d5575ae6120af173421f1bc653452967c8ae47f6e820d2f75"}, + {file = "yarl-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bd735297b9e9afba34bf05a3580e80e4145031d319723777e58f169d7ef553bb"}, + {file = "yarl-1.15.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:566669cfcf4f89f9e8dafc06a81472122cd2b8c00cca24a2c662cb5c7fbe9edf"}, + {file = "yarl-1.15.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:6e75b66019709dce95a4a7b47fe3b072f1d7eb8bd0c323e5e62332c84a05aa50"}, + {file = "yarl-1.15.1-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:cda340ed6afd475d4e58d8f34d3f08a4dda956cde86930f51827972ed4e98f3d"}, + {file = "yarl-1.15.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e5c0b30bdc6668d3a1c9ecebae4dc22fd90b02c7ea68f7907db315fd81853f06"}, + {file = "yarl-1.15.1-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:699ce4edbc471bf39ffdb2060c643f1750a7ccb4b7a34a45dccb389c0ec4996b"}, + {file = "yarl-1.15.1-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:ab5140fd448ce090c73b651bedbbf26de42317466f70210648480e2d63fedf04"}, + {file = "yarl-1.15.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:0c4a3d28a0888bdc8529824e73afa8e5362c79ef2a68bec53fd040cb2ad84e39"}, + {file = "yarl-1.15.1-cp310-cp310-win32.whl", hash = "sha256:dab310e5fa1ec359bf105d03f2e1227ade8952b78961ccd1b17f9f9acb3f49ae"}, + {file = "yarl-1.15.1-cp310-cp310-win_amd64.whl", hash = "sha256:1bc9f6a7b0ede16fd2ed6bbdf89e78377b1f00f0e48806c5356c4d3174ae5906"}, + {file = "yarl-1.15.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:dfeba6be776409230aebf12bd01539097459886c925ae20fac2c3b736ba0284a"}, + {file = "yarl-1.15.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2aa01bb3f91a64aa1d42db9b704674f6ed7c19d2a296f1e3bd25ade9e97dbeb9"}, + {file = "yarl-1.15.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8ecf1511b7db6a09681765c70952503418468deff5d8c34100f44c8318755836"}, + {file = "yarl-1.15.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:03344b592468257494a253b35f7b67c243397286dd0ae6be03af35eb34333139"}, + {file = "yarl-1.15.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8dda10d4525517e32dc33c5fe98c5b877b9807ce0ecd8acef93c09f1406b4fe4"}, + {file = "yarl-1.15.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:889993b2bc2f04308d4ebe12424fecccc22062aa06c61771d3e9302527a0bdec"}, + {file = "yarl-1.15.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:027bbf2e616ed072ee5f9344240c8d908c3c5a8c30cea31e8fa9899b42a6a51b"}, + {file = "yarl-1.15.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3044230cd78f236f6b9c6e06cb7d618dd1cffebfb97600fb98e0a562f0f456ef"}, + {file = "yarl-1.15.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:e5b1e400252498d3de94b19197039422539c62f081c21f3b785e184cdd041a85"}, + {file = "yarl-1.15.1-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:c1b1dc71d6b4d6ab785e1f7a916960eb094be6300bc92e515d7a04709b2fad6b"}, + {file = "yarl-1.15.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:1a6e972ee42b2c868985db62dd592629594c47279579372a64d7666b6d14683d"}, + {file = "yarl-1.15.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:6ce6768a192aa3af22a9b58d1b07226e9313b3e6e179bdb8de215d99a6baef86"}, + {file = "yarl-1.15.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:45d986f872258bcd4f417b474e1c35e8bba14d69fb124432c417bd256adde38b"}, + {file = "yarl-1.15.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:e9dec42480ee079581faafb05fa55731ec80693310a6775e8adbf83edc52fd24"}, + {file = "yarl-1.15.1-cp311-cp311-win32.whl", hash = "sha256:2c8c4ea31d28f47d7af24f44e5a2090ec4245ac3f3e34ce55ab1188d92e98a71"}, + {file = "yarl-1.15.1-cp311-cp311-win_amd64.whl", hash = "sha256:b5f27f515f69dea928cc16577844762226893098426ba54223fc62c70af5863a"}, + {file = "yarl-1.15.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:b169b0edb76e72b46373fcc1b4b9820a3680639f92ad506c2b7de9450546bea6"}, + {file = "yarl-1.15.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:7e3b2e7518d6789b577793912b0037f36fdcff28a73a1f5c1affc34759852b4f"}, + {file = "yarl-1.15.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:04cb3e3a0f0fbf2a9614c88fef811c0f10449415a1ff532f437aec9bcc6b9da5"}, + {file = "yarl-1.15.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:46091072123e7295b0f4a88c6c24f0386b3e45e54efddd141069d5e16e372ce6"}, + {file = "yarl-1.15.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:839f1056ceca5b2019174f8c15ba131c3eebece241b228d46a469760953e8049"}, + {file = "yarl-1.15.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c7b85ad874cf6eaad545f2bd838b3782db30cecb9364ade0214b9a7e9462d051"}, + {file = "yarl-1.15.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d60326a87fcd9c1b1ccc18344b036ecdaa5e92c52c163560759df50fc0d39f6"}, + {file = "yarl-1.15.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:974fa4829a09fa0d7a6375d40f39ad9265904d7c1754e2b9dc302ceedc54388d"}, + {file = "yarl-1.15.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:41037ae2992cc3b0fa088ffe609e3c2f066284f9329035f26e853230e8f7ae13"}, + {file = "yarl-1.15.1-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:f313ce3a41c8c280f90ec0770dc2bd464a8b24f5c785daa70f71654b1334295b"}, + {file = "yarl-1.15.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:bd9c7873f26065a0ff3189c5002fb5c8e41d3e49741e0e903a11f12be27c841b"}, + {file = "yarl-1.15.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:e9672cdc71bb44d45240b8447793efb83a76a046000dafb6e2ac827db9dfbdda"}, + {file = "yarl-1.15.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:d7251c8185c49c17270d756da2c97de5c076790d64450a56c4814b3a40f3807f"}, + {file = "yarl-1.15.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3b7177ba5c965a436bb97d4db0841302075eb9fa77a6a806aa44975c5ff619fb"}, + {file = "yarl-1.15.1-cp312-cp312-win32.whl", hash = "sha256:35921994c4d23d3679d3999ca0fdd05b27e33363bc80e1c24681c9ba108eb874"}, + {file = "yarl-1.15.1-cp312-cp312-win_amd64.whl", hash = "sha256:28a865a4a06b90ea6ca985a530b7d95c795b4c63062f759fe88de90ae5f66198"}, + {file = "yarl-1.15.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:2206775a9a2831c044ecc0863cb63e4e8cf5f8d4fce0fc3c900e5a51e9d57e87"}, + {file = "yarl-1.15.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:af1741bedd1b3a1100635a30c2fa5850bc95e5647be3d221e28684b66d16f655"}, + {file = "yarl-1.15.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:2969fba35b5cd0418f343c363a3ae6c5dc847e3c2861a4ac857d004882a805d4"}, + {file = "yarl-1.15.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4510ae890f55a685d7d8b55cf80f6a35799fbe682b8546a0aed67565f86793ce"}, + {file = "yarl-1.15.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0ea3ca97a5aa00943604f93919bc0741769b900dd3217d02f9d29274371fd758"}, + {file = "yarl-1.15.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6a976eeaea67b1d53dce91174968f077ae7f3a0a05ede80a099bc584ea748bdd"}, + {file = "yarl-1.15.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cc5fbe7629e454d3c4a621c8416e9a1956d7f2523296142d46edc17d7d54901e"}, + {file = "yarl-1.15.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3d7c2224b6e8f40b39a61643212e5d974172394aae0244a9840f62aed4452ee4"}, + {file = "yarl-1.15.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a3e237e19fca6b4aa18e6bc7702d27c4e9460f1d0f3a792cdf4aefdc10d52411"}, + {file = "yarl-1.15.1-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:cd5857354c53d023fd97d06fb01b6c0f176cfc73ae03460a1812455095e214d6"}, + {file = "yarl-1.15.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:72d312f74665006911c4de95e1633c6e9e4b1f003ef4f76d4b36e01cfa7ed820"}, + {file = "yarl-1.15.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:d8e5a1ee05b5d742accc42512a1d6a8c59f6906db1dd298d98e1a6ab98470373"}, + {file = "yarl-1.15.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:2ce9052e9f4196e44221e3d3d51cdcfa3b1afea05afbd896cefdd233e9606d08"}, + {file = "yarl-1.15.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:d2376327a557661424599278fbf3a1bcb96b90c8316743ba3d9ad831e794e11a"}, + {file = "yarl-1.15.1-cp313-cp313-win32.whl", hash = "sha256:e328110c15b4d2dbb00861feaa7e0ce5aebfc355406e0f6d9e46adcb5abe9a55"}, + {file = "yarl-1.15.1-cp313-cp313-win_amd64.whl", hash = "sha256:5268b43abf47053dc0bbff72d78f69192dbe453fee9517036fc0a0cc84f341d7"}, + {file = "yarl-1.15.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:ee09963524b5327e2bfe3dfecd19d0403d2b1afbd11a49a00d4d379c1551406e"}, + {file = "yarl-1.15.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cbe2765f54e5940c705c8c1c125f12c84f7bd486f7925bcb7abc6740b97fdd5c"}, + {file = "yarl-1.15.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a86cb224d1f31ed4c6ba79188b571d517fdc730c6edcf6baf6e71805d88f183f"}, + {file = "yarl-1.15.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b28dc68741c2eda94ac2ce9fb16c73aa9b90c0c0cdf99cf8a7c86dec94dc5de2"}, + {file = "yarl-1.15.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:49db3c1a5e11241c1de2133efaa87a28ae9ac20583ad1ec16737761d9d8324a0"}, + {file = "yarl-1.15.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dce3ed94298b3e6a5dad8b86633ba70564411f459ce5d0e4bf57e973ef3fc158"}, + {file = "yarl-1.15.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:41b2be15daf51cd8d50f54d2277f17ac6e6fed198f105956a48d8240f10b154b"}, + {file = "yarl-1.15.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:007531e85ca8d9fc35819709a52a6f0d133deecc3e2247f0e2b8350de36a3356"}, + {file = "yarl-1.15.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:d6b646d8eae5fb38b9401daac98e40335228306305d491f52914b161f6cf319c"}, + {file = "yarl-1.15.1-cp38-cp38-musllinux_1_2_armv7l.whl", hash = "sha256:c551571a5941093b86c0c05fdf136fafbe4308b83cd4fc77d92b21c6726f7c13"}, + {file = "yarl-1.15.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:a6dd351c2f38c8168b6860338f4c30e9c160a0fb474dcbedf2224c63a86a7512"}, + {file = "yarl-1.15.1-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:759f18151f785888344ec1f28d5a2bd61ca2ccb80d04b65ab9548d524b1b9acb"}, + {file = "yarl-1.15.1-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:860fc2726e32b4ac3b0a44535853a9b1ea14975a8c4207609f2883dcfcbd5ecc"}, + {file = "yarl-1.15.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:3c5782135b3a762e265b11dbb13df878d1a331ef498866036f743786adf70371"}, + {file = "yarl-1.15.1-cp38-cp38-win32.whl", hash = "sha256:f9a3a53622f0e905a7f3557b770d48e737b8a38141c81eecbcc947fac164d1f9"}, + {file = "yarl-1.15.1-cp38-cp38-win_amd64.whl", hash = "sha256:d25da5fc7a2993e1d9818e4dfdc67c95c771678e0d3499a1d67e42bfa75890ba"}, + {file = "yarl-1.15.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:6f3595518f4e8b97c0a2d01030e27937d22f2506a1503282b8965ae1dcd0dec6"}, + {file = "yarl-1.15.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c261d807048b9e17b0a3c413d4926c34b5563c6b94f95c17daff6053901d0ab0"}, + {file = "yarl-1.15.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:f1cd16833ff1d6250350794c3df1be2ce0960fa64740699dfa688769aa1c6a89"}, + {file = "yarl-1.15.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6e3959cfba2bb48a0d8b83f370452b400710dd0900f9fdad0ce9e913e6d65b8f"}, + {file = "yarl-1.15.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:87593714a38a4a51efc967b0477c72f55a08ed6b801bfcf68656e68f233047c7"}, + {file = "yarl-1.15.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1181f8912e0d1bb31cae5ab630d350ad2e79aab4196faea3669c3599e05af44b"}, + {file = "yarl-1.15.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:46448214e3b7099ab8cfba576b71b7742ce13a1cec7824eebe7a71fc8903b304"}, + {file = "yarl-1.15.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d44ec44b4771544b815cff0efa05f6d58e9f87e9b05aa15d13739111ae53df1e"}, + {file = "yarl-1.15.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:fa72a0e5037c2c91d1b945ff20698c01a7897b10ab93c0979b8543e2ad0b1d76"}, + {file = "yarl-1.15.1-cp39-cp39-musllinux_1_2_armv7l.whl", hash = "sha256:bd756524c387478f0788937dfbe132d01663e783e1424f7d3a72df552521c995"}, + {file = "yarl-1.15.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:6c3968e4ec6b44af29562824c7973c12c22041b2dc080613a7c41c7c09901579"}, + {file = "yarl-1.15.1-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:59aaa919f9898352cd3bf32d3a1bfc7d2aa399f83dd91b1915eaa684e27553b7"}, + {file = "yarl-1.15.1-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:65a41d40b34391aeb3b973410ed0ed86b3023e5371dce6e7ff1c57af5794391d"}, + {file = "yarl-1.15.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:54eef7907bb868e20ddcf4078e9a106e2c56a84ba31611038d28b9934ccb2a2c"}, + {file = "yarl-1.15.1-cp39-cp39-win32.whl", hash = "sha256:60c8b36f7ed73aeaa2948f27f9a8a905c23bf62e291b7b9fc53348b4789b180c"}, + {file = "yarl-1.15.1-cp39-cp39-win_amd64.whl", hash = "sha256:b79a4df7029446ae8062f74c093a2f6c305f65b3ec89fa8ce3e064c0eeb36f3f"}, + {file = "yarl-1.15.1-py3-none-any.whl", hash = "sha256:ac28421ab71ec2d50eb7dff76a64ef81de92fb9738a81de2500b031b6f5f6038"}, + {file = "yarl-1.15.1.tar.gz", hash = "sha256:02e1c9e36528de270c22c06aac6a5a1de8cc870fafefb5e90e5b35cb8985d0b2"}, ] [package.dependencies] From 7cbd09e82576a0d53ad7e4a4e507328d750e6eeb Mon Sep 17 00:00:00 2001 From: 8ball030 <8baller@station.codes> Date: Thu, 31 Oct 2024 16:19:38 +0000 Subject: [PATCH 2/4] feat:fsm-scaffolding --- auto_dev/behaviours/scaffolder.py | 41 +++++++- auto_dev/commands/scaffold.py | 18 +++- .../templates/behaviours/simple_fsm.jinja | 94 +++++++++++++++++++ auto_dev/enums.py | 1 + auto_dev/protocols/scaffolder.py | 16 ++++ 5 files changed, 165 insertions(+), 5 deletions(-) create mode 100644 auto_dev/data/templates/behaviours/simple_fsm.jinja diff --git a/auto_dev/behaviours/scaffolder.py b/auto_dev/behaviours/scaffolder.py index da5c4b7b..aa9c4053 100644 --- a/auto_dev/behaviours/scaffolder.py +++ b/auto_dev/behaviours/scaffolder.py @@ -16,7 +16,9 @@ from aea.protocols.generator.base import ProtocolGenerator from auto_dev.fmt import Formatter +from auto_dev.enums import BehaviourTypes from auto_dev.utils import currenttz, get_logger, remove_prefix, camel_to_snake, snake_to_camel +from auto_dev.fsm.fsm import FsmSpec from auto_dev.constants import DEFAULT_TZ, DEFAULT_ENCODING, JINJA_TEMPLATE_FOLDER from auto_dev.exceptions import UserInputError from auto_dev.protocols.scaffolder import PROTOBUF_TO_PYTHON, ProtocolScaffolder, read_protocol, parse_protobuf_type @@ -129,6 +131,13 @@ def __init__( self.auto_confirm = auto_confirm self.env = Environment(loader=FileSystemLoader(JINJA_TEMPLATE_FOLDER), autoescape=False) # noqa + @property + def scaffold(self): + """Scaffold the protocol.""" + return ( + self._scaffold_simple_fsm if self.behaviour_type is BehaviourTypes.simple_fsm else self._scaffold_protocol + ) + @property def template(self) -> Any: """Get the template.""" @@ -152,7 +161,37 @@ def _validate_selection(self, target_speech_acts, speech_acts): ) return target_speech_acts - def scaffold(self, target_speech_acts=None) -> None: + def _scaffold_simple_fsm( + self, + ) -> None: + """Scaffold the simple fsm behaviour from a fsm class.""" + + fsm_spec = FsmSpec.from_yaml(Path(self.protocol_specification_path).read_text()) + + all_states = fsm_spec.states + states_not_in_initial_or_final = [ + state for state in all_states if state not in fsm_spec.final_states + [fsm_spec.default_start_state] + ] + + transitions: list = [] + + for key, destination in fsm_spec.transition_func.items(): + source, event = key[1:-1].split(", ") + transitions.append({"source": source, "event": event, "destination": destination}) + + output = self.template.render( + fsm_spec=fsm_spec, + class_name=snake_to_camel(fsm_spec.label).capitalize(), + states=fsm_spec.states, + default_start_state=fsm_spec.default_start_state, + final_states=fsm_spec.final_states, + events=fsm_spec.alphabet_in, + remaining_states=states_not_in_initial_or_final, + transitions=transitions, + ) + print(output) + + def _scaffold_protocol(self, target_speech_acts=None) -> None: """Scaffold the protocol.""" protocol_specification = read_protocol(self.protocol_specification_path) raw_classes, all_dummy_data, enums = self._get_definition_of_custom_types(protocol=protocol_specification) diff --git a/auto_dev/commands/scaffold.py b/auto_dev/commands/scaffold.py index e7b7d8c7..705168f7 100644 --- a/auto_dev/commands/scaffold.py +++ b/auto_dev/commands/scaffold.py @@ -213,13 +213,19 @@ def handler(ctx, spec_file, public_id, new_skill, auto_confirm) -> int: @click.option("--auto-confirm", is_flag=True, default=False, help="Auto confirm all actions") @click.option( "--behaviour-type", - type=click.Choice([BehaviourTypes.metrics]), + type=click.Choice([f.value for f in (BehaviourTypes.metrics, BehaviourTypes.simple_fsm)]), required=True, help="The type of behaviour to generate.", default=BehaviourTypes.metrics, ) @click.pass_context -def behaviour(ctx, spec_file, behaviour_type, auto_confirm, target_speech_acts) -> None: +def behaviour( + ctx, + spec_file, + behaviour_type, + auto_confirm, + target_speech_acts, +) -> None: """ Generate an AEA handler from an OpenAPI 3 specification. @@ -233,7 +239,11 @@ def behaviour(ctx, spec_file, behaviour_type, auto_confirm, target_speech_acts) verbose = ctx.obj["VERBOSE"] scaffolder = BehaviourScaffolder( - spec_file, behaviour_type=behaviour_type, logger=logger, verbose=verbose, auto_confirm=auto_confirm + spec_file, + behaviour_type=BehaviourTypes[behaviour_type], + logger=logger, + verbose=verbose, + auto_confirm=auto_confirm, ) scaffolder.scaffold( target_speech_acts=target_speech_acts, @@ -341,4 +351,4 @@ def dao(ctx, auto_confirm) -> None: if __name__ == "__main__": - cli() # pylint: disable=no-value-for-parameter \ No newline at end of file + cli() # pylint: disable=no-value-for-parameter diff --git a/auto_dev/data/templates/behaviours/simple_fsm.jinja b/auto_dev/data/templates/behaviours/simple_fsm.jinja new file mode 100644 index 00000000..cfd3702b --- /dev/null +++ b/auto_dev/data/templates/behaviours/simple_fsm.jinja @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 2023 {{author}} +# Copyright 2023 valory-xyz +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ------------------------------------------------------------------------------ + +"""This package contains a behaviour that autogenerated from the protocol `{{protocol_name}}`.""" + +import sys +from abc import ABC +from typing import Optional, Any +from aea.skills.behaviours import FSMBehaviour, State +from enum import Enum + +# Define states +{% for state in states %} +class {{ state }}(State): + def __init__(self, **kwargs: Any) -> None: + super().__init__(**kwargs) + self._is_done = False # Initially, the state is not done + + def act(self) -> None: + print("{{ state }}: Performing action") + self._is_done = True + self._event = {{class_name}}Events.DONE + + def is_done(self) -> bool: + return self._is_done + + @property + def event(self) -> Optional[str]: + return self._event + +{% endfor %} + + +class {{class_name}}Events(Enum): + {%for event in events %} + {{event}} = '{{event}}'{% endfor %} + + +class {{class_name}}FsmBehaviour(FSMBehaviour): + """This class implements a simple Finite State Machine behaviour.""" + + def __init__(self, **kwargs: Any) -> None: + super().__init__(**kwargs) + self.register_state('{{default_start_state.lower()}}', {{default_start_state}}(**kwargs), True) + {% for state in final_states%} + self.register_state('{{state.lower()}}', {{state}}(**kwargs)){% endfor %} + {% if remaining_states %} + {% for state in remaining_states%} + self.register_state('{{state.lower()}}', {{state}}(**kwargs)) {% endfor %}{% endif %} + {% for transition in transitions%} + self.register_transition( + source='{{transition.source.lower()}}', + event={{class_name}}Events.{{transition.event}}, + destination='{{transition.destination.lower()}}' + ){% endfor %} + + + def setup(self) -> None: + """Implement the setup.""" + self.context.logger.info("Setting up {{class_name}} FSM behaviour.") + + + def teardown(self) -> None: + """Implement the teardown.""" + self.context.logger.info("Tearing down {{class_name}} FSM behaviour.") + + def act(self) -> None: + """Implement the act.""" + super().act() + if self.current is None: + self.context.logger.info("No state to act on.") + self.terminate() + + def terminate(self) -> None: + """Implement the termination.""" + print("Terminating the agent.") + sys.exit(0) \ No newline at end of file diff --git a/auto_dev/enums.py b/auto_dev/enums.py index c92fd266..04701b4f 100644 --- a/auto_dev/enums.py +++ b/auto_dev/enums.py @@ -51,3 +51,4 @@ class BehaviourTypes(Enum): """Behaviour types enum.""" metrics = "metrics" + simple_fsm = "simple_fsm" diff --git a/auto_dev/protocols/scaffolder.py b/auto_dev/protocols/scaffolder.py index dcf62dca..5383059c 100644 --- a/auto_dev/protocols/scaffolder.py +++ b/auto_dev/protocols/scaffolder.py @@ -297,6 +297,12 @@ def parse_protobuf_type(protobuf_type, required_type_imports=[]): output["name"] = attr_name output["type"] = f"Dict[{PROTOBUF_TO_PYTHON[key_type]}, {PROTOBUF_TO_PYTHON[val_type]}] = {{}}" required_type_imports.append("Dict") + elif protobuf_type.startswith("optional"): + attr_name = protobuf_type.split()[2] + + output["name"] = attr_name + output["type"] = f"Optional[{PROTOBUF_TO_PYTHON[protobuf_type.split()[1]]}] = None" + required_type_imports.append("Optional") else: _type = protobuf_type.split()[0] try: @@ -357,6 +363,16 @@ def generate(self) -> None: protocol, ) + # We now update the protocol.yaml dependencies key to include 'pydantic' + + protocol_yaml = protocol_path / "protocol.yaml" + # We keey the order of the yaml file + content = yaml.safe_load( + protocol_yaml.read_text(encoding=DEFAULT_ENCODING), + ) + content["dependencies"]["pydanctic"] = {} + protocol_yaml.write_text(yaml.dump(content, sort_keys=False), encoding=DEFAULT_ENCODING) + command = f"aea fingerprint protocol {protocol_author}/{protocol_name}:{protocol_version}" result = subprocess.run(command, shell=True, capture_output=True, check=False) if result.returncode != 0: From db33e668c283caea3c0771df84cd6120b4c1188a Mon Sep 17 00:00:00 2001 From: 8ball030 <8baller@station.codes> Date: Wed, 13 Nov 2024 12:11:11 +0000 Subject: [PATCH 3/4] feat: added in protocol scaffolding optional fields --- auto_dev/behaviours/scaffolder.py | 2 ++ auto_dev/commands/metadata.py | 4 ++++ auto_dev/protocols/scaffolder.py | 5 ++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/auto_dev/behaviours/scaffolder.py b/auto_dev/behaviours/scaffolder.py index aa9c4053..8fb38a69 100644 --- a/auto_dev/behaviours/scaffolder.py +++ b/auto_dev/behaviours/scaffolder.py @@ -287,6 +287,8 @@ def get_py_type_and_args(arg, arg_type, type_map): if py_type not in DEFAULT_TYPE_MAP: if py_type.startswith("Optional"): DEFAULT_TYPE_MAP[py_type] = None + elif py_type.startswith("Dict"): + DEFAULT_TYPE_MAP[py_type] = {} else: raise ValueError(f"Type {py_type} not found in the default type map.") diff --git a/auto_dev/commands/metadata.py b/auto_dev/commands/metadata.py index c4e63983..19b2e4af 100644 --- a/auto_dev/commands/metadata.py +++ b/auto_dev/commands/metadata.py @@ -299,6 +299,10 @@ def render_metadata(metadata, verbose=False) -> bool: if component_status == "NOT MINTED": click.echo(f"\n{component_id} is not minted. Please mint it first.") return False + + image_hash = metadata["image"][7:] + click.echo(f"View image at: https://gateway.autonolas.tech/ipfs/{image_hash}") + click.echo(f"View code at: https://gateway.autonolas.tech/ipfs/{metadata['code_uri'][7:]}") click.echo("\nAll dependencies are minted. You can mint this component now.") deps_ids_numeric = sorted(map(int, mint_status.keys())) diff --git a/auto_dev/protocols/scaffolder.py b/auto_dev/protocols/scaffolder.py index 5383059c..15fa4096 100644 --- a/auto_dev/protocols/scaffolder.py +++ b/auto_dev/protocols/scaffolder.py @@ -73,6 +73,9 @@ def get_dummy_data(field): res = [] if field["type"].startswith("Dict"): res = {} + if field["type"].startswith("Optional"): + # We recursively call this function to get the dummy data + res = get_dummy_data({"type": field["type"].split("Optional[")[1].split("]")[0], "name": field["name"]}) return res @@ -370,7 +373,7 @@ def generate(self) -> None: content = yaml.safe_load( protocol_yaml.read_text(encoding=DEFAULT_ENCODING), ) - content["dependencies"]["pydanctic"] = {} + content["dependencies"]["pydantic"] = {} protocol_yaml.write_text(yaml.dump(content, sort_keys=False), encoding=DEFAULT_ENCODING) command = f"aea fingerprint protocol {protocol_author}/{protocol_name}:{protocol_version}" From f12cde6fdafffef4bd5b51605cecb1340af79d05 Mon Sep 17 00:00:00 2001 From: 8ball030 <35799987+8ball030@users.noreply.github.com> Date: Wed, 13 Nov 2024 12:40:02 +0000 Subject: [PATCH 4/4] Update install.sh --- auto_dev/data/repo/templates/autonomy/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auto_dev/data/repo/templates/autonomy/install.sh b/auto_dev/data/repo/templates/autonomy/install.sh index ca8f4f86..550a5a7f 100755 --- a/auto_dev/data/repo/templates/autonomy/install.sh +++ b/auto_dev/data/repo/templates/autonomy/install.sh @@ -137,7 +137,7 @@ function install_poetry_deps() { echo "Installing package dependencies via poetry..." echo "Using poetry executable: $poetry_executable" - poetry install --no-root > /dev/null || exit 1 + poetry install > /dev/null || exit 1 echo "Checking if aea is installed" poetry run aea --version echo "Done installing dependencies"