Skip to content

Commit 2aaddb7

Browse files
Merge pull request #1864 from fetchai/develop
Release v0.7.0
2 parents 63e46ce + 9006d02 commit 2aaddb7

599 files changed

Lines changed: 64977 additions & 6756 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ jobs:
185185
matrix:
186186
os: [ubuntu-latest, macos-latest, windows-latest]
187187
python-version: [3.6, 3.7, 3.8]
188-
timeout-minutes: 30
188+
timeout-minutes: 40
189189
steps:
190190
- uses: actions/checkout@master
191191
- uses: actions/setup-python@master

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ input_file
120120
output_file
121121

122122
!packages/fetchai/contracts/erc1155/build
123+
!packages/fetchai/contracts/staking_erc20/build
123124
packages/fetchai/connections/p2p_libp2p/libp2p_node
124125

125126
!tests/data/dummy_contract/build

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ ignored-modules=aiohttp,defusedxml,gym,fetch,matplotlib,memory_profiler,numpy,oe
3434

3535
[DESIGN]
3636
min-public-methods=1
37-
max-public-methods=35
37+
max-public-methods=36

HISTORY.md

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

3+
## 0.7.0 (2020-10-22)
4+
5+
- Adds two AEAs for Agent World 1
6+
- Adds support to apply config overrides to CLI calls transfer and get-wealth
7+
- Adds install scripts to install AEA and dependencies on all major OS (Windows, MacOs, Ubuntu)
8+
- Adds developer mailing list opt-in step to CLI init
9+
- Modifies custom configs in aea-config to use public id
10+
- Adds all non-optional fields in aea-config by default
11+
- Fixes upgrade command to properly handle dependencies of non-vendor packages
12+
- Remove all distributed packages and add them to registry
13+
- Adds public ids to all skill init files and makes it a requirement
14+
- Adds primitive benchmarks for libp2p node
15+
- Adds Prometheus monitoring to libp2p node
16+
- Makes body a private attribute in message base class
17+
- Renames bodyy to body in http protocol
18+
- Adds support for abstract connections
19+
- Refactors protobuf schemas for protocols to avoid code duplication
20+
- Multiple docs updates based on user feedback
21+
- Multiple additional tests and test stability fixes
22+
323
## 0.6.3 (2020-10-16)
424

525
- Adds skill testing tools and documentation

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,20 @@ common_checks: security misc_checks lint static docs
7878

7979
.PHONY: test
8080
test:
81-
pytest -rfE --doctest-modules aea packages/fetchai/protocols packages/fetchai/connections packages/fetchai/skills/generic_buyer tests/ --cov-report=html --cov-report=xml --cov-report=term-missing --cov-report=term --cov=aea --cov=packages/fetchai/protocols --cov=packages/fetchai/connections --cov=packages/fetchai/skills/generic_buyer --cov-config=.coveragerc
81+
pytest -rfE --doctest-modules aea packages/fetchai/protocols packages/fetchai/connections packages/fetchai/skills/generic_buyer packages/fetchai/skills/generic_seller tests/ --cov-report=html --cov-report=xml --cov-report=term-missing --cov-report=term --cov=aea --cov=packages/fetchai/protocols --cov=packages/fetchai/connections --cov=packages/fetchai/skills/generic_buyer --cov-config=.coveragerc
8282
find . -name ".coverage*" -not -name ".coveragerc" -exec rm -fr "{}" \;
8383

8484
.PHONY: test-sub
8585
test-sub:
86-
pytest -rfE --doctest-modules aea packages/fetchai/connections tests/test_$(tdir) --cov=aea.$(dir) --cov-report=html --cov-report=xml --cov-report=term-missing --cov-report=term --cov-config=.coveragerc
86+
pytest -rfE --doctest-modules aea packages/fetchai/connections packages/fetchai/protocols packages/fetchai/skills/generic_buyer packages/fetchai/skills/generic_seller tests/test_$(tdir) --cov=aea.$(dir) --cov-report=html --cov-report=xml --cov-report=term-missing --cov-report=term --cov-config=.coveragerc
8787
find . -name ".coverage*" -not -name ".coveragerc" -exec rm -fr "{}" \;
8888

89+
.PHONY: test-sub-p
90+
test-sub-p:
91+
pytest -rfE --doctest-modules aea packages/fetchai/connections packages/fetchai/protocols packages/fetchai/skills/generic_buyer packages/fetchai/skills/generic_seller tests/test_packages/test_$(tdir) --cov=packages.fetchai.$(dir) --cov-report=html --cov-report=xml --cov-report=term-missing --cov-report=term --cov-config=.coveragerc
92+
find . -name ".coverage*" -not -name ".coveragerc" -exec rm -fr "{}" \;
93+
94+
8995
.PHONY: test-all
9096
test-all:
9197
tox

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.6.3"
25+
__version__ = "0.7.0"
2626
__author__ = "Fetch.AI Limited"
2727
__license__ = "Apache-2.0"
2828
__copyright__ = "2019 Fetch.AI Limited"

aea/aea.py

Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
List,
3131
Optional,
3232
Sequence,
33+
TYPE_CHECKING,
3334
Tuple,
3435
Type,
3536
cast,
@@ -38,26 +39,31 @@
3839
from aea.agent import Agent
3940
from aea.agent_loop import AsyncAgentLoop, BaseAgentLoop, SyncAgentLoop
4041
from aea.configurations.base import PublicId
41-
from aea.configurations.constants import DEFAULT_SKILL
42+
from aea.configurations.constants import (
43+
DEFAULT_PROTOCOL,
44+
DEFAULT_SEARCH_SERVICE_ADDRESS,
45+
DEFAULT_SKILL,
46+
)
4247
from aea.connections.base import Connection
4348
from aea.context.base import AgentContext
4449
from aea.crypto.wallet import Wallet
4550
from aea.decision_maker.base import DecisionMakerHandler
46-
from aea.decision_maker.default import (
47-
DecisionMakerHandler as DefaultDecisionMakerHandler,
48-
)
4951
from aea.exceptions import AEAException
5052
from aea.helpers.exception_policy import ExceptionPolicyEnum
5153
from aea.helpers.logging import AgentLoggerAdapter, get_logger
5254
from aea.identity.base import Identity
5355
from aea.mail.base import Envelope
54-
from aea.protocols.base import Message
55-
from aea.protocols.default.message import DefaultMessage
56+
from aea.protocols.base import Message, Protocol
5657
from aea.registries.filter import Filter
5758
from aea.registries.resources import Resources
5859
from aea.runtime import _StopRuntime
5960
from aea.skills.base import Behaviour, Handler
60-
from aea.skills.error.handlers import ErrorHandler
61+
62+
63+
if TYPE_CHECKING:
64+
from packages.fetchai.skills.error.handlers import ( # noqa: F401 # pragma: nocover
65+
ErrorHandler,
66+
)
6167

6268

6369
class AEA(Agent):
@@ -78,17 +84,15 @@ def __init__(
7884
period: float = 0.05,
7985
execution_timeout: float = 0,
8086
max_reactions: int = 20,
81-
decision_maker_handler_class: Type[
82-
DecisionMakerHandler
83-
] = DefaultDecisionMakerHandler,
87+
decision_maker_handler_class: Optional[Type[DecisionMakerHandler]] = None,
8488
skill_exception_policy: ExceptionPolicyEnum = ExceptionPolicyEnum.propagate,
8589
connection_exception_policy: ExceptionPolicyEnum = ExceptionPolicyEnum.propagate,
8690
loop_mode: Optional[str] = None,
8791
runtime_mode: Optional[str] = None,
8892
default_connection: Optional[PublicId] = None,
8993
default_routing: Optional[Dict[PublicId, PublicId]] = None,
9094
connection_ids: Optional[Collection[PublicId]] = None,
91-
search_service_address: str = "fetchai/soef:*",
95+
search_service_address: str = DEFAULT_SEARCH_SERVICE_ADDRESS,
9296
**kwargs,
9397
) -> None:
9498
"""
@@ -132,6 +136,13 @@ def __init__(
132136
)
133137

134138
self.max_reactions = max_reactions
139+
140+
if decision_maker_handler_class is None:
141+
from aea.decision_maker.default import ( # isort:skip # pylint: disable=import-outside-toplevel
142+
DecisionMakerHandler as DefaultDecisionMakerHandler,
143+
)
144+
145+
decision_maker_handler_class = DefaultDecisionMakerHandler
135146
decision_maker_handler = decision_maker_handler_class(
136147
identity=identity, wallet=wallet
137148
)
@@ -229,38 +240,37 @@ def get_multiplexer_setup_options(self) -> Optional[Dict]:
229240
default_connection=self.context.default_connection,
230241
)
231242

232-
def _get_error_handler(self) -> Optional[Handler]:
243+
def _get_error_handler(self) -> Handler:
233244
"""Get error handler."""
234-
return self.resources.get_handler(DefaultMessage.protocol_id, DEFAULT_SKILL)
245+
handler = self.resources.get_handler(DEFAULT_PROTOCOL, DEFAULT_SKILL)
246+
if handler is None:
247+
self.logger.warning("ErrorHandler not initialized. Stopping AEA!")
248+
raise _StopRuntime()
249+
return handler
235250

236251
def _get_msg_and_handlers_for_envelope(
237252
self, envelope: Envelope
238253
) -> Tuple[Optional[Message], List[Handler]]:
239254
protocol = self.resources.get_protocol(envelope.protocol_id)
240255

256+
msg, handlers = self._handle_decoding(envelope, protocol)
257+
258+
return msg, handlers
259+
260+
def _handle_decoding(
261+
self, envelope: Envelope, protocol: Optional[Protocol]
262+
) -> Tuple[Optional[Message], List[Handler]]:
241263
error_handler = self._get_error_handler()
242264

243-
if error_handler is None:
244-
self.logger.warning("ErrorHandler not initialized. Stopping AEA!")
245-
raise _StopRuntime()
265+
from packages.fetchai.skills.error.handlers import ( # noqa: F811 # pylint: disable=import-outside-toplevel
266+
ErrorHandler,
267+
)
246268

247269
error_handler = cast(ErrorHandler, error_handler)
248270

249271
if protocol is None:
250272
error_handler.send_unsupported_protocol(envelope)
251-
return None, []
252-
253-
if isinstance(envelope.message, Message):
254-
msg = envelope.message
255-
else:
256-
try:
257-
msg = protocol.serializer.decode(envelope.message)
258-
msg.sender = envelope.sender
259-
msg.to = envelope.to
260-
except Exception as e: # pylint: disable=broad-except # thats ok, because we send the decoding error back
261-
self.logger.warning("Decoding error. Exception: {}".format(str(e)))
262-
error_handler.send_decoding_error(envelope)
263-
return None, []
273+
return None, [] # Tuple[Optional[Message], List[Handler]]
264274

265275
handlers = self.filter.get_active_handlers(
266276
protocol.public_id, envelope.skill_id
@@ -270,7 +280,18 @@ def _get_msg_and_handlers_for_envelope(
270280
error_handler.send_unsupported_skill(envelope)
271281
return None, []
272282

273-
return msg, handlers
283+
if isinstance(envelope.message, Message):
284+
msg = envelope.message
285+
return msg, handlers
286+
try:
287+
msg = protocol.serializer.decode(envelope.message)
288+
msg.sender = envelope.sender
289+
msg.to = envelope.to
290+
return msg, handlers
291+
except Exception as e: # pylint: disable=broad-except # thats ok, because we send the decoding error back
292+
self.logger.warning("Decoding error. Exception: {}".format(str(e)))
293+
error_handler.send_decoding_error(envelope)
294+
return None, []
274295

275296
def handle_envelope(self, envelope: Envelope) -> None:
276297
"""

0 commit comments

Comments
 (0)