diff --git a/.travis.yml b/.travis.yml index 7916832e..e791c10a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: python sudo: false python: - - 2.6 - 2.7 - 3.3 - 3.4 diff --git a/README.rst b/README.rst index d698bc7c..f9f16460 100644 --- a/README.rst +++ b/README.rst @@ -96,7 +96,7 @@ understands, see: `Features `_. A list of caveats can be found on the same page. -You can run Jedi on cPython 2.6, 2.7, 3.3, 3.4 or 3.5 but it should also +You can run Jedi on CPython 2.7 or 3.3+ but it should also understand/parse code older than those versions. Tips on how to use Jedi efficiently can be found `here diff --git a/docs/docs/features.rst b/docs/docs/features.rst index ad4e900c..c8f478ba 100644 --- a/docs/docs/features.rst +++ b/docs/docs/features.rst @@ -20,7 +20,7 @@ make it work. General Features ---------------- -- python 2.6+ and 3.3+ support +- Python 2.7 and 3.3+ support - ignores syntax errors and wrong indentation - can deal with complex module / function / class structures - virtualenv support @@ -64,7 +64,7 @@ Not yet implemented: - manipulations of instances outside the instance variables without using methods -- implicit namespace packages (Python 3.3+, `PEP 420 `_) +- implicit namespace packages (Python 3.4+, `PEP 420 `_) Will probably never be implemented: @@ -88,7 +88,7 @@ etc. **Security** Security is an important issue for |jedi|. Therefore no Python code is -executed. As long as you write pure python, everything is evaluated +executed. As long as you write pure Python, everything is evaluated statically. But: If you use builtin modules (``c_builtin``) there is no other option than to execute those modules. However: Execute isn't that critical (as e.g. in pythoncomplete, which used to execute *every* import!), because it @@ -117,7 +117,7 @@ one of the following docstring/annotation syntax styles: https://www.python.org/dev/peps/pep-0484/ -function annotations (python 3 only; python 2 function annotations with +function annotations (Python 3 only; Python 2 function annotations with comments in planned but not yet implemented) :: @@ -129,7 +129,7 @@ comments in planned but not yet implemented) node.| # complete here -assignment, for-loop and with-statement type hints (all python versions). +assignment, for-loop and with-statement type hints (all Python versions). Note that the type hints must be on the same line as the statement :: @@ -142,7 +142,7 @@ Note that the type hints must be on the same line as the statement print(f + 3) Most of the features in PEP-0484 are supported including the typing module -(for python < 3.5 you have to do ``pip install typing`` to use these), +(for Python < 3.5 you have to do ``pip install typing`` to use these), and forward references. Things that are missing (and this is not an exhaustive list; some of these diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index 52a20fe2..7ee82160 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -1,5 +1,5 @@ """ -To ensure compatibility from Python ``2.6`` - ``3.3``, a module has been +To ensure compatibility from Python ``2.7`` - ``3.x``, a module has been created. Clearly there is huge need to use conforming syntax. """ import sys @@ -13,13 +13,10 @@ try: except ImportError: pass -# Cannot use sys.version.major and minor names, because in Python 2.6 it's not -# a namedtuple. is_py3 = sys.version_info[0] >= 3 is_py33 = is_py3 and sys.version_info[1] >= 3 is_py34 = is_py3 and sys.version_info[1] >= 4 is_py35 = is_py3 and sys.version_info[1] >= 5 -is_py26 = not is_py3 and sys.version_info[1] < 7 py_version = int(str(sys.version_info[0]) + str(sys.version_info[1])) @@ -127,14 +124,7 @@ def find_module_pre_py33(string, path=None, fullname=None): if loader: is_package = loader.is_package(string) is_archive = hasattr(loader, 'archive') - try: - module_path = loader.get_filename(string) - except AttributeError: - # fallback for py26 - try: - module_path = loader._get_filename(string) - except AttributeError: - continue + module_path = loader.get_filename(string) if is_package: module_path = os.path.dirname(module_path) if is_archive: @@ -242,11 +232,6 @@ import ast def literal_eval(string): - # py3.0, py3.1 and py32 don't support unicode literals. Support those, I - # don't want to write two versions of the tokenizer. - if is_py3 and sys.version_info.minor < 3: - if re.match('[uU][\'"]', string): - string = string[1:] return ast.literal_eval(string) diff --git a/jedi/evaluate/stdlib.py b/jedi/evaluate/stdlib.py index 259d6927..bcd8b622 100644 --- a/jedi/evaluate/stdlib.py +++ b/jedi/evaluate/stdlib.py @@ -256,13 +256,7 @@ def collections_namedtuple(evaluator, obj, arguments): This has to be done by processing the namedtuple class template and evaluating the result. - .. note:: |jedi| only supports namedtuples on Python >2.6. - """ - # Namedtuples are not supported on Python 2.6 - if not hasattr(collections, '_class_template'): - return NO_CONTEXTS - # Process arguments # TODO here we only use one of the types, we should use all. name = list(_follow_param(evaluator, arguments, 0))[0].obj diff --git a/setup.py b/setup.py index 3f3b7e54..81d69ba2 100755 --- a/setup.py +++ b/setup.py @@ -44,7 +44,6 @@ setup(name='jedi', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', diff --git a/test/completion/arrays.py b/test/completion/arrays.py index 8be1cece..e44a0671 100644 --- a/test/completion/arrays.py +++ b/test/completion/arrays.py @@ -403,8 +403,6 @@ def test_func(): x -# python >= 2.7 -# Set literals are not valid in 2.6. #? int() tuple({1})[0] diff --git a/test/completion/basic.py b/test/completion/basic.py index 34e88100..d79a15ed 100644 --- a/test/completion/basic.py +++ b/test/completion/basic.py @@ -286,8 +286,6 @@ with open('') as f: #? str() line -# Nested with statements don't exist in Python 2.6. -# python >= 2.7 with open('') as f1, open('') as f2: #? ['closed'] f1.closed diff --git a/test/completion/comprehensions.py b/test/completion/comprehensions.py index 2894cf33..402ef753 100644 --- a/test/completion/comprehensions.py +++ b/test/completion/comprehensions.py @@ -210,6 +210,5 @@ d[2] next(iter({a for a in range(10)})) -# with a set literal (also doesn't work in 2.6). #? int() [a for a in {1, 2, 3}][0] diff --git a/test/completion/dynamic_arrays.py b/test/completion/dynamic_arrays.py index 9be530fa..5cb52fc6 100644 --- a/test/completion/dynamic_arrays.py +++ b/test/completion/dynamic_arrays.py @@ -288,8 +288,6 @@ third()[0] # ----------------- # set.add # ----------------- -# Set literals are not valid in 2.6. -# python >= 2.7 st = {1.0} for a in [1,2]: st.add(a) diff --git a/test/completion/pep0484_comments.py b/test/completion/pep0484_comments.py index 7d5f7c2e..7707fcc3 100644 --- a/test/completion/pep0484_comments.py +++ b/test/completion/pep0484_comments.py @@ -47,10 +47,6 @@ b class Employee: pass -# The typing library is not installable for Python 2.6, therefore ignore the -# following tests. -# python >= 2.7 - from typing import List x = [] # type: List[Employee] #? Employee() diff --git a/test/completion/pep0484_typing.py b/test/completion/pep0484_typing.py index 75c1c0b0..7bee1e64 100644 --- a/test/completion/pep0484_typing.py +++ b/test/completion/pep0484_typing.py @@ -3,8 +3,6 @@ Test the typing library, with docstrings. This is needed since annotations are not supported in python 2.7 else then annotating by comment (and this is still TODO at 2016-01-23) """ -# There's no Python 2.6 typing module. -# python >= 2.7 import typing class B: pass diff --git a/test/completion/types.py b/test/completion/types.py index 2ef01f9a..8fd2c594 100644 --- a/test/completion/types.py +++ b/test/completion/types.py @@ -116,8 +116,6 @@ tup4.index # ----------------- # set # ----------------- -# Set literals are not valid in 2.6. -# python >= 2.7 set_t = {1,2} #? ['clear', 'copy'] diff --git a/test/completion/usages.py b/test/completion/usages.py index d7231b15..be27ae51 100644 --- a/test/completion/usages.py +++ b/test/completion/usages.py @@ -296,8 +296,6 @@ x = 32 [x for x in something] x = 3 -# Not supported syntax in Python 2.6. -# python >= 2.7 #< 1 (0,1), (0,10) {x:1 for x in something} #< 10 (0,1), (0,10) diff --git a/test/test_evaluate/test_imports.py b/test/test_evaluate/test_imports.py index a41d4f0d..307b811c 100644 --- a/test/test_evaluate/test_imports.py +++ b/test/test_evaluate/test_imports.py @@ -13,7 +13,6 @@ from jedi._compatibility import find_module_py33, find_module from ..helpers import cwd_at from jedi import Script -from jedi._compatibility import is_py26 @pytest.mark.skipif('sys.version_info < (3,3)') @@ -47,7 +46,6 @@ def test_find_module_package_zipped(): assert len(jedi.Script('import pkg; pkg.mod', 1, 19).completions()) == 1 -@pytest.mark.skipif('sys.version_info < (2,7)') def test_find_module_not_package_zipped(): if 'zipped_imports/not_pkg.zip' not in sys.path: sys.path.append(os.path.join(os.path.dirname(__file__), @@ -160,8 +158,7 @@ def test_complete_on_empty_import(): wanted = set(['ImportError', 'import', 'ImportWarning']) assert set([c.name for c in Script("import").completions()]) == wanted - if not is_py26: # python 2.6 doesn't always come with a library `import*`. - assert len(Script("import import", path='').completions()) > 0 + assert len(Script("import import", path='').completions()) > 0 # 111 assert Script("from datetime import").completions()[0].name == 'import' diff --git a/test/test_evaluate/test_literals.py b/test/test_evaluate/test_literals.py index 403020ac..4f30d109 100644 --- a/test/test_evaluate/test_literals.py +++ b/test/test_evaluate/test_literals.py @@ -1,7 +1,7 @@ import pytest import jedi -from jedi._compatibility import py_version, unicode +from jedi._compatibility import py_version def _eval_literal(code): diff --git a/test/test_evaluate/test_pyc.py b/test/test_evaluate/test_pyc.py index c101da13..057e9417 100644 --- a/test/test_evaluate/test_pyc.py +++ b/test/test_evaluate/test_pyc.py @@ -45,20 +45,5 @@ def generate_pyc(): shutil.copy(os.path.join("dummy_package/__pycache__", f), dst) -# Python 2.6 does not necessarily come with `compileall.compile_file`. -@pytest.mark.skipif("sys.version_info > (2,6)") -@cwd_at('test/test_evaluate') -def test_pyc(): - """ - The list of completion must be greater than 2. - """ - try: - generate_pyc() - s = jedi.Script("from dummy_package import dummy; dummy.", path='blub.py') - assert len(s.completions()) >= 2 - finally: - shutil.rmtree("dummy_package") - - if __name__ == "__main__": test_pyc() diff --git a/test/test_evaluate/test_stdlib.py b/test/test_evaluate/test_stdlib.py index 7347d840..6b55224d 100644 --- a/test/test_evaluate/test_stdlib.py +++ b/test/test_evaluate/test_stdlib.py @@ -6,7 +6,6 @@ from textwrap import dedent import pytest from jedi import Script -from jedi._compatibility import is_py26 # The namedtuple is different for different Python2.7 versions. Some versions # are missing the attribute `_class_template`. @@ -25,10 +24,7 @@ def test_namedtuple_str(letter, expected): dave.%s""") % letter result = Script(source).completions() completions = set(r.name for r in result) - if is_py26: - assert completions == set() - else: - assert completions == set(expected) + assert completions == set(expected) def test_namedtuple_list(): @@ -39,10 +35,7 @@ def test_namedtuple_list(): garfield.l""") result = Script(source).completions() completions = set(r.name for r in result) - if is_py26: - assert completions == set() - else: - assert completions == set(['legs', 'length', 'large']) + assert completions == set(['legs', 'length', 'large']) def test_namedtuple_content(): diff --git a/tox.ini b/tox.ini index 7b0a537d..917ce3b9 100644 --- a/tox.ini +++ b/tox.ini @@ -15,10 +15,6 @@ setenv = PYTHONDONTWRITEBYTECODE=1 commands = py.test {posargs:jedi test} -[testenv:py26] -deps = - unittest2 - {[testenv]deps} [testenv:py27] deps = # for testing the typing module