From 6479dbc693d7fab4366f140ad6f02454a11556b0 Mon Sep 17 00:00:00 2001 From: Felipe Date: Thu, 28 Mar 2024 08:21:56 -0700 Subject: [PATCH] Remove setuptools + rerun jupyter --- copulas/__init__.py | 10 +- pyproject.toml | 1 - ..._Syntehtic_Data_for_Machine_Learning.ipynb | 438 +++++++++++++++++- 3 files changed, 436 insertions(+), 13 deletions(-) diff --git a/copulas/__init__.py b/copulas/__init__.py index ac91762b..5d0155d2 100644 --- a/copulas/__init__.py +++ b/copulas/__init__.py @@ -15,7 +15,7 @@ import numpy as np import pandas as pd -from pkg_resources import iter_entry_points +from importlib.metadata import entry_points EPSILON = np.finfo(np.float32).eps @@ -311,7 +311,13 @@ def _get_addon_target(addon_path_name): def _find_addons(): """Find and load all copulas add-ons.""" group = 'copulas_modules' - for entry_point in iter_entry_points(group=group): + try: + eps = entry_points(group=group) + except TypeError: + # Load-time selection requires Python >= 3.10 or importlib_metadata >= 3.6. + eps = entry_points().get(group, []) + + for entry_point in eps: try: addon = entry_point.load() except Exception: # pylint: disable=broad-exception-caught diff --git a/pyproject.toml b/pyproject.toml index fdb51a1e..a9f5429b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,6 @@ dependencies = [ "scipy>=1.5.4,<2;python_version<'3.10'", "scipy>=1.9.2,<2;python_version>='3.10' and python_version<'3.12'", "scipy>=1.12.0,<2;python_version>='3.12'", - 'setuptools<70', ] [project.urls] diff --git a/tutorials/04_Syntehtic_Data_for_Machine_Learning.ipynb b/tutorials/04_Syntehtic_Data_for_Machine_Learning.ipynb index 9bc86154..2ccbb879 100644 --- a/tutorials/04_Syntehtic_Data_for_Machine_Learning.ipynb +++ b/tutorials/04_Syntehtic_Data_for_Machine_Learning.ipynb @@ -18,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -43,7 +43,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -82,9 +82,427 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 11, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
ElasticNet()
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + ], + "text/plain": [ + "ElasticNet()" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "from sklearn.linear_model import ElasticNet\n", "\n", @@ -101,14 +519,14 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "0.574182672682398\n" + "0.010323153621473069\n" ] } ], @@ -125,20 +543,20 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "0.5949580051414429\n" + "0.008700399284224392\n" ] } ], "source": [ "model = ElasticNet()\n", - "model.fit(X_train, y_train);\n", + "model.fit(X_train, y_train)\n", "print(model.score(X_test, y_test))" ] }, @@ -166,7 +584,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.9" + "version": "3.12.2" } }, "nbformat": 4,