diff options
author | Jarrod Millman <jarrod.millman@gmail.com> | 2020-09-04 21:17:13 -0700 |
---|---|---|
committer | Jarrod Millman <jarrod.millman@gmail.com> | 2020-09-15 20:00:19 -0700 |
commit | 5f2445c1b5ff4db2dd0f943e006df1a107e8f00b (patch) | |
tree | 179c9d28d77dd5837793a329638be4a951ad2e17 | |
parent | dae8b01782ca4fada704d11a1d16c60663f8a90d (diff) | |
download | networkx-5f2445c1b5ff4db2dd0f943e006df1a107e8f00b.tar.gz |
Make optional dependencies default on CPython
-rw-r--r-- | .appveyor.yml | 12 | ||||
-rw-r--r-- | .circleci/config.yml | 3 | ||||
-rw-r--r-- | .github/workflows/testing.yml | 4 | ||||
-rw-r--r-- | .travis.yml | 17 | ||||
-rw-r--r-- | CONTRIBUTING.rst | 14 | ||||
-rw-r--r-- | INSTALL.rst | 28 | ||||
-rw-r--r-- | README.rst | 3 | ||||
-rw-r--r-- | doc/release/release_dev.rst | 1 | ||||
-rw-r--r-- | requirements/README.md | 4 | ||||
-rw-r--r-- | requirements/default.txt | 4 | ||||
-rw-r--r-- | requirements/extra.txt (renamed from requirements/extras.txt) | 2 | ||||
-rw-r--r-- | requirements/optional.txt | 6 | ||||
-rw-r--r-- | setup.py | 30 | ||||
-rwxr-xr-x | tools/travis/before_install.sh | 2 |
14 files changed, 56 insertions, 74 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index d3d5c0e5..1ee02839 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,15 +12,15 @@ environment: matrix: - PYTHON: "C:\\Python36-x64" - PYTHON_VERSION: "3.6.8" + PYTHON_VERSION: "3.6" PYTHON_ARCH: "64" - PYTHON: "C:\\Python37-x64" - PYTHON_VERSION: "3.7.5" + PYTHON_VERSION: "3.7" PYTHON_ARCH: "64" - PYTHON: "C:\\Python38-x64" - PYTHON_VERSION: "3.8.0" + PYTHON_VERSION: "3.8" PYTHON_ARCH: "64" PIP_FLAGS: "--pre" @@ -34,12 +34,8 @@ install: - "python --version" - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" - # install required packages - - "pip install --cache-dir=%CACHE_DIR% %PIP_FLAGS% -r requirements.txt" - - "pip install --cache-dir=%CACHE_DIR% %PIP_FLAGS% -r requirements/optional.txt" - # Install the build and runtime dependencies of the project. - # - "%CMD_IN_ENV% pip install --timeout=60 -r requirements.txt" + - "python -m pip install --upgrade pip wheel setuptools" - "pip install ." # Not a .NET project, we build networkx in the install step instead diff --git a/.circleci/config.yml b/.circleci/config.yml index b5097ddb..53781693 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,10 +30,9 @@ jobs: command: | python3 -m venv venv source venv/bin/activate - pip install --upgrade pip + pip install --upgrade pip wheel setuptools pip install -r requirements.txt pip install -r requirements/doc.txt - pip install -r requirements/optional.txt pip install pydot pygraphviz - run: diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 3032d063..8828c483 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -1,3 +1,5 @@ +name: macOS tests + on: push: branches: [ master ] @@ -6,7 +8,6 @@ on: jobs: test_macos: - name: macOS tests runs-on: macos-latest strategy: max-parallel: 3 @@ -28,7 +29,6 @@ jobs: run: | pip install --upgrade pip wheel setuptools pip install -r requirements.txt - pip install -r requirements/optional.txt pip install pydot pygraphviz pip install . pip list diff --git a/.travis.yml b/.travis.yml index d0d9c58f..38fe09af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ cache: pip matrix: include: - os: linux - python: 3.7 + python: 3.6 env: - OPTIONAL_DEPS=1 - MINIMUM_REQUIREMENTS=1 @@ -42,15 +42,9 @@ matrix: packages: - libgdal-dev - graphviz - - python: 3.6 - - python: 3.7 - python: 3.8 - python: 3.9-dev - env: - - MIN_DEPS=1 - - python: pypy3.6-7.1.1 - env: - - MIN_DEPS=1 + - python: pypy3 before_install: # prepare the system to install prerequisites or dependencies @@ -61,13 +55,10 @@ before_install: install: # install required packages - - pip install --upgrade pip + - pip install --upgrade pip wheel setuptools - pip install --retries 3 ${PIP_FLAGS} -r requirements.txt - if [[ "${OPTIONAL_DEPS}" == 1 ]]; then - pip install --retries 3 ${PIP_FLAGS} -r requirements/optional.txt; - pip install --retries 3 ${PIP_FLAGS} -r requirements/extras.txt; - elif [[ "${MIN_DEPS}" != 1 ]]; then - pip install --retries 3 ${PIP_FLAGS} -r requirements/optional.txt; + pip install --retries 3 ${PIP_FLAGS} -r requirements/extra.txt; fi # install networkx - printenv PWD diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 7b40d63c..96b7ae93 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -43,7 +43,7 @@ Development Workflow # (Optional) Install pygraphviz, pydot, and gdal packages # These packages require that you have your system properly configured # and what that involves differs on various systems. - # pip install -r requirements/extras.txt + # pip install -r requirements/extra.txt # # Build and install networkx from source pip install -e . @@ -64,7 +64,7 @@ Development Workflow # (Optional) Install pygraphviz, pydot, and gdal packages # These packages require that you have your system properly configured # and what that involves differs on various systems. - # pip install -r requirements/extras.txt + # pip install -r requirements/extra.txt # # Install networkx from source pip install -e . --no-deps @@ -228,12 +228,22 @@ Guidelines * All changes are reviewed. Ask on the `mailing list <http://groups.google.com/group/networkx-discuss>`_ if you get no response to your pull request. +* Default dependencies are listed in ``requirements/default.txt`` and extra + (i.e., optional) dependencies are listed in ``requirements/extra.txt``. + We don't often add new default and extra dependencies. If you are considering + adding code that has a dependency, you should first consider adding a gallery + example. Typically, new proposed dependencies would first be added as extra + dependencies. Extra dependencies should be easy to install on all platforms + and widely-used. New default dependencies should be easy to install on all + platforms, widely-used in the community, and have demonstrated potential for + wide-spread use in NetworkX. * Use the following import conventions:: import numpy as np import scipy as sp import matplotlib as mpl import matplotlib.pyplot as plt + import pandas as pd import networkx as nx * Use the decorator ``not_implemented_for`` in ``networkx/utils/decorators.py`` diff --git a/INSTALL.rst b/INSTALL.rst index ed9e8c50..d5128675 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -65,28 +65,18 @@ Then, if you want to update ``networkx`` at any time, in the same directory do:: $ git pull -Optional packages ------------------ +Extra packages +-------------- .. note:: Some optional packages (e.g., `gdal`) may require compiling C or C++ code. If you have difficulty installing these packages - with `pip`, please review the instructions for installing - the full `scientific Python stack <https://scipy.org/install.html>`_. + with `pip`, please consult the homepages of those packages. -The following optional packages provide additional functionality. See the +The following extra packages provide additional functionality. See the files in the ``requirements/`` directory for information about specific version requirements. -- `NumPy <http://www.numpy.org/>`_ provides array-based dense - matrix representations of graphs and high-performance array math and linear - algebra which is used in some graph algorithms. -- `SciPy <http://scipy.org/>`_ provides sparse matrix representation - of graphs and many numerical scientific tools. -- `pandas <http://pandas.pydata.org/>`_ provides a DataFrame, which - is a tabular data structure with labeled axes. -- `Matplotlib <http://matplotlib.org/>`_ provides flexible drawing of - graphs. - `PyGraphviz <http://pygraphviz.github.io/>`_ and `pydot <https://github.com/erocarrera/pydot>`_ provide graph drawing and graph layout algorithms via `GraphViz <http://graphviz.org/>`_. @@ -94,17 +84,17 @@ version requirements. - `gdal <http://www.gdal.org/>`_ provides shapefile format reading and writing. - `lxml <http://lxml.de/>`_ used for GraphML XML format. -To install ``networkx`` and all optional packages, do:: +To install ``networkx`` and extra packages, do:: - $ pip install networkx[all] + $ pip install networkx[extra] To explicitly install all optional packages, do:: - $ pip install numpy scipy pandas matplotlib pygraphviz pydot pyyaml gdal + $ pip install pygraphviz pydot pyyaml gdal lxml -Or, install any optional package (e.g., ``numpy``) individually:: +Or, install any optional package (e.g., ``pygraphviz``) individually:: - $ pip install numpy + $ pip install pygraphviz Testing ------- @@ -10,6 +10,9 @@ NetworkX .. image:: https://travis-ci.org/networkx/networkx.svg?branch=master :target: https://travis-ci.org/networkx/networkx +.. image:: https://github.com/networkx/networkx/workflows/macOS%20tests/badge.svg?branch=master + :target: https://github.com/networkx/networkx/actions?query=workflow%3A%22macOS+tests%22 + .. image:: https://ci.appveyor.com/api/projects/status/github/networkx/networkx?branch=master&svg=true :target: https://ci.appveyor.com/project/dschult/networkx-pqott diff --git a/doc/release/release_dev.rst b/doc/release/release_dev.rst index 2dae5e5f..08a7f130 100644 --- a/doc/release/release_dev.rst +++ b/doc/release/release_dev.rst @@ -17,6 +17,7 @@ Highlights This release is the result of X of work with over X pull requests by X contributors. Highlights include: +- NumPy, SciPy, Matplotlib, and pandas are now default requirements. Improvements ------------ diff --git a/requirements/README.md b/requirements/README.md index ee23aa30..7ee5c66f 100644 --- a/requirements/README.md +++ b/requirements/README.md @@ -4,9 +4,7 @@ - [`default.txt`](default.txt) Default requirements -- [`optional.txt`](optional.txt) - Optional requirements that are easy to install -- [`extras.txt`](extras.txt) +- [`extra.txt`](extra.txt) Optional requirements that may require extra steps to install - [`test.txt`](test.txt) Requirements for running test suite diff --git a/requirements/default.txt b/requirements/default.txt index 570c163c..f3d97c9d 100644 --- a/requirements/default.txt +++ b/requirements/default.txt @@ -1 +1,5 @@ decorator>=4.3.0 +numpy>=1.19 +scipy>=1.4 +matplotlib>=3.2 +pandas>=1.0 diff --git a/requirements/extras.txt b/requirements/extra.txt index 3b7ccd86..640e0961 100644 --- a/requirements/extras.txt +++ b/requirements/extra.txt @@ -1,2 +1,4 @@ +lxml>=4.5 pygraphviz>=1.5, <2.0 pydot>=1.4.1 +pyyaml>=5.3 diff --git a/requirements/optional.txt b/requirements/optional.txt deleted file mode 100644 index 196309ce..00000000 --- a/requirements/optional.txt +++ /dev/null @@ -1,6 +0,0 @@ -numpy>=1.19 -scipy>=1.4 -pandas>=1.0 -matplotlib>=3.2 -pyyaml>=5.3 -lxml>=4.5 @@ -124,29 +124,23 @@ package_data = { "networkx.utils": ["tests/*.py"], } -install_requires = ["decorator>=4.3.0"] +install_requires = [ + "decorator>=4.3.0", + "numpy>=1.19; platform_python_implementation!='PyPy' and python_version<'3.9'", + "scipy>=1.4; platform_python_implementation!='PyPy' and python_version<'3.9'", + "matplotlib>=3.2; platform_python_implementation!='PyPy' and python_version<'3.9'", + "pandas>=1.0; platform_python_implementation!='PyPy' and python_version<'3.9'", +] extras_require = { - "all": [ - "numpy", - "scipy", - "pandas", - "matplotlib", - "pygraphviz", - "pydot", - "pyyaml", - "lxml", - "pytest", + "extra": [ + "lxml>=4.5", + "pygraphviz>=1.5, <2.0", + "pydot>=1.4.1", + "pyyaml>=5.3", ], "gdal": ["gdal"], - "lxml": ["lxml"], - "matplotlib": ["matplotlib"], - "pytest": ["pytest"], - "numpy": ["numpy"], - "pandas": ["pandas"], "pydot": ["pydot"], "pygraphviz": ["pygraphviz"], - "pyyaml": ["pyyaml"], - "scipy": ["scipy"], } with open("README.rst", "r") as fh: diff --git a/tools/travis/before_install.sh b/tools/travis/before_install.sh index a03aba8e..910bf920 100755 --- a/tools/travis/before_install.sh +++ b/tools/travis/before_install.sh @@ -14,7 +14,7 @@ export -f section_end if [[ "${MINIMUM_REQUIREMENTS}" == 1 ]]; then sed -i 's/>=/==/g' requirements/default.txt - sed -i 's/>=/==/g' requirements/extras.txt + sed -i 's/>=/==/g' requirements/extra.txt sed -i 's/>=/==/g' requirements/test.txt sed -i 's/>=/==/g' requirements/doc.txt fi |