open-autonomy icon indicating copy to clipboard operation
open-autonomy copied to clipboard

Update to CLI: Smoother Flow for Package Upgrade

Open TheGreatAxios opened this issue 3 years ago • 4 comments

CLI Update for Smoother Development Flow

The "Problem" It is not an actual problem, more of an inconvenience. When working on a skill for example, upon each iteration of the skill; the package for the local registry must be deleted after fingerprint. Additionally, the same set of commands needs to be run every time. It would be great to automate the process to update this.

Describe the solution you'd like The solution I would like to see is batch of commands that can all be run with a unique command that utilizes flags to run the commands. After updating a package (i.e skill), the package must be fingerprinted from the vendor dir, then "old" package must be deleted in the <root_dir/packages/author/skills/skill_name> then the new update must be pushed back into packages.

When running the command to push, i.e ```aea push skill <author/package_name>:<#:#:#> --local, the CLI throws an response telling you that the package already exists.

Solution: In the root of the project or in the project <author/agent_dir> be able to run a command such as

autonomy update skill <author/package>

Flag Options:

--local or --remote for the location of the registry (not sure how over writing works with remote yet) --fingerprint [Default is true] , can be set using --fingerprint false to stop the fingerprint --rm (remove) or --ow (overwrite) [Default is true] can be set to false

The last flag is the most important as it would automatically remove the skill | protocol | etc from the packages for that author and enable the new package to be added.

Describe alternatives you've considered I currently have a bash script that does what is described above being stored in a project locally. That does the trick, but a CLI command would be much simpler.

Additional context Current Script:

#!/usr/bin/env bash

# Runs from agent_dir root i.e <root/agent_dir>

set -eou pipefail

cd vendor/<author>

aea fingerprint skill <author>/<skill>:0.1.0

cd ../../

rm -r /Users/<name>/<path-to-agent>/<agent_dir>/../packages/<author>/skills

aea push skill <author>/<skill-name>:0.1.0 --local

aea run

TheGreatAxios avatar Sep 21 '22 14:09 TheGreatAxios

We could add a --force flag to push skill PUBLIC_D --local, so it becomes push skill PUBLIC_D --local --force.

But more generally, I advise against your dev flow. We didn't have much clarity in the docs before - but since today we have this handy guide: https://docs.autonolas.network/guides/managing_packages/

Effectively, we recommend you have a single packages dir (also called "local registry") with packages/packages.json inside it (effectively a lock file). All vendor (i.e. third-party) packages you use regularly can be pinned in the packages.json file and the packages/<vendor> path be added to .gitignore. Then only track your own packages in git and develop inside the packages folder, each package in isolation. You have the benefit that autonomy test by-path PATH lets you test the packages individually during development, optionally with skipping fingerprints autonomy -s test by-path PATH. You can even write integration tests for agents that way, see our packages/agents on this repo. In the coming weeks we are adding many more commands - and improving existing ones - to make it super easy to develop directly inside the local packages (currently - as you can see in the guide - you occasionally need to make an awkward detour via an agent project). Then the agents will only need to be assembled for deployment inside a service (commands for this already exist). Another benefit is that the import paths match the folder structure meaning linters and static tools work out of the box.

DavidMinarsch avatar Sep 21 '22 19:09 DavidMinarsch

You can see the above approach in action here on the El Collectooorr repo from academy 1: https://github.com/valory-xyz/agent-academy-1

DavidMinarsch avatar Sep 21 '22 19:09 DavidMinarsch

@DavidMinarsch Can you please elaborate or point me to a specific area? I am not sure exactly what I am looking for. Thanks

TheGreatAxios avatar Sep 21 '22 19:09 TheGreatAxios

The README and this guide are probably the best place to start at

DavidMinarsch avatar Sep 23 '22 08:09 DavidMinarsch