From 14ac4fb3552b91bc7e091cc0dc8cf09a56e35b48 Mon Sep 17 00:00:00 2001 From: Gabriel Azevedo Ferreira <57528979+GabrielAzevedoFerreiraQB@users.noreply.github.com> Date: Mon, 3 Apr 2023 10:49:23 +0800 Subject: [PATCH] Release PR 0.11.2 (#240) * Limiting numpy version (#217) * adding line on yml - no effect * adding line on yml - no effect * changing req.txt * changing req.txt * changing req.txt * adding setuptools requirement (#218) * adding setuptools requirement * adding setuptools requirement * update dictionaries to pass linting (#230) * Refactor/unlock numpy kl (#235) * unlocking numpy * unlocking numpy * unlocking numpy * dependency fixes for docs and linters * requirement fixes : numpy <1.24 for all python versions --------- Co-authored-by: kyle_lim * Simplifying requirements - Numpy version range (#236) * Remove python 3.6 and 3.7 support (#234) * remove python 3.6 and 3.7 support * update documentation * remove comment regarding ignoring a warning when running `make build-docs` * removing ipython from test requiremnets * Update README.md Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com> --------- Co-authored-by: GabrielAz Co-authored-by: Gabriel Azevedo Ferreira <57528979+GabrielAzevedoFerreiraQB@users.noreply.github.com> Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com> * unlocking numpy (#238) Co-authored-by: Gabriel Azevedo * Release 0.11.2 (#239) Co-authored-by: Gabriel Azevedo --------- Co-authored-by: ElisabethSesterHussQB <92664441+ElisabethSesterHussQB@users.noreply.github.com> Co-authored-by: kyle_lim Co-authored-by: Philip Pilgerstorfer <34248114+qbphilip@users.noreply.github.com> Co-authored-by: Gabriel Azevedo --- .circleci/config.yml | 39 ++------------ .readthedocs.yml | 2 +- CONTRIBUTING.md | 2 - README.md | 2 +- RELEASE.md | 3 ++ causalnex/__init__.py | 2 +- causalnex/structure/dynotears.py | 4 +- .../source/01_introduction/01_introduction.md | 2 +- docs/source/api_docs/index.rst | 4 +- requirements.txt | 17 +++--- setup.py | 4 +- test_requirements.txt | 1 - tests/ebaybbn/conftest.py | 54 ++++++++++--------- 13 files changed, 52 insertions(+), 84 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 52fa117..9038a64 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -116,17 +116,6 @@ utils: - run: *unit_tests ############################################################################### jobs: - unit_tests_36: - docker: *python - environment: - PYTHON_VERSION: '3.6' - <<: *unit_test_steps - - unit_tests_37: - docker: *python - environment: - PYTHON_VERSION: '3.7' - <<: *unit_test_steps unit_tests_38: docker: *python @@ -146,16 +135,6 @@ jobs: PYTHON_VERSION: '3.10' <<: *unit_test_steps - unit_tests_windows_36: - environment: - PYTHON_VERSION: '3.6' - <<: *unit_test_steps_windows - - unit_tests_windows_37: - environment: - PYTHON_VERSION: '3.7' - <<: *unit_test_steps_windows - unit_tests_windows_38: environment: PYTHON_VERSION: '3.8' @@ -171,10 +150,10 @@ jobs: PYTHON_VERSION: '3.10' <<: *unit_test_steps_windows - linters_37: + linters_38: docker: *python environment: - PYTHON_VERSION: '3.7' + PYTHON_VERSION: '3.8' steps: - checkout - run: *prepare_container @@ -187,7 +166,7 @@ jobs: docs: docker: *python environment: - PYTHON_VERSION: '3.7' + PYTHON_VERSION: '3.8' steps: - checkout - run: *prepare_container @@ -208,29 +187,21 @@ workflows: version: 2 regular: jobs: - - unit_tests_36 - - unit_tests_37 - unit_tests_38 - unit_tests_39 - unit_tests_310 - - linters_37 + - linters_38 - docs - - unit_tests_windows_36 - - unit_tests_windows_37 - unit_tests_windows_38 - unit_tests_windows_39 - unit_tests_windows_310 - all_circleci_checks_succeeded: requires: - - unit_tests_36 - - unit_tests_37 - unit_tests_38 - unit_tests_39 - unit_tests_310 - - linters_37 + - linters_38 - docs - - unit_tests_windows_36 - - unit_tests_windows_37 - unit_tests_windows_38 - unit_tests_windows_39 - unit_tests_windows_310 diff --git a/.readthedocs.yml b/.readthedocs.yml index c30aa10..2aa5e0f 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -20,7 +20,7 @@ sphinx: # Optionally set the version of Python and requirements required to build your docs python: - version: 3.6 + version: 3.8 install: - method: pip path: . diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f19e70b..6e090d8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -148,8 +148,6 @@ make build-docs This command will only work on Unix-like systems and requires `pandoc` to be installed. -> ❗ Running `make build-docs` in a Python 3.5 environment may sometimes yield multiple warning messages like the following: `WARNING: toctree contains reference to nonexisting document '04_user_guide/04_user_guide'`. You can simply ignore them or switch to Python 3.6+ when building documentation. - ## Developing in Docker The Docker images have all the necessary dependencies built in. To develop using the docker containers do the following diff --git a/README.md b/README.md index f4719a7..e562c5a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ | Theme | Status | |------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Latest Release | [![PyPI version](https://badge.fury.io/py/causalnex.svg)](https://pypi.org/project/causalnex/) | -| Python Version | [![Python Version](https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9%20%7C%203.10-blue.svg)](https://pypi.org/project/causalnex/) | +| Python Version | [![Python Version](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10-blue.svg)](https://pypi.org/project/causalnex/) | | `master` Branch Build | [![CircleCI](https://circleci.com/gh/quantumblacklabs/causalnex/tree/master.svg?style=shield&circle-token=92ab70f03f3183655473dad16be641959cd31b83)](https://circleci.com/gh/quantumblacklabs/causalnex/tree/master) | | `develop` Branch Build | [![CircleCI](https://circleci.com/gh/quantumblacklabs/causalnex/tree/develop.svg?style=shield&circle-token=92ab70f03f3183655473dad16be641959cd31b83)](https://circleci.com/gh/quantumblacklabs/causalnex/tree/develop) | | Documentation Build | [![Documentation](https://readthedocs.org/projects/causalnex/badge/?version=latest)](https://causalnex.readthedocs.io/) | diff --git a/RELEASE.md b/RELEASE.md index 3656fec..8b0c449 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,4 +1,7 @@ # Upcoming release +* Support newer version of Numpy +* Support newer version of Scikit-learn +* Remove python 3.6, 3.7 support # Release 0.11.1 diff --git a/causalnex/__init__.py b/causalnex/__init__.py index 8771af1..4c6b282 100644 --- a/causalnex/__init__.py +++ b/causalnex/__init__.py @@ -30,6 +30,6 @@ causalnex toolkit for causal reasoning (Bayesian Networks / Inference) """ -__version__ = "0.11.1" +__version__ = "0.11.2" __all__ = ["structure", "discretiser", "evaluation", "inference", "network", "plots"] diff --git a/causalnex/structure/dynotears.py b/causalnex/structure/dynotears.py index 42faf29..8c1f024 100644 --- a/causalnex/structure/dynotears.py +++ b/causalnex/structure/dynotears.py @@ -277,7 +277,7 @@ def _matrices_to_structure_model( sm.add_nodes_from(lag_cols) sm.add_edges_from( [ - (lag_cols[i], lag_cols[j], dict(weight=w_est[i, j])) + (lag_cols[i], lag_cols[j], {"weight": w_est[i, j]}) for i in range(w_est.shape[0]) for j in range(w_est.shape[1]) if w_est[i, j] != 0 @@ -285,7 +285,7 @@ def _matrices_to_structure_model( ) sm.add_edges_from( [ - (lag_cols[i + w_est.shape[0]], lag_cols[j], dict(weight=a_est[i, j])) + (lag_cols[i + w_est.shape[0]], lag_cols[j], {"weight": a_est[i, j]}) for i in range(a_est.shape[0]) for j in range(a_est.shape[1]) if a_est[i, j] != 0 diff --git a/docs/source/01_introduction/01_introduction.md b/docs/source/01_introduction/01_introduction.md index 8d3165c..e862cb3 100644 --- a/docs/source/01_introduction/01_introduction.md +++ b/docs/source/01_introduction/01_introduction.md @@ -29,7 +29,7 @@ You can also check out the resources section for answers to frequently asked que We have designed the documentation in general, and the tutorial in particular, for beginners to get started using Bayesian Networks on their projects. If you an have elementary knowledge of Python and Bayesian Networks then you may find the CausalNex learning curve more challenging. However, we have simplified the tutorial by providing all the Python functions necessary to create your first CausalNex project. Note: There are a number of excellent online resources for learning Python, but be aware that -you should choose those that reference Python 3, as CausalNex is built for Python 3.6+. +you should choose those that reference Python 3, as the latest versions of CausalNex are built for Python 3.8+. There are many curated lists of online resources, such as: - [Official Python programming language website](https://www.python.org/) diff --git a/docs/source/api_docs/index.rst b/docs/source/api_docs/index.rst index e241289..0906f7e 100644 --- a/docs/source/api_docs/index.rst +++ b/docs/source/api_docs/index.rst @@ -18,9 +18,9 @@ Welcome to CausalNex's API docs and tutorials! :target: https://github.com/quantumblacklabs/causalnex :alt: Test coverage -.. image:: https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9%20%7C%203.8%20%7C%203.10-blue.svg +.. image:: https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.8%20%7C%203.10-blue.svg :target: https://pypi.org/project/causalnex/ - :alt: Python version 3.6, 3.7, 3.8, 3.9, 3.10 + :alt: Python version 3.8, 3.9, 3.10 .. image:: https://badge.fury.io/py/causalnex.svg :target: https://pypi.org/project/causalnex/ diff --git a/requirements.txt b/requirements.txt index 1476904..cbd7fd6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,17 +1,14 @@ +ipython>=8.10.0 # Required by Snyk networkx~=2.5 -numpy<1.24; python_version >= '3.10' -numpy>=1.14.2, <1.22; python_version < '3.10' +numpy>=1.14.2, <1.24 pandas>=1.0, <2.0 pathos>=0.2.7, <0.3.0 pgmpy>=0.1.14, <0.1.20 -scikit-learn>=0.22.0, <0.25.0, !=0.22.2.post1, !=0.24.1; python_version < '3.9' -scikit-learn>=0.24.0, <0.25.0, !=0.24.1; python_version == '3.9' +scikit-learn>=0.22.0, !=0.22.2.post1, !=0.24.1; python_version < '3.9' +scikit-learn>=0.24.0, !=0.24.1; python_version == '3.9' scikit-learn>=0.25.0; python_version == '3.10' -scipy>=1.2.0, <1.7; python_version < '3.8' -scipy>=1.7; python_version >= '3.8' -setuptools<=60; python_version <= '3.6' -setuptools>=65.5.1; python_version > '3.6' +scipy>=1.7 +setuptools>=65.5.1 torch>=1.7, <2.0 -wheel>=0.37.0; python_version < '3.7' -wheel>=0.38.0; python_version >= '3.7' +wheel>=0.38.0 wrapt>=1.11.0, <1.13 diff --git a/setup.py b/setup.py index 1f7a1db..570039b 100644 --- a/setup.py +++ b/setup.py @@ -68,7 +68,7 @@ long_description=readme, long_description_content_type="text/markdown", url="https://github.com/quantumblacklabs/causalnex", - python_requires=">=3.6, <3.11", + python_requires=">=3.8, <3.11", author="QuantumBlack Labs", author_email="causalnex@quantumblack.com", packages=find_packages(exclude=["docs*", "tests*", "tools*"]), @@ -78,8 +78,6 @@ keywords="Causal Reasoning, Bayesian Network, Inference, Structure Learning, Do-Calculus", classifiers=[ "Development Status :: 4 - Beta", - "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", diff --git a/test_requirements.txt b/test_requirements.txt index 1157bae..b032502 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -2,7 +2,6 @@ Cython>=0.29, <1.0 flake8>=3.5, <4.0 -ipython>=7.0, <7.17 isort>=4.3.16, <5.0 matplotlib~=3.3 mdlp-discretization~=0.3.3 diff --git a/tests/ebaybbn/conftest.py b/tests/ebaybbn/conftest.py index d7b2bca..9496a75 100644 --- a/tests/ebaybbn/conftest.py +++ b/tests/ebaybbn/conftest.py @@ -65,7 +65,9 @@ def sprinkler_graph(): rain.parents = [cloudy] rain.children = [wet_grass] wet_grass.parents = [sprinkler, rain] - bbn = BBN(dict(cloudy=cloudy, sprinkler=sprinkler, rain=rain, wet_grass=wet_grass)) + bbn = BBN( + {"cloudy": cloudy, "sprinkler": sprinkler, "rain": rain, "wet_grass": wet_grass} + ) return bbn @@ -112,49 +114,49 @@ def f_a(a): return 1 / 2 def f_b(a, b): - tt = dict(tt=0.5, ft=0.4, tf=0.5, ff=0.6) + tt = {"tt": 0.5, "ft": 0.4, "tf": 0.5, "ff": 0.6} return tt[make_key(a, b)] def f_c(a, c): - tt = dict(tt=0.7, ft=0.2, tf=0.3, ff=0.8) + tt = {"tt": 0.7, "ft": 0.2, "tf": 0.3, "ff": 0.8} return tt[make_key(a, c)] def f_d(b, d): - tt = dict(tt=0.9, ft=0.5, tf=0.1, ff=0.5) + tt = {"tt": 0.9, "ft": 0.5, "tf": 0.1, "ff": 0.5} return tt[make_key(b, d)] def f_e(c, e): - tt = dict(tt=0.3, ft=0.6, tf=0.7, ff=0.4) + tt = {"tt": 0.3, "ft": 0.6, "tf": 0.7, "ff": 0.4} return tt[make_key(c, e)] def f_f(d, e, f): - tt = dict( - ttt=0.01, - ttf=0.99, - tft=0.01, - tff=0.99, - ftt=0.01, - ftf=0.99, - fft=0.99, - fff=0.01, - ) + tt = { + "ttt": 0.01, + "ttf": 0.99, + "tft": 0.01, + "tff": 0.99, + "ftt": 0.01, + "ftf": 0.99, + "fft": 0.99, + "fff": 0.01, + } return tt[make_key(d, e, f)] def f_g(c, g): - tt = dict(tt=0.8, tf=0.2, ft=0.1, ff=0.9) + tt = {"tt": 0.8, "tf": 0.2, "ft": 0.1, "ff": 0.9} return tt[make_key(c, g)] def f_h(e, g, h): - tt = dict( - ttt=0.05, - ttf=0.95, - tft=0.95, - tff=0.05, - ftt=0.95, - ftf=0.05, - fft=0.95, - fff=0.05, - ) + tt = { + "ttt": 0.05, + "ttf": 0.95, + "tft": 0.95, + "tff": 0.05, + "ftt": 0.95, + "ftf": 0.05, + "fft": 0.95, + "fff": 0.05, + } return tt[make_key(e, g, h)] return [f_a, f_b, f_c, f_d, f_e, f_f, f_g, f_h]