Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
ARIA-405 Remove support for Python 2.6
* setup.py now requires Python 2.7
* Upgrade all 3rd party libraries to recent versions
* API changes to networkx
* Stricter yaml.load call for ruamel.yaml
* Remove iter_modules implementation for Python 2.6
* Remove NullHander implementation for Python 2.6
* Remove "py26" tox test environments
  • Loading branch information
tliron committed Oct 30, 2017
1 parent ae89ddb commit b1f03efcedd814f5fe38f051bfa0106cc715586f
Showing 17 changed files with 80 additions and 165 deletions.
@@ -19,34 +19,19 @@ sudo: true

language: python

addons:
apt:
sources:
- sourceline: 'ppa:fkrull/deadsnakes'
packages:
# Ubuntu 14.04 (trusty) does not come with Python 2.6, so we will install it from Felix
# Krull's PPA
- python2.6
- python2.6-dev

python:
# We handle Python 2.6 testing from within tox (see tox.ini); note that this means that we run
# tox itself always from Python 2.7
- '2.7'

env:
# The PYTEST_PROCESSES environment var is used in tox.ini to override the --numprocesses argument
# for PyTest's xdist plugin. The reason this is necessary is that conventional Travis environments
# may report a large amount of available CPUs, but they they are greatly restricted. Through trial
# and error we found that more than 1 process may result in failures.
- PYTEST_PROCESSES=1 TOX_ENV=pylint_code
- PYTEST_PROCESSES=1 TOX_ENV=pylint_core
- PYTEST_PROCESSES=1 TOX_ENV=pylint_tests
- PYTEST_PROCESSES=1 TOX_ENV=py27
- PYTEST_PROCESSES=1 TOX_ENV=py26
- PYTEST_PROCESSES=1 TOX_ENV=py27e2e
- PYTEST_PROCESSES=1 TOX_ENV=py26e2e
- PYTEST_PROCESSES=1 TOX_ENV=py27ssh
- PYTEST_PROCESSES=1 TOX_ENV=py26ssh
- PYTEST_PROCESSES=1 TOX_ENV=core
- PYTEST_PROCESSES=1 TOX_ENV=e2e
- PYTEST_PROCESSES=1 TOX_ENV=ssh
- PYTEST_PROCESSES=1 TOX_ENV=docs

before_install:
@@ -51,11 +51,11 @@ docs:

test:
pip install --upgrade "tox>=2.7.0"
tox -e pylint_code \
tox -e pylint_core \
-e pylint_tests \
-e py$(PYTHON_VERSION) \
-e py$(PYTHON_VERSION)e2e \
-e py$(PYTHON_VERSION)ssh \
-e core \
-e e2e \
-e ssh \
-e docs

./requirements.txt: ./requirements.in
@@ -28,7 +28,7 @@ Installation

ARIA is `available on PyPI <https://pypi.python.org/pypi/apache-ariatosca>`__.

ARIA requires Python 2.6/2.7. Python 3 is currently not supported.
ARIA requires Python 2.7. Python 3 is currently not supported.

To install ARIA directly from PyPI (using a ``wheel``), use::

@@ -78,14 +78,12 @@ and run::
# TODO



To install ``pip``, either use your operating system's package management system, or run::

wget http://bootstrap.pypa.io/get-pip.py
python get-pip.py



Getting Started
---------------

@@ -168,9 +166,8 @@ ARIA is licensed under the
.. |Closed Pull Requests| image:: https://img.shields.io/github/issues-pr-closed-raw/apache/incubator-ariatosca.svg
:target: https://github.com/apache/incubator-ariatosca/pulls?q=is%3Apr+is%3Aclosed


Code of Conduct
---------------

The ARIA TOSCA Project follows `The Apache Code of Conduct <https://www.apache.org/foundation/policies/conduct.html>`__.


@@ -14,7 +14,7 @@
# limitations under the License.

environment:
TOX_ENV: pywin
TOX_ENV: windows

matrix:
- PYTHON: "C:\\Python27"
@@ -19,7 +19,9 @@

import sys

from pkgutil import iter_modules
import pkg_resources

aria_package_name = 'apache-ariatosca'
__version__ = pkg_resources.get_distribution(aria_package_name).version

@@ -34,13 +36,6 @@
cli
)

if sys.version_info < (2, 7):
# pkgutil in python2.6 has a bug where it fails to import from protected modules, which causes
# the entire process to fail. In order to overcome this issue we use our custom iter_modules
from .utils.imports import iter_modules
else:
from pkgutil import iter_modules

__all__ = (
'__version__',
'workflow',
@@ -127,7 +127,7 @@ def entry_definitions(self):
@property
def entry_definitions_yaml(self):
with open(os.path.join(self.destination, self.entry_definitions)) as f:
return yaml.load(f)
return yaml.load(f, Loader=yaml.SafeLoader)

def _extract(self):
self.logger.debug('Extracting CSAR contents')
@@ -144,7 +144,7 @@ def _read_metadata(self):
self.logger.debug('CSAR metadata file: {0}'.format(csar_metafile))
self.logger.debug('Attempting to parse CSAR metadata YAML')
with open(csar_metafile) as f:
self.metadata.update(yaml.load(f))
self.metadata.update(yaml.load(f, Loader=yaml.SafeLoader))
self.logger.debug('CSAR metadata:{0}{1}'.format(os.linesep, pprint.pformat(self.metadata)))

def _validate(self):
@@ -88,10 +88,10 @@ def _parse_yaml_path(resource):
# if resource is a path - parse as a yaml file
if os.path.isfile(resource):
with open(resource) as f:
content = yaml.load(f.read())
content = yaml.load(f.read(), Loader=yaml.SafeLoader)
else:
# parse resource content as yaml
content = yaml.load(resource)
content = yaml.load(resource, Loader=yaml.SafeLoader)
except yaml.error.YAMLError as e:
raise AriaCliError("'{0}' is not a valid YAML. {1}".format(
resource, str(e)))
@@ -19,15 +19,7 @@
"""

import logging
from logging import handlers as logging_handlers
# NullHandler doesn't exist in < 27. this workaround is from
# http://docs.python.org/release/2.6/library/logging.html#configuring-logging-for-a-library
try:
from logging import NullHandler # pylint: disable=unused-import
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
from logging import (handlers as logging_handlers, NullHandler)
from datetime import datetime


@@ -69,7 +69,7 @@ def tasks(self):
"""
Iterator over tasks in the graph.
"""
for _, data in self._graph.nodes_iter(data=True):
for _, data in self._graph.nodes(data=True):
yield data['task']

def topological_order(self, reverse=False):
@@ -79,7 +79,10 @@ def topological_order(self, reverse=False):
:param reverse: whether to reverse the sort
:return: list which represents the topological sort
"""
for task_id in topological_sort(self._graph, reverse=reverse):
task_ids = topological_sort(self._graph)
if reverse:
task_ids = reversed(tuple(task_ids))
for task_id in task_ids:
yield self.get_task(task_id)

def get_dependencies(self, dependent_task):
@@ -92,7 +95,7 @@ def get_dependencies(self, dependent_task):
"""
if not self.has_tasks(dependent_task):
raise TaskNotInGraphError('Task id: {0}'.format(dependent_task.id))
for _, dependency_id in self._graph.out_edges_iter(dependent_task.id):
for _, dependency_id in self._graph.out_edges(dependent_task.id):
yield self.get_task(dependency_id)

def get_dependents(self, dependency_task):
@@ -105,7 +108,7 @@ def get_dependents(self, dependency_task):
"""
if not self.has_tasks(dependency_task):
raise TaskNotInGraphError('Task id: {0}'.format(dependency_task.id))
for dependent_id, _ in self._graph.in_edges_iter(dependency_task.id):
for dependent_id, _ in self._graph.in_edges(dependency_task.id):
yield self.get_task(dependent_id)

# task methods
@@ -17,7 +17,6 @@
Utilities for dynamically loading Python code.
"""

import pkgutil
import importlib


@@ -77,20 +76,3 @@ def load_attribute(attribute_path):
except AttributeError:
# TODO: handle
raise


def iter_modules():
# apparently pkgutil had some issues in python 2.6. Accessing any root level directories
# failed. and it got the entire process of importing fail. Since we only need any
# aria_extension related loading, in the meantime we could try to import only those
# (and assume they are not located at the root level.
# [In python 2.7 it does actually ignore any OSError].
yielded = {}
for importer in pkgutil.iter_importers():
try:
for module_name, ispkg in pkgutil.iter_importer_modules(importer):
if module_name not in yielded:
yielded[module_name] = True
yield importer, module_name, ispkg
except OSError:
pass
@@ -397,7 +397,7 @@ def create_operation_template_model(context, service_template, operation):

# Parse as YAML
try:
value = yaml.load(value)
value = yaml.load(value, Loader=yaml.SafeLoader)
except yaml.parser.MarkedYAMLError as e:
context.validation.report(
'YAML parser {0} in operation configuration: {1}'
@@ -13,27 +13,23 @@
# In order to create the requirements.txt file, execute
# pip-compile --output-file requirements.txt requirements.in (pip-tools package is needed).

requests>=2.3.0, <2.14.0
networkx>=1.9, <1.10 # version 1.10 dropped support of python 2.6
retrying>=1.3.0, <1.4.0
blinker>1.3, <1.5
jsonpickle>0.9.0, <=0.9.4
ruamel.yaml>=0.11.12, <0.12.0 # version 0.12.0 dropped support of python 2.6
Jinja2>=2.8, <2.9
shortuuid>=0.5, <0.6
backports.shutil_get_terminal_size>=1, <2
blinker>=1.4, <1.5
bottle>=0.12, <0.13
CacheControl[filecache]>=0.11.0, <0.13
SQLAlchemy>=1.1.0, <1.2 # version 1.2 dropped support of python 2.6
wagon==0.6.0
bottle>=0.12.0, <0.13
setuptools>=35.0.0, <36.0.0
click>=6.0, < 7.0
colorama>=0.3.7, <=0.3.9
PrettyTable>=0.7,<0.8
click_didyoumean==0.0.3
backports.shutil_get_terminal_size==1.0.0
logutils==0.3.4.1
psutil>=5.2.2, < 6.0.0
importlib ; python_version < '2.7'
ordereddict ; python_version < '2.7'
total-ordering ; python_version < '2.7' # only one version on pypi
wheel<=0.29.0 ; python_version < '2.7'
click>=6, < 7
click_didyoumean>=0.0.3, <0.1
colorama>=0.3, <=0.4
Jinja2>=2.9, <3.0
jsonpickle>=0.9, <=1.0
logutils>=0.3, <0.4
networkx>=2.0, <2.1
PrettyTable>=0.7, <0.8
psutil>=5.4, <5.5
requests>=2.3, <2.14
retrying>=1.3, <1.4
ruamel.yaml>=0.15, <0.16
setuptools>=36, <37
shortuuid>=0.5, <0.6
SQLAlchemy>=1.1, <1.2
wagon>=0.6, <0.7
@@ -2,40 +2,34 @@
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file requirements.txt requirements.in
# pip-compile --output-file ./requirements.txt ./requirements.in
#
appdirs==1.4.3 # via setuptools
backports.shutil_get_terminal_size==1.0.0
backports.shutil-get-terminal-size==1.0.0
blinker==1.4
bottle==0.12.13
cachecontrol[filecache]==0.12.1
click-didyoumean==0.0.3
click==6.7
click_didyoumean==0.0.3
colorama==0.3.9
decorator==4.0.11 # via networkx
importlib==1.0.4 ; python_version < "2.7"
jinja2==2.8.1
decorator==4.1.2 # via networkx
jinja2==2.9.6
jsonpickle==0.9.4
lockfile==0.12.2 # via cachecontrol
logutils==0.3.4.1
markupsafe==1.0 # via jinja2
msgpack-python==0.4.8 # via cachecontrol
networkx==1.9.1
ordereddict==1.1 ; python_version < "2.7"
packaging==16.8 # via setuptools
networkx==2.0
prettytable==0.7.2
psutil==5.2.2
pyparsing==2.2.0 # via packaging
psutil==5.4.0
requests==2.13.0
retrying==1.3.3
ruamel.ordereddict==0.4.9 # via ruamel.yaml
ruamel.yaml==0.11.15
ruamel.yaml==0.15.34
shortuuid==0.5.0
six==1.10.0 # via packaging, retrying, setuptools
six==1.10.0 # via retrying
sqlalchemy==1.1.6
total-ordering==0.1.0 ; python_version < "2.7"
wagon==0.6.0
wheel==0.29.0 ; python_version < "2.7"
wheel==0.29.0 # via wagon

# The following packages are considered to be unsafe in a requirements file:
setuptools==35.0.2
# setuptools

0 comments on commit b1f03ef

Please sign in to comment.