Skip to content

Commit

Permalink
Merge pull request #244 from valory-xyz/feat/clean
Browse files Browse the repository at this point in the history
chore: cleans up remnants of py3.6, fixes #242
  • Loading branch information
DavidMinarsch authored Jul 31, 2022
2 parents bb5c33f + c7bd004 commit 1ec7e80
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 64 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ If you want to contribute, start working through the codebase, navigate to the G

First, setup your environment by either using the `develop-image` or by following these steps:

- The simplest way to get setup for development on the framework is to install Python `>=3.6` and `pipenv`, then run the following:
- The simplest way to get setup for development on the framework is to install Python `>=3.7` and `pipenv`, then run the following:

make new_env
pipenv shell
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ This is a fork of <a href="https://github.com/fetchai/agents-aea">the original A

## Get started developing AEAs

1. Create and launch a clean virtual environment with Python 3.7 (any Python `>=` 3.6 works):
1. Create and launch a clean virtual environment with Python 3.10 (any Python `>=` 3.7 works):

pipenv --python 3.7 && pipenv shell
pipenv --python 3.10 && pipenv shell

2. Install the package from [PyPI](https://pypi.org/project/open-aea/):

Expand Down Expand Up @@ -96,9 +96,9 @@ You can have more control on the installed dependencies by leveraging the setupt

### Preliminaries

- Create and launch a virtual environment with Python 3.7 (any Python `>=` 3.6 works):
- Create and launch a virtual environment with Python 3.10 (any Python `>=` 3.7 works):

pipenv --python 3.7 && pipenv shell
pipenv --python 3.10 && pipenv shell

- Install the package from source:

Expand Down
2 changes: 1 addition & 1 deletion aea/cli/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _launch_agents(

try:
"""
run in threaded mode and wait for thread finished cause issue with python 3.6/3.7 on windows
run in threaded mode and wait for thread finished cause issue with python 3.7 on windows
probably keyboard interrupt exception gets lost in executor pool or in asyncio module
"""
launcher.start(threaded=True)
Expand Down
9 changes: 0 additions & 9 deletions aea/helpers/async_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@
)


try:
from asyncio import create_task # pylint: disable=ungrouped-imports,unused-import
except ImportError: # pragma: no cover
# for python3.6!
from asyncio import ( # type: ignore # noqa: F401 # pylint: disable=ungrouped-imports,unused-import
ensure_future as create_task,
)


_default_logger = logging.getLogger(__file__)


Expand Down
5 changes: 1 addition & 4 deletions aea/helpers/pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,7 @@ async def close(self) -> None:
self._writer.write_eof()
await self._writer.drain()
self._writer.close()
wait_closed = getattr(self._writer, "wait_closed", None)
if wait_closed:
# in py3.6 writer does not have the coroutine
await wait_closed() # pragma: nocover
self._writer.wait_closed()


class TCPSocketChannel(IPCChannel):
Expand Down
10 changes: 5 additions & 5 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

The AEA framework can be used on `Windows`, `Ubuntu/Debian` and `MacOS`. There are a number of base requirements to be installed prior to usage.

You need <a href="https://www.python.org/downloads/" target="_blank">Python 3.6</a> or higher as well as <a href="https://go.dev/dl/" target="_blank">Go 1.14.2</a> or higher installed.
You need <a href="https://www.python.org/downloads/" target="_blank">Python 3.7</a> or higher as well as <a href="https://go.dev/dl/" target="_blank">Go 1.14.2</a> or higher installed.

​GCC installation is required:

Expand Down Expand Up @@ -35,9 +35,9 @@ python3 --version

<li>Ubuntu/Debian systems only: install Python headers,
depending on the Python version you have installed on your machine.
E.g. for Python 3.8:
E.g. for Python 3.10:
``` bash
sudo apt-get install python3.8-dev
sudo apt-get install python3.10-dev
```
</li>

Expand Down Expand Up @@ -113,10 +113,10 @@ which pipenv

If you don't have it, install it. Instructions are <a href="https://pypi.org/project/pipenv/" target="_blank">here</a>.

Once installed, create a new environment and open it (here we use Python 3.8 but the AEA framework supports any Python >= 3.6).
Once installed, create a new environment and open it (here we use Python 3.10 but the AEA framework supports any Python >= 3.7).

``` bash
touch Pipfile && pipenv --python 3.8 && pipenv shell
touch Pipfile && pipenv --python 3.10 && pipenv shell
```


Expand Down
2 changes: 1 addition & 1 deletion plugins/aea-cli-benchmark/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
"Operating System :: MacOS",
"Operating System :: Microsoft",
"Operating System :: Unix",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Communications",
"Topic :: Internet",
"Topic :: Software Development",
Expand Down
2 changes: 1 addition & 1 deletion plugins/aea-cli-ipfs/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
"Operating System :: MacOS",
"Operating System :: Microsoft",
"Operating System :: Unix",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Communications",
"Topic :: Internet",
"Topic :: Software Development",
Expand Down
2 changes: 1 addition & 1 deletion plugins/aea-ledger-cosmos/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
"Operating System :: MacOS",
"Operating System :: Microsoft",
"Operating System :: Unix",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Communications",
"Topic :: Internet",
"Topic :: Software Development",
Expand Down
2 changes: 1 addition & 1 deletion plugins/aea-ledger-ethereum/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
"Operating System :: MacOS",
"Operating System :: Microsoft",
"Operating System :: Unix",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Communications",
"Topic :: Internet",
"Topic :: Software Development",
Expand Down
2 changes: 1 addition & 1 deletion plugins/aea-ledger-fetchai/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
"Operating System :: MacOS",
"Operating System :: Microsoft",
"Operating System :: Unix",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Communications",
"Topic :: Internet",
"Topic :: Software Development",
Expand Down
4 changes: 2 additions & 2 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ function is_python_version_ok() {
if which python3 2>&1 >/dev/null;
then
version=`python3 -V 2>/dev/null`
if [[ -z `echo $version|grep -E 'Python 3\.[(6789]\.[0-9]+'` ]];
if [[ -z `echo $version|grep -E 'Python 3\.(7|8|9|10)\.[0-9]+'` ]];
then
echo "Python3 version: ${version} is not supported. Supported versions are 3.6, 3.7, 3.8."
echo "Python3 version: ${version} is not supported. Supported versions are 3.7, 3.8, 3.9, 3.10."
return 1
fi
return 0
Expand Down
3 changes: 0 additions & 3 deletions tests/test_cli/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@ def test_run(password_or_none):


@pytest.mark.flaky(reruns=MAX_FLAKY_RERUNS) # flaky on Windows
@pytest.mark.skip(
reason="cannot run on 3.6 as AttributeError: 'functools._lru_list_elem' object has no attribute '__class__'",
)
def test_run_with_profiling():
"""Test profiling data showed."""
runner = CliRunner()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_docs/test_bash_yaml/md_files/bash-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mkdir my_aea_projects/ && cd my_aea_projects/
which pipenv
```
``` bash
touch Pipfile && pipenv --python 3.8 && pipenv shell
touch Pipfile && pipenv --python 3.10 && pipenv shell
```
``` bash
svn export https://github.com/valory-xyz/open-aea.git/trunk/examples
Expand All @@ -48,7 +48,7 @@ svn checkout https://github.com/valory-xyz/open-aea/tags/v1.14.0/packages packag
```

``` bash
sudo apt-get install python3.7-dev
sudo apt-get install python3.10-dev
```
``` bash
aea init --remote
Expand Down
29 changes: 2 additions & 27 deletions tests/test_protocols/test_dialogue/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@
# ------------------------------------------------------------------------------
"""This module contains the tests for the dialogue/base.py module."""
import re
import sys
from typing import FrozenSet, Tuple, Type, cast
from unittest import mock
from unittest.mock import Mock, patch

import pytest

import aea
from aea.common import Address
from aea.configurations.base import PublicId
from aea.exceptions import AEAEnforceError
Expand Down Expand Up @@ -142,12 +139,8 @@ def role_from_first_message( # pylint: disable=unused-argument
)


@pytest.mark.skipif(
sys.version_info < (3, 7),
reason="This part of code is only defined for python version >= 3.7",
)
def test_dialogue_message_python_3_7():
"""Test DiallogueMessage if python is 3.7"""
def test_dialogue_message_python():
"""Test DiallogueMessage."""
dialogue_message = DialogueMessage(DefaultMessage.Performative.BYTES)
assert isinstance(dialogue_message.performative, Message.Performative)

Expand All @@ -157,24 +150,6 @@ def test_dialogue_message_python_3_7():
assert dialogue_message.target is None


@pytest.mark.skipif(
sys.version_info >= (3, 7),
reason="This part of code is only defined for python version < 3.7",
)
def test_dialogue_message_python_3_6():
"""Test DiallogueMessage if python is 3.6"""
with mock.patch.object(
aea.protocols.dialogue.base.sys, "version_info", return_value=(3, 6)
):
dialogue_message = DialogueMessage(DefaultMessage.Performative.BYTES)
assert isinstance(dialogue_message.performative, Message.Performative)

assert dialogue_message.performative == DefaultMessage.Performative.BYTES
assert dialogue_message.contents == {}
assert dialogue_message.is_incoming is None
assert dialogue_message.target is None


class TestDialogueLabel:
"""Test for DialogueLabel."""

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
; we set the associated flag (e.g. for linting we don't need
; the package installation).
[tox]
envlist = bandit, black, black-check, isort, isort-check, copyright_check, docs, flake8, liccheck, mypy, py{3.6,3.7,3.8,3.9}, dependencies_check, plugins_deps
envlist = bandit, black, black-check, isort, isort-check, copyright_check, docs, flake8, liccheck, mypy, py{3.7,3.8,3.9,3.10}, dependencies_check, plugins_deps


[testenv]
Expand Down

0 comments on commit 1ec7e80

Please sign in to comment.