From 13d3e8098a7878be66783d2a2dd0d1058bcdad8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20S=C3=A1nchez=20de=20Le=C3=B3n=20Peque?= Date: Fri, 26 Jul 2019 19:04:07 +0200 Subject: [PATCH 1/4] TST: Fix tests for Python 3.6 compatibility While testing examples, positions are not in the expected order. --- tests/test_examples.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test_examples.py b/tests/test_examples.py index 0bc7d58a78..62af47764c 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from functools import partial +from operator import itemgetter import tarfile import matplotlib @@ -77,11 +78,20 @@ def test_example(self, example_name): }, ) expected_perf = self.expected_perf[example_name] + # Exclude positions column as the positions do not always have the + # same order + columns = [column for column in examples._cols_to_check + if column != 'positions'] assert_equal( - actual_perf[examples._cols_to_check], - expected_perf[examples._cols_to_check], + actual_perf[columns], + expected_perf[columns], # There is a difference in the datetime columns in pandas # 0.16 and 0.17 because in 16 they are object and in 17 they are # datetime[ns, UTC]. We will just ignore the dtypes for now. check_dtype=False, ) + # Sort positions by SID before comparing + assert_equal( + expected_perf['positions'].apply(sorted, key=itemgetter('sid')), + actual_perf['positions'].apply(sorted, key=itemgetter('sid')), + ) From 1dfd2f1369625e3e4b4767cb9169bbf850fc370c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20S=C3=A1nchez=20de=20Le=C3=B3n=20Peque?= Date: Fri, 26 Jul 2019 19:11:33 +0200 Subject: [PATCH 2/4] BLD: Add Python 3.6 to CI/CD --- .appveyor.yml | 7 +++++++ .travis.yml | 3 +++ etc/conda_build_matrix.py | 2 +- setup.py | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index af7236b6a4..4ac405fa26 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -37,6 +37,13 @@ environment: PANDAS_DATAREADER_VERSION: "0.4.0" DASK_VERSION: "0.17.1" + - PYTHON_VERSION: "3.6" + PANDAS_VERSION: "0.22.0" + NUMPY_VERSION: "1.14.1" + SCIPY_VERSION: "1.0.0" + PANDAS_DATAREADER_VERSION: "0.4.0" + DASK_VERSION: "0.17.1" + # We always use a 64-bit machine, but can build x86 distributions # with the PYTHON_ARCH variable (which is used by CMD_IN_ENV). platform: diff --git a/.travis.yml b/.travis.yml index 5bf2c69c72..901b6a33ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ fast_finish: true python: - 2.7 - 3.5 + - 3.6 env: global: # 1. Generated a token for travis at https://anaconda.org/quantopian/settings/access with scope api:write. @@ -23,6 +24,8 @@ matrix: exclude: - python: 2.7 env: NEW_PANDAS=1 + - python: 3.6 + env: OLD_PANDAS=1 # include: # # Workaround Travis OSX not natively supporting Python. # - os: osx diff --git a/etc/conda_build_matrix.py b/etc/conda_build_matrix.py index 5c0a02962b..7f4b2f6eb6 100644 --- a/etc/conda_build_matrix.py +++ b/etc/conda_build_matrix.py @@ -4,7 +4,7 @@ import click -py_versions = ('2.7', '3.4', '3.5') +py_versions = ('2.7', '3.4', '3.5', '3.6') npy_versions = ('1.9', '1.10') zipline_path = os.path.join( os.path.dirname(__file__), diff --git a/setup.py b/setup.py index c21b0855bb..e0226c1e43 100644 --- a/setup.py +++ b/setup.py @@ -314,6 +314,7 @@ def setup_requirements(requirements_path, module_names, strict_bounds, 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Operating System :: OS Independent', 'Intended Audience :: Science/Research', 'Topic :: Office/Business :: Financial', From 191e839f4435a74b9fe7cf362ccebbd3555958ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20S=C3=A1nchez=20de=20Le=C3=B3n=20Peque?= Date: Mon, 9 Sep 2019 11:30:38 +0200 Subject: [PATCH 3/4] BLD: Update sortedcontainers for Python 3.6 compat --- conda/0_sortedcontainers/meta.yaml | 84 ++++++++---------------------- etc/requirements.txt | 2 +- 2 files changed, 24 insertions(+), 62 deletions(-) diff --git a/conda/0_sortedcontainers/meta.yaml b/conda/0_sortedcontainers/meta.yaml index c5c46e9ce3..b4ea3039f0 100644 --- a/conda/0_sortedcontainers/meta.yaml +++ b/conda/0_sortedcontainers/meta.yaml @@ -1,86 +1,48 @@ {% set name = "sortedcontainers" %} -{% set version = "1.4.4" %} -{% set file_ext = "tar.gz" %} -{% set hash_type = "sha256" %} -{% set hash_value = "192f59da6df6f91204f85a614a09b88e5ca680a4cc6a31fbc8689cad472da212" %} +{% set version = "2.1.0" %} +{% set sha256 = "974e9a32f56b17c1bac2aebd9dcf197f3eb9cd30553c5852a3187ad162e1a03a" %} package: - name: '{{ name|lower }}' - version: '{{ version }}' + name: {{ name }} + version: {{ version }} source: - fn: '{{ name }}-{{ version }}.{{ file_ext }}' - url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.{{ file_ext }} - '{{ hash_type }}': '{{ hash_value }}' + fn: {{ name }}-{{ version }}.tar.gz + url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz + sha256: {{ sha256 }} build: number: 0 script: python setup.py install --single-version-externally-managed --record=record.txt requirements: - build: + host: - python - setuptools + run: - python + test: imports: - sortedcontainers - requires: - - tox about: home: http://www.grantjenks.com/docs/sortedcontainers/ - license: Apache Software License - license_family: APACHE - license_file: '' + license: Apache 2.0 + license_file: LICENSE summary: 'Python Sorted Container Types: SortedList, SortedDict, and SortedSet' - description: "Python SortedContainers\n=======================\n\n.. image:: https://api.travis-ci.org/grantjenks/sorted_containers.svg\n :target: http://www.grantjenks.com/docs/sortedcontainers/\n\ - \n`SortedContainers`_ is an Apache2 licensed `sorted collections library`_,\nwritten in pure-Python, and fast as C-extensions.\n\nPython's standard library is great until you need a sorted collections\n\ - type. Many will attest that you can get really far without one, but the moment\nyou **really need** a sorted list, dict, or set, you're faced with a dozen\ndifferent implementations, most using C-extensions\ - \ without great documentation\nand benchmarking.\n\nIn Python, we can do better. And we can do it in pure-Python!\n\n.. code-block:: python\n\n >>> sl = sortedcontainers.SortedList(xrange(10000000))\n\ - \ >>> 1234567 in sl\n True\n >>> sl[7654321]\n 7654321\n >>> sl.add(1234567)\n >>> sl.count(1234567)\n 2\n >>> sl *= 3\n >>> len(sl)\n 30000003\n\n**Note:** don't try this\ - \ without at least a half gigabyte of memory. In Python\nan integer requires about 24 bytes. SortedList will add about 8 bytes per\nobject stored in the container. That's pretty hard to beat as it's\ - \ the cost of\na pointer to each object. It's also 66% less overhead than a typical binary\ntree implementation (e.g. red-black tree, avl tree, aa tree, splay tree, treap,\netc.) for which every node\ - \ must also store two pointers to children nodes.\n\n`SortedContainers`_ takes all of the work out of Python sorted collections -\nmaking your deployment and use of Python easy. There's no need to install\ - \ a C\ncompiler or pre-build and distribute custom extensions. Performance is a\nfeature and testing has 100% coverage with unit tests and hours of stress.\n\n.. _`SortedContainers`: http://www.grantjenks.com/docs/sortedcontainers/\n\ - .. _`sorted collections library`: http://www.grantjenks.com/docs/sortedcontainers/\n\nTestimonials\n------------\n\n**Alex Martelli**, `Wikipedia`_\n\nGood stuff! ... I like the `simple, effective implementation`_\ - \ idea of splitting\nthe sorted containers into smaller \"fragments\" to avoid the O(N) insertion costs.\n\n.. _`Wikipedia`: http://en.wikipedia.org/wiki/Alex_Martelli\n.. _`simple, effective implementation`:\ - \ http://www.grantjenks.com/docs/sortedcontainers/implementation.html\n\n**Jeff Knupp**, `Review of SortedContainers`_\n\nThat last part, \"fast as C-extensions,\" was difficult to believe. I would\ - \ need\nsome sort of `Performance Comparison`_ to be convinced this is true. The author\nincludes this in the docs. It is.\n\n.. _`Review of SortedContainers`: http://reviews.jeffknupp.com/reviews/sortedcontainers/3/\n\ - \n**Kevin Samuel**, `Formations Python`_\n\nI'm quite amazed, not just by the code quality (it's incredibly\nreadable and has more comment than code, wow), but the actual\namount of work you put at\ - \ stuff that is *not* code:\ndocumentation, benchmarking, implementation explanations. Even\nthe git log is clean and the unit tests run out of the box on\nPython 2 and 3.\n\n.. _`Formations Python`:\ - \ http://formationspython.com/\n\n**Mark Summerfield**, a short plea for `Python Sorted Collections`_\n\nPython's \"batteries included\" standard library seems to have a battery\nmissing. And the argument\ - \ that \"we never had it before\" has worn thin. It is\ntime that Python offered a full range of collection classes out of the box,\nincluding sorted ones.\n\n.. _`Python Sorted Collections`: http://www.qtrac.eu/pysorted.html\n\ - \nFeatures\n--------\n\n- Pure-Python\n- Fully documented\n- Benchmark comparison (alternatives, runtimes, load-factors)\n- 100% test coverage\n- Hours of stress testing\n- Performance matters (often\ - \ faster than C implementations)\n- Compatible API (nearly identical to popular blist and rbtree modules)\n- Feature-rich (e.g. get the five largest keys in a sorted dict: d.iloc[-5:])\n- Pragmatic\ - \ design (e.g. SortedSet is a Python set with a SortedList index)\n- Developed on Python 2.7\n- Tested on CPython 2.6, 2.7, 3.2, 3.3, 3.4, 3.5 and PyPy 5.1+, PyPy3 2.4+\n\nQuickstart\n----------\n\n\ - Installing `SortedContainers`_ is simple with\n`pip `_::\n\n $ pip install sortedcontainers\n\nYou can access documentation in the interpreter with Python's built-in\ - \ help\nfunction:\n\n.. code-block:: python\n\n >>> from sortedcontainers import SortedList, SortedSet, SortedDict\n >>> help(SortedList)\n\nDocumentation\n-------------\n\nComplete documentation\ - \ including performance comparisons is available at\nhttp://www.grantjenks.com/docs/sortedcontainers/ .\n\nUser Guide\n..........\n\nFor those wanting more details, this part of the documentation describes\n\ - introduction, implementation, performance, and development.\n\n- `Introduction`_\n- `Performance Comparison`_\n- `Load Factor Performance Comparison`_\n- `Runtime Performance Comparison`_\n- `Simulated\ - \ Workload Performance Comparison`_\n- `Implementation Details`_\n- `Performance at Scale`_\n- `Developing and Contributing`_\n- `Release History`_\n\n.. _`Introduction`: http://www.grantjenks.com/docs/sortedcontainers/introduction.html\n\ - .. _`Performance Comparison`: http://www.grantjenks.com/docs/sortedcontainers/performance.html\n.. _`Load Factor Performance Comparison`: http://www.grantjenks.com/docs/sortedcontainers/performance-load.html\n\ - .. _`Runtime Performance Comparison`: http://www.grantjenks.com/docs/sortedcontainers/performance-runtime.html\n.. _`Simulated Workload Performance Comparison`: http://www.grantjenks.com/docs/sortedcontainers/performance-workload.html\n\ - .. _`Implementation Details`: http://www.grantjenks.com/docs/sortedcontainers/implementation.html\n.. _`Performance at Scale`: http://www.grantjenks.com/docs/sortedcontainers/performance-scale.html\n\ - .. _`Developing and Contributing`: http://www.grantjenks.com/docs/sortedcontainers/development.html\n.. _`Release History`: http://www.grantjenks.com/docs/sortedcontainers/history.html\n\nAPI Documentation\n\ - .................\n\nIf you are looking for information on a specific function, class or method, this\npart of the documentation is for you.\n\n- `SortedList`_\n- `SortedListWithKey`_\n- `SortedDict`_\n\ - - `SortedSet`_\n\n.. _`SortedList`: http://www.grantjenks.com/docs/sortedcontainers/sortedlist.html\n.. _`SortedListWithKey`: http://www.grantjenks.com/docs/sortedcontainers/sortedlistwithkey.html\n\ - .. _`SortedDict`: http://www.grantjenks.com/docs/sortedcontainers/sorteddict.html\n.. _`SortedSet`: http://www.grantjenks.com/docs/sortedcontainers/sortedset.html\n\nTalks\n-----\n\n- `Python Sorted\ - \ Collections | PyCon 2016 Talk`_\n- `SF Python Holiday Party 2015 Lightning Talk`_\n- `DjangoCon 2015 Lightning Talk`_\n\n.. _`Python Sorted Collections | PyCon 2016 Talk`: http://www.grantjenks.com/docs/sortedcontainers/pycon-2016-talk.html\n\ - .. _`SF Python Holiday Party 2015 Lightning Talk`: http://www.grantjenks.com/docs/sortedcontainers/sf-python-2015-lightning-talk.html\n.. _`DjangoCon 2015 Lightning Talk`: http://www.grantjenks.com/docs/sortedcontainers/djangocon-2015-lightning-talk.html\n\ - \nContribute\n----------\n\nCollaborators are welcome!\n\n#. Check for open issues or open a fresh issue to start a discussion around a\n bug. There is a Contributor Friendly tag for issues that\ - \ should be used by\n people who are not very familiar with the codebase yet.\n#. Fork the `SortedContainers repository\n `_ on GitHub and start\n\ - \ making your changes to a new branch.\n#. Write a test which shows that the bug was fixed.\n#. Send a pull request and bug the maintainer until it gets merged and\n published.\n\nUseful Links\n\ - ------------\n\n- `SortedContainers Documentation`_\n- `SortedContainers at PyPI`_\n- `SortedContainers at Github`_\n- `SortedContainers Issue Tracker`_\n\n.. _`SortedContainers Documentation`: http://www.grantjenks.com/docs/sortedcontainers/\n\ - .. _`SortedContainers at PyPI`: https://pypi.python.org/pypi/sortedcontainers\n.. _`SortedContainers at Github`: https://github.com/grantjenks/sorted_containers\n.. _`SortedContainers Issue Tracker`:\ - \ https://github.com/grantjenks/sorted_containers/issues\n\nSortedContainers License\n------------------------\n\nCopyright 2014-2016 Grant Jenks\n\nLicensed under the Apache License, Version 2.0 (the\ - \ \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable\ - \ law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License\ - \ for the specific language governing permissions and\nlimitations under the License." - doc_url: '' - dev_url: '' + description: | + SortedContainers is a sorted collections library, written in pure-Python + and fast as C-extensions. + doc_url: http://www.grantjenks.com/docs/sortedcontainers/ + dev_url: https://github.com/grantjenks/python-sortedcontainers + doc_source_url: https://github.com/grantjenks/python-sortedcontainers/blob/master/docs/index.rst extra: - recipe-maintainers: '' + recipe-maintainers: + - grantjenks + - msarahan + - richafrank + - nehaljwani diff --git a/etc/requirements.txt b/etc/requirements.txt index 641bad6263..a65cc7efa5 100644 --- a/etc/requirements.txt +++ b/etc/requirements.txt @@ -75,7 +75,7 @@ sqlalchemy==1.1.18 # For asset db management alembic==0.7.7 -sortedcontainers==1.4.4 +sortedcontainers==2.1.0 # for intervaltree intervaltree==2.1.0 From 514d8c57b8d9eb2db1fc22228b2ab469611de4d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20S=C3=A1nchez=20de=20Le=C3=B3n=20Peque?= Date: Tue, 4 Feb 2020 17:41:45 +0100 Subject: [PATCH 4/4] BLD: Update `psutil` to latest version --- etc/requirements_blaze.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/requirements_blaze.txt b/etc/requirements_blaze.txt index a03a5c9457..c6092b5c1e 100644 --- a/etc/requirements_blaze.txt +++ b/etc/requirements_blaze.txt @@ -15,6 +15,6 @@ flask-cors==2.1.3 Jinja2==2.10.1 MarkupSafe==0.23 Werkzeug==0.12.2 -psutil==4.3.0 +psutil==5.6.7 -e git://github.com/quantopian/blaze.git@f26375a6708eab85b7acc7869d6c518df2f974eb#egg=blaze