Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions auto_dev/commands/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sys
import shutil
from pathlib import Path
from textwrap import dedent

import yaml
import rich_click as click
Expand Down Expand Up @@ -118,6 +119,34 @@ def create_service(self, agent_config, overrides, number_of_agents):
code_dir.mkdir(parents=True, exist_ok=True)
code_path = code_dir / self.template_name.split(JINJA_SUFFIX)[0]
code_path.write_text(rendered, DEFAULT_ENCODING)
test_data = dedent("""
\"\"\"Tests for the service.\"\"\"

def test_service():
\"\"\"Test the service.\"\"\"
assert True
""")

test_path = code_dir / "tests"
test_path.mkdir(parents=True, exist_ok=True)
test_init_path = test_path / "__init__.py"
test_init_path.write_text(
dedent("""
\"\"\"Tests for the service.\"\"\"
"""),
DEFAULT_ENCODING,
)

test_path /= "test_service.py"
test_path.write_text(test_data, DEFAULT_ENCODING)

init_path = code_dir / "__init__.py"
init_path.write_text(
dedent("""
\"\"\"Service package.\"\"\"
"""),
DEFAULT_ENCODING,
)

def check_if_service_exists(
self,
Expand Down
2 changes: 1 addition & 1 deletion auto_dev/commands/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def to_dict(self, latest: bool = False):

auto_dev_repo = GitDependency(
name="autonomy-dev",
version="0.2.138",
version="0.2.139",
location=DependencyLocation.REMOTE,
url="https://api.github.com/repos/8ball030/auto_dev",
extras=["all"],
Expand Down
9 changes: 8 additions & 1 deletion auto_dev/commands/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,16 @@ def scaffold(ctx, name, type_of_repo, force, auto_approve, install, initial_comm
- Adds sample main.py and cli.py files

"""

logger = ctx.obj["LOGGER"]
verbose = ctx.obj["VERBOSE"]
logger.info(f"Creating a new {type_of_repo} repo.")
verbose = ctx.obj["VERBOSE"]
scaffold_new_repo(logger, name, type_of_repo, force, auto_approve, install, initial_commit, verbose)
logger.info(f"Repository `{name}` successfully created.")


def scaffold_new_repo(logger, name, type_of_repo, force, auto_approve, install, initial_commit, verbose) -> None:
"""Scaffold a new repo."""
render_args["project_name"] = name
if Path(name).exists() and not force:
logger.error(f"Repo `{name}` already exists.\n\tPlease choose a different name or use the --force flag.")
Expand Down
2 changes: 1 addition & 1 deletion auto_dev/data/repo/templates/autonomy/adev_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ poetry_dependencies:
plugins: *id002
extras: null
- name: autonomy-dev
version: 0.2.138
version: 0.2.139
location: remote
url: https://api.github.com/repos/8ball030/auto_dev
extras:
Expand Down
258 changes: 142 additions & 116 deletions auto_dev/data/repo/templates/autonomy/poetry.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open-aea = "==1.64.0"
open-aea-cli-ipfs = "==1.64.0"
open-aea-test-autonomy = "==0.19.4"
open-autonomy = "==0.19.4"
autonomy-dev = {{extras = ["all"], version = ">=0.2.64,<=0.2.138"}}
autonomy-dev = {{extras = ["all"], version = ">=0.2.64,<=0.2.139"}}

[tool.poetry.group.dev.dependencies]

Expand Down
316 changes: 171 additions & 145 deletions auto_dev/data/repo/templates/python/poetry.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ classifiers = [

[tool.poetry.dependencies]
python = ">=3.10,<3.12"
autonomy-dev = {{extras = ["all"], version = ">=0.2.64,<=0.2.138"}}
autonomy-dev = {{extras = ["all"], version = ">=0.2.64,<=0.2.139"}}

[tool.poetry.dev-dependencies]

Expand Down
2 changes: 1 addition & 1 deletion auto_dev/services/runner/prod_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def generate_env_vars(self) -> dict:
"ALL_PARTICIPANTS": json.dumps(self.all_participants),
}
# we read in the .env file and update the environment variables
if Path(".." / self.env_file).exists():
if (Path("..") / self.env_file).exists():
with open(Path(".." / self.env_file), encoding="utf-8") as file:
all_parts.update(dict(line.strip().split("=") for line in file if "=" in line))
else:
Expand Down
13 changes: 13 additions & 0 deletions auto_dev/services/runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class DevAgentRunner(AgentRunner):
use_tendermint: bool = True
install_deps: bool = True
ethereum_address: str | None = None
env_file: str = ".env"

def __post_init__(
self,
Expand Down Expand Up @@ -248,7 +249,19 @@ def recurse_dictionary(dictionary, path=""):
_key = key.upper().replace(".", "_")
overrides[_key] = getter()

def generate_env_vars(self) -> dict:
"""Generate the environment variables for the deployment."""
# we read in the .env file and update the environment variables
all_parts = {}
if (Path("..") / self.env_file).exists():
with open((Path("..") / self.env_file), encoding="utf-8") as file:
all_parts.update(dict(line.strip().split("=") for line in file if "=" in line))
else:
self.logger.warning(f"Environment file {self.env_file} not found.")
return all_parts

self._env_vars = overrides
self._env_vars.update(generate_env_vars(self))

def manage_keys(
self,
Expand Down
1 change: 0 additions & 1 deletion auto_dev/workflow_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ def run_workflow(
self.update_table(self.table, task, status, display_process)
if status == "Failed":
self.logger.error(f"Task {task.id} failed.")
self.logger.error(f"Task {task.client.output}")
if exit_on_failure and not task.continue_on_error:
sys.exit(1)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ requires = ["poetry-core>=1.0.0", "setuptools"]

[tool.poetry]
name = "autonomy_dev"
version = "0.2.138"
version = "0.2.139"
homepage = "https://github.com/8ball030/auto_dev"
description = "A collection of tooling to enable open source development of autonomy tools"
authors = ["8Baller <8ball030@gmail.com>"]
Expand Down
2 changes: 1 addition & 1 deletion tbump.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# github_url = "https://github.com/<user or organization>/<project>/"

[version]
current = "0.2.138"
current = "0.2.139"

# Example of a semver regexp.
# Make sure this matches current_version before
Expand Down
Loading