Skip to content

Commit e888b4c

Browse files
Merge pull request #1963 from fetchai/develop
Release v0.7.4
2 parents 0ec1b5f + 2a77b40 commit e888b4c

225 files changed

Lines changed: 5279 additions & 1546 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/workflow.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ jobs:
6060
run: tox -e mypy
6161
- name: Golang code style check
6262
uses: golangci/golangci-lint-action@v1
63+
env:
64+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
6365
with:
6466
version: v1.28
6567
working-directory: packages/fetchai/connections/p2p_libp2p/
@@ -211,6 +213,8 @@ jobs:
211213
brew install protobuf
212214
- if: matrix.os == 'windows-latest'
213215
name: Install dependencies (windows-latest)
216+
env:
217+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
214218
run: |
215219
pip install tox
216220
echo "::add-path::C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64"

HISTORY.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Release History
22

3+
## 0.7.4 (2020-11-18)
4+
5+
- Replaces error skill handler usage with built in handler
6+
- Extends MultiAgentManager to support persistence between runs
7+
- Replaces usage of Ropsten testnet with Ganache
8+
- Adds support for symlink creation during scaffold and add
9+
- Makes contract interface loading extensible
10+
- Adds support for PEP561
11+
- Adds integration tests for launcher command
12+
- Adds support for storage of unique page address in SOEF
13+
- Fixes publish command bug on Windows
14+
- Refactors constants usage throughout
15+
- Adds support for profiling on aea run
16+
- Multiple stability improvements to core async modules
17+
- Multiple docs updates based on user feedback
18+
- Multiple additional tests and test stability fixes
19+
320
## 0.7.3 (2020-11-12)
421

522
- Extends AW AEAs

aea/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
__title__ = "aea"
2323
__description__ = "Autonomous Economic Agent framework"
2424
__url__ = "https://github.com/fetchai/agents-aea.git"
25-
__version__ = "0.7.3"
25+
__version__ = "0.7.4"
2626
__author__ = "Fetch.AI Limited"
2727
__license__ = "Apache-2.0"
2828
__copyright__ = "2019 Fetch.AI Limited"

aea/aea.py

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
List,
3131
Optional,
3232
Sequence,
33-
TYPE_CHECKING,
3433
Tuple,
3534
Type,
3635
cast,
@@ -48,6 +47,7 @@
4847
from aea.exceptions import AEAException, _StopRuntime
4948
from aea.helpers.exception_policy import ExceptionPolicyEnum
5049
from aea.helpers.logging import AgentLoggerAdapter, get_logger
50+
from aea.helpers.temp_error_handler import ErrorHandler
5151
from aea.identity.base import Identity
5252
from aea.mail.base import Envelope
5353
from aea.protocols.base import Message, Protocol
@@ -56,12 +56,6 @@
5656
from aea.skills.base import Behaviour, Handler
5757

5858

59-
if TYPE_CHECKING:
60-
from packages.fetchai.skills.error.handlers import ( # noqa: F401 # pragma: nocover
61-
ErrorHandler,
62-
)
63-
64-
6559
class AEA(Agent):
6660
"""This class implements an autonomous economic agent."""
6761

@@ -252,28 +246,16 @@ def get_multiplexer_setup_options(self) -> Optional[Dict]:
252246
default_connection=self.context.default_connection,
253247
)
254248

255-
def _get_error_handler(self) -> Handler:
249+
@staticmethod
250+
def _get_error_handler() -> Type[ErrorHandler]:
256251
"""Get error handler."""
257-
258-
# temporary hack
259-
from packages.fetchai.protocols.default.message import ( # noqa: F811 # pylint: disable=import-outside-toplevel
260-
DefaultMessage,
261-
)
262-
from packages.fetchai.skills.error import ( # noqa: F811 # pylint: disable=import-outside-toplevel
263-
PUBLIC_ID as ERROR_SKILL_PUBLIC_ID,
264-
)
265-
266-
handler = self.resources.get_handler(
267-
DefaultMessage.protocol_id, ERROR_SKILL_PUBLIC_ID
268-
)
269-
if handler is None:
270-
self.logger.warning("ErrorHandler not initialized. Stopping AEA!")
271-
raise _StopRuntime()
252+
handler = ErrorHandler
272253
return handler
273254

274255
def _get_msg_and_handlers_for_envelope(
275256
self, envelope: Envelope
276257
) -> Tuple[Optional[Message], List[Handler]]:
258+
"""Get the msg and its handlers."""
277259
protocol = self.resources.get_protocol(envelope.protocol_id)
278260

279261
msg, handlers = self._handle_decoding(envelope, protocol)
@@ -283,25 +265,19 @@ def _get_msg_and_handlers_for_envelope(
283265
def _handle_decoding(
284266
self, envelope: Envelope, protocol: Optional[Protocol]
285267
) -> Tuple[Optional[Message], List[Handler]]:
286-
error_handler = self._get_error_handler()
287-
288-
# temporary hack
289-
from packages.fetchai.skills.error.handlers import ( # noqa: F811 # pylint: disable=import-outside-toplevel
290-
ErrorHandler,
291-
)
292268

293-
error_handler = cast(ErrorHandler, error_handler)
269+
handler = self._get_error_handler()
294270

295271
if protocol is None:
296-
error_handler.send_unsupported_protocol(envelope)
272+
handler.send_unsupported_protocol(envelope, self.logger)
297273
return None, [] # Tuple[Optional[Message], List[Handler]]
298274

299275
handlers = self.filter.get_active_handlers(
300276
protocol.public_id, envelope.skill_id
301277
)
302278

303279
if len(handlers) == 0:
304-
error_handler.send_unsupported_skill(envelope)
280+
handler.send_unsupported_skill(envelope, self.logger)
305281
return None, []
306282

307283
if isinstance(envelope.message, Message):
@@ -314,7 +290,7 @@ def _handle_decoding(
314290
return msg, handlers
315291
except Exception as e: # pylint: disable=broad-except # thats ok, because we send the decoding error back
316292
self.logger.warning("Decoding error. Exception: {}".format(str(e)))
317-
error_handler.send_decoding_error(envelope)
293+
handler.send_decoding_error(envelope, self.logger)
318294
return None, []
319295

320296
def handle_envelope(self, envelope: Envelope) -> None:

aea/aea_builder.py

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,40 @@
4343
ComponentType,
4444
ConnectionConfig,
4545
ContractConfig,
46-
DEFAULT_AEA_CONFIG_FILE,
4746
Dependencies,
4847
PackageType,
4948
ProtocolConfig,
5049
PublicId,
5150
SkillConfig,
5251
)
5352
from aea.configurations.constants import (
53+
CONNECTIONS,
54+
DEFAULT_AEA_CONFIG_FILE,
5455
DEFAULT_CONNECTION,
56+
DEFAULT_ENV_DOTFILE,
5557
DEFAULT_LEDGER,
5658
DEFAULT_PROTOCOL,
59+
DEFAULT_REGISTRY_NAME,
5760
)
5861
from aea.configurations.constants import (
5962
DEFAULT_SEARCH_SERVICE_ADDRESS as _DEFAULT_SEARCH_SERVICE_ADDRESS,
6063
)
6164
from aea.configurations.constants import (
6265
DEFAULT_SKILL,
66+
FETCHAI,
67+
PROTOCOLS,
6368
SIGNING_PROTOCOL,
69+
SKILLS,
6470
STATE_UPDATE_PROTOCOL,
71+
VENDOR,
6572
)
6673
from aea.configurations.loader import ConfigLoader, load_component_configuration
6774
from aea.configurations.pypi import is_satisfiable, merge_dependencies
6875
from aea.crypto.helpers import verify_or_create_private_keys
6976
from aea.crypto.ledger_apis import DEFAULT_CURRENCY_DENOMINATIONS
7077
from aea.crypto.wallet import Wallet
7178
from aea.decision_maker.base import DecisionMakerHandler
72-
from aea.exceptions import AEAException
79+
from aea.exceptions import AEAException, AEAValidationError
7380
from aea.helpers.base import find_topological_order, load_env_file, load_module
7481
from aea.helpers.exception_policy import ExceptionPolicyEnum
7582
from aea.helpers.install_dependency import install_dependency
@@ -81,7 +88,6 @@
8188
PathLike = Union[os.PathLike, Path, str]
8289

8390
_default_logger = logging.getLogger(__name__)
84-
DEFAULT_ENV_DOTFILE = ".env"
8591

8692

8793
class _DependenciesManager:
@@ -281,7 +287,7 @@ class AEABuilder(WithLogger): # pylint: disable=too-many-public-methods
281287
"""
282288

283289
DEFAULT_LEDGER = DEFAULT_LEDGER
284-
DEFAULT_CONNECTION = DEFAULT_CONNECTION
290+
DEFAULT_CONNECTION = PublicId.from_str(DEFAULT_CONNECTION)
285291
DEFAULT_CURRENCY_DENOMINATIONS = DEFAULT_CURRENCY_DENOMINATIONS
286292
DEFAULT_AGENT_ACT_PERIOD = 0.05 # seconds
287293
DEFAULT_EXECUTION_TIMEOUT = 0
@@ -297,7 +303,9 @@ class AEABuilder(WithLogger): # pylint: disable=too-many-public-methods
297303
# pylint: disable=attribute-defined-outside-init
298304

299305
def __init__(
300-
self, with_default_packages: bool = True, registry_dir: str = "packages"
306+
self,
307+
with_default_packages: bool = True,
308+
registry_dir: str = DEFAULT_REGISTRY_NAME,
301309
):
302310
"""
303311
Initialize the builder.
@@ -516,24 +524,27 @@ def set_search_service_address(
516524
def _add_default_packages(self) -> None:
517525
"""Add default packages."""
518526
# add default protocol
527+
default_protocol = PublicId.from_str(DEFAULT_PROTOCOL)
519528
self.add_protocol(
520-
Path(self.registry_dir, "fetchai", "protocols", DEFAULT_PROTOCOL.name)
529+
Path(self.registry_dir, FETCHAI, PROTOCOLS, default_protocol.name)
521530
)
522531
# add signing protocol
532+
signing_protocol = PublicId.from_str(SIGNING_PROTOCOL)
523533
self.add_protocol(
524-
Path(self.registry_dir, "fetchai", "protocols", SIGNING_PROTOCOL.name)
534+
Path(self.registry_dir, FETCHAI, PROTOCOLS, signing_protocol.name)
525535
)
526536
# add state update protocol
537+
state_update_protocol = PublicId.from_str(STATE_UPDATE_PROTOCOL)
527538
self.add_protocol(
528-
Path(self.registry_dir, "fetchai", "protocols", STATE_UPDATE_PROTOCOL.name)
539+
Path(self.registry_dir, FETCHAI, PROTOCOLS, state_update_protocol.name)
529540
)
530-
531541
# add stub connection
532542
self.add_connection(
533-
Path(self.registry_dir, "fetchai", "connections", DEFAULT_CONNECTION.name)
543+
Path(self.registry_dir, FETCHAI, CONNECTIONS, self.DEFAULT_CONNECTION.name)
534544
)
535545
# add error skill
536-
self.add_skill(Path(self.registry_dir, "fetchai", "skills", DEFAULT_SKILL.name))
546+
default_skill = PublicId.from_str(DEFAULT_SKILL)
547+
self.add_skill(Path(self.registry_dir, FETCHAI, SKILLS, default_skill.name))
537548

538549
def _check_can_remove(self, component_id: ComponentId) -> None:
539550
"""
@@ -1156,7 +1167,7 @@ def find_component_directory_from_component_id(
11561167
# search in vendor first
11571168
vendor_package_path = (
11581169
aea_project_directory
1159-
/ "vendor"
1170+
/ VENDOR
11601171
/ component_id.public_id.author
11611172
/ component_id.component_type.to_plural()
11621173
/ component_id.public_id.name
@@ -1185,13 +1196,13 @@ def _try_to_load_agent_configuration_file(aea_project_path: Path) -> None:
11851196
agent_configuration = loader.load(fp)
11861197
logging.config.dictConfig(agent_configuration.logging_config) # type: ignore
11871198
except FileNotFoundError: # pragma: nocover
1188-
raise Exception(
1199+
raise ValueError(
11891200
"Agent configuration file '{}' not found in the current directory.".format(
11901201
DEFAULT_AEA_CONFIG_FILE
11911202
)
11921203
)
11931204
except jsonschema.exceptions.ValidationError: # pragma: nocover
1194-
raise Exception(
1205+
raise AEAValidationError(
11951206
"Agent configuration file '{}' is invalid. Please check the documentation.".format(
11961207
DEFAULT_AEA_CONFIG_FILE
11971208
)
@@ -1345,9 +1356,9 @@ def _find_import_order(
13451356
if component_id not in dependency_to_supported_dependencies:
13461357
dependency_to_supported_dependencies[component_id] = set()
13471358
if isinstance(configuration, SkillConfig):
1348-
dependencies, component_type = configuration.skills, "skills"
1359+
dependencies, component_type = configuration.skills, SKILLS
13491360
elif isinstance(configuration, ConnectionConfig):
1350-
dependencies, component_type = configuration.connections, "connections"
1361+
dependencies, component_type = configuration.connections, CONNECTIONS
13511362
else:
13521363
raise AEAException("Not a valid configuration type.") # pragma: nocover
13531364
for dependency in dependencies:

aea/agent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from typing import Any, Callable, Dict, List, Optional, Tuple, Type
2626

2727
from aea.abstract_agent import AbstractAgent
28+
from aea.configurations.constants import CONNECTIONS
2829
from aea.connections.base import Connection
2930
from aea.exceptions import AEAException
3031
from aea.helpers.logging import WithLogger
@@ -116,7 +117,7 @@ def get_multiplexer_setup_options(self) -> Optional[Dict]:
116117
117118
:return: dict of kwargs
118119
"""
119-
return {"connections": self.active_connections}
120+
return {CONNECTIONS: self.active_connections}
120121

121122
@property
122123
def identity(self) -> Identity:

0 commit comments

Comments
 (0)