Skip to content

Instantly share code, notes, and snippets.

@bryanpaget
Last active August 28, 2025 14:02
Show Gist options
  • Select an option

  • Save bryanpaget/49f22e541b73a549a812249abbed070d to your computer and use it in GitHub Desktop.

Select an option

Save bryanpaget/49f22e541b73a549a812249abbed070d to your computer and use it in GitHub Desktop.
A Python package test suite for The Zone.
Python version: 3.13.5 | packaged by conda-forge | (main, Jun 16 2025, 08:27:50) [GCC 13.3.0]
Testing 63 packages for compatibility with Python 3.13.5 (Offline mode)
Testing numpy...
✅ NumPy basic functionality test passed
Testing pandas...
✅ Pandas basic functionality test passed
Testing scipy...
✅ SciPy basic functionality test passed
Testing matplotlib...
✅ Matplotlib basic functionality test passed
Testing seaborn...
✅ Seaborn basic functionality test passed (offline)
Testing scikit-learn...
✅ Scikit-learn basic functionality test passed
Testing jupyter...
✅ Jupyter basic import test passed
Testing jupyterlab...
✅ No specific test for jupyterlab, import test passed
Testing ipython...
✅ IPython basic import test passed
Testing ipykernel...
✅ No specific test for ipykernel, import test passed
Testing notebook...
✅ No specific test for notebook, import test passed
Testing flask...
✅ Flask basic functionality test passed
Testing dash...
✅ Dash basic functionality test passed
Testing bokeh...
✅ Bokeh basic functionality test passed
Testing plotly...
✅ Plotly basic functionality test passed
Testing requests...
✅ Requests basic functionality test passed (offline)
Testing urllib3...
✅ No specific test for urllib3, import test passed
Testing httpx...
✅ No specific test for httpx, import test passed
Testing sqlalchemy...
✅ SQLAlchemy basic functionality test passed
Testing pyodbc...
✅ No specific test for pyodbc, import test passed
Testing pyspark...
✅ PySpark basic functionality test passed
Testing pyarrow...
✅ PyArrow basic functionality test passed
Testing dask...
✅ Dask basic functionality test passed
Testing distributed...
✅ No specific test for distributed, import test passed
Testing h5py...
✅ H5Py basic functionality test passed
Testing pillow...
✅ Pillow basic functionality test passed
Testing scikit-image...
✅ Scikit-image basic functionality test passed
Testing imageio...
✅ No specific test for imageio, import test passed
Testing sympy...
✅ SymPy basic functionality test passed
Testing mpmath...
✅ No specific test for mpmath, import test passed
Testing pyyaml...
✅ PyYAML basic functionality test passed
Testing tomli...
✅ No specific test for tomli, import test passed
Testing tomlkit...
✅ No specific test for tomlkit, import test passed
Testing lxml...
✅ lxml basic functionality test passed
Testing beautifulsoup4...
✅ BeautifulSoup basic functionality test passed
Testing cryptography...
✅ Cryptography basic functionality test passed
Testing pyjwt...
✅ PyJWT basic functionality test passed
Testing openpyxl...
✅ OpenPyXL basic functionality test passed
Testing xlrd...
✅ No specific test for xlrd, import test passed
Testing networkx...
✅ NetworkX basic functionality test passed
Testing statsmodels...
✅ Statsmodels basic functionality test passed
Testing numba...
✅ Numba basic functionality test passed
Testing llvmlite...
✅ No specific test for llvmlite, import test passed
Testing click...
✅ No specific test for click, import test passed
Testing tqdm...
✅ No specific test for tqdm, import test passed
Testing colorama...
✅ No specific test for colorama, import test passed
Testing python-dateutil...
✅ python-dateutil basic functionality test passed
Testing pytz...
✅ No specific test for pytz, import test passed
Testing tzlocal...
✅ No specific test for tzlocal, import test passed
Testing setuptools...
✅ No specific test for setuptools, import test passed
Testing wheel...
✅ No specific test for wheel, import test passed
Testing pip...
✅ No specific test for pip, import test passed
Testing black...
✅ No specific test for black, import test passed
Testing flake8...
✅ No specific test for flake8, import test passed
Testing pylint...
✅ No specific test for pylint, import test passed
Testing isort...
✅ No specific test for isort, import test passed
Testing autopep8...
✅ No specific test for autopep8, import test passed
Testing yapf...
✅ No specific test for yapf, import test passed
Testing GitPython...
✅ GitPython basic import test passed
Testing requests-oauthlib...
✅ requests-oauthlib basic import test passed
Testing google-auth...
✅ google-auth basic import test passed
Testing kubernetes...
✅ No specific test for kubernetes, import test passed
Testing pydantic...
✅ No specific test for pydantic, import test passed
==================================================
TEST SUMMARY
==================================================
Total packages tested: 63
Successful imports: 63/63
Successful functionality tests: 63/63
🎉 All packages are compatible with Python 3.13.5!
An exception has occurred, use %tb to see the full traceback.
#!/usr/bin/env python3
"""
Test suite to verify package compatibility with Python 3.13.5 (Offline version)
"""
import sys
import traceback
import importlib
from typing import Dict, List, Tuple, Any
# Mapping of package names to their actual import names
PACKAGE_IMPORT_MAP = {
"scikit-learn": "sklearn",
"ipython": "IPython",
"pillow": "PIL",
"scikit-image": "skimage",
"beautifulsoup4": "bs4",
"python-dateutil": "dateutil",
"GitPython": "git",
"requests-oauthlib": "requests_oauthlib",
"google-auth": "google.auth",
"pyopenssl": "OpenSSL",
"toml": "toml",
"python-lsp-server": "pylsp",
"jupyter-server": "jupyter_server",
"jupyter-lsp": "jupyter_lsp",
"jupyterlab-lsp": "jupyterlab_lsp",
"notebook-shim": "notebook_shim",
"python-json-logger": "pythonjsonlogger",
"matplotlib-inline": "matplotlib_inline",
"ipython-genutils": "IPython_genutils",
"jupyter-core": "jupyter_core",
"jupyter-client": "jupyter_client",
"jupyter-server-terminals": "jupyter_server_terminals",
"jupyter-server-proxy": "jupyter_server_proxy",
"jupyter-resource-usage": "jupyter_resource_usage",
"jupyter-events": "jupyter_events",
"jupyter-server-mathjax": "jupyter_server_mathjax",
"jupyterhub": "jupyterhub",
"jupyterlab": "jupyterlab",
"jupyterlab-widgets": "jupyterlab_widgets",
"jupyter-widgets": "ipywidgets",
"notebook": "notebook",
"nbclassic": "nbclassic",
"nbclient": "nbclient",
"nbconvert": "nbconvert",
"nbformat": "nbformat",
"ipykernel": "ipykernel",
"ipympl": "ipympl",
"ipywidgets": "ipywidgets",
"widgetsnbextension": "widgetsnbextension",
"traitlets": "traitlets",
"comm": "comm",
"debugpy": "debugpy",
"nest-asyncio": "nest_asyncio",
"parso": "parso",
"jedi": "jedi",
"pexpect": "pexpect",
"ptyprocess": "ptyprocess",
"pickleshare": "pickleshare",
"prompt-toolkit": "prompt_toolkit",
"wcwidth": "wcwidth",
"backcall": "backcall",
"decorator": "decorator",
"defusedxml": "defusedxml",
"entrypoints": "entrypoints",
"ipython-pygments-lexers": "ipython_pygments_lexers",
"pygments": "pygments",
"send2trash": "send2trash",
"terminado": "terminado",
"testpath": "testpath",
"tornado": "tornado",
"bleach": "bleach",
"fastjsonschema": "fastjsonschema",
"jsonschema": "jsonschema",
"jsonschema-specifications": "jsonschema_specifications",
"mistune": "mistune",
"nbclient": "nbclient",
"nbformat": "nbformat",
"packaging": "packaging",
"pandocfilters": "pandocfilters",
"tinycss2": "tinycss2",
"webencodings": "webencodings",
"argon2-cffi": "argon2_cffi",
"argon2-cffi-bindings": "argon2_cffi_bindings",
"bcrypt": "bcrypt",
"cffi": "cffi",
"cryptography": "cryptography",
"idna": "idna",
"pyasn1": "pyasn1",
"pyasn1-modules": "pyasn1_modules",
"rsa": "rsa",
"oauthlib": "oauthlib",
"pyjwt": "jwt",
"requests": "requests",
"urllib3": "urllib3",
"certifi": "certifi",
"chardet": "chardet",
"charset-normalizer": "charset_normalizer",
"click": "click",
"flask": "flask",
"itsdangerous": "itsdangerous",
"jinja2": "jinja2",
"markupsafe": "markupsafe",
"werkzeug": "werkzeug",
"dash": "dash",
"dash-core-components": "dash_core_components",
"dash-html-components": "dash_html_components",
"dash-table": "dash_table",
"plotly": "plotly",
"retrying": "retrying",
"six": "six",
"sqlalchemy": "sqlalchemy",
"alembic": "alembic",
"mako": "mako",
"python-editor": "editor",
"pyspark": "pyspark",
"py4j": "py4j",
"pyarrow": "pyarrow",
"dask": "dask",
"distributed": "distributed",
"fsspec": "fsspec",
"locket": "locket",
"msgpack": "msgpack",
"partd": "partd",
"toolz": "toolz",
"cloudpickle": "cloudpickle",
"tblib": "tblib",
"zict": "zict",
"h5py": "h5py",
"pillow": "PIL",
"imageio": "imageio",
"imagecodecs": "imagecodecs",
"tifffile": "tifffile",
"scikit-image": "skimage",
"sympy": "sympy",
"mpmath": "mpmath",
"numpy": "numpy",
"pandas": "pandas",
"scipy": "scipy",
"matplotlib": "matplotlib",
"seaborn": "seaborn",
"bokeh": "bokeh",
"holoviews": "holoviews",
"datashader": "datashader",
"param": "param",
"pyct": "pyct",
"pyviz": "pyviz",
"colorcet": "colorcet",
"datashape": "datashape",
"odo": "odo",
"multipledispatch": "multipledispatch",
"xarray": "xarray",
"netcdf4": "netcdf4",
"h5netcdf": "h5netcdf",
"pytables": "tables",
"zarr": "zarr",
"numba": "numba",
"llvmlite": "llvmlite",
"statsmodels": "statsmodels",
"patsy": "patsy",
"networkx": "networkx",
"lxml": "lxml",
"beautifulsoup4": "bs4",
"html5lib": "html5lib",
"pyyaml": "yaml",
"toml": "toml",
"tomli": "tomli",
"tomlkit": "tomlkit",
"click": "click",
"colorama": "colorama",
"tqdm": "tqdm",
"rich": "rich",
"setuptools": "setuptools",
"wheel": "wheel",
"pip": "pip",
"virtualenv": "virtualenv",
"conda": "conda",
"mamba": "mamba",
"black": "black",
"flake8": "flake8",
"isort": "isort",
"autopep8": "autopep8",
"pycodestyle": "pycodestyle",
"pyflakes": "pyflakes",
"pydocstyle": "pydocstyle",
"pylint": "pylint",
"mypy": "mypy",
"bandit": "bandit",
"safety": "safety",
"pytest": "pytest",
"pytest-cov": "pytest_cov",
"pytest-xdist": "xdist",
"nose2": "nose2",
"coverage": "coverage",
"mock": "mock",
"sphinx": "sphinx",
"sphinx-rtd-theme": "sphinx_rtd_theme",
"sphinxcontrib-napoleon": "sphinxcontrib.napoleon",
"pdoc": "pdoc",
"gitpython": "git",
"requests-oauthlib": "requests_oauthlib",
"google-auth": "google.auth",
"google-auth-oauthlib": "google_auth_oauthlib",
"google-auth-httplib2": "google_auth_httplib2",
"kubernetes": "kubernetes",
"boto3": "boto3",
"botocore": "botocore",
"awscli": "awscli",
"s3fs": "s3fs",
"gcsfs": "gcsfs",
"adlfs": "adlfs",
"pydantic": "pydantic",
"fastapi": "fastapi",
"uvicorn": "uvicorn",
"starlette": "starlette",
"typer": "typer",
"rich": "rich",
"python-multipart": "multipart",
"email-validator": "email_validator",
"jinja2": "jinja2",
"python-jose": "jose",
"passlib": "passlib",
"bcrypt": "bcrypt",
"python-dateutil": "dateutil",
"pytz": "pytz",
"tzlocal": "tzlocal",
"arrow": "arrow",
"pendulum": "pendulum",
"dateparser": "dateparser",
"ciso8601": "ciso8601",
"ujson": "ujson",
"orjson": "orjson",
"rapidfuzz": "rapidfuzz",
"fuzzywuzzy": "fuzzywuzzy",
"python-levenshtein": "Levenshtein",
"regex": "regex",
"nltk": "nltk",
"spacy": "spacy",
"textblob": "textblob",
"gensim": "gensim",
"wordcloud": "wordcloud",
"matplotlib": "matplotlib",
"seaborn": "seaborn",
"plotly": "plotly",
"bokeh": "bokeh",
"altair": "altair",
"pygal": "pygal",
"pygraphviz": "pygraphviz",
"networkx": "networkx",
"scipy": "scipy",
"numpy": "numpy",
"pandas": "pandas",
"scikit-learn": "sklearn",
"xgboost": "xgboost",
"lightgbm": "lightgbm",
"catboost": "catboost",
"tensorflow": "tensorflow",
"torch": "torch",
"torchvision": "torchvision",
"torchaudio": "torchaudio",
"jax": "jax",
"jaxlib": "jaxlib",
"flax": "flax",
"optax": "optax",
"dm-haiku": "haiku",
"chex": "chex",
"rlax": "rlax",
"reverb": "reverb",
"dm-tree": "tree",
"dm-env": "dm_env",
"dm-control": "dm_control",
"gym": "gym",
"gymnasium": "gymnasium",
"stable-baselines3": "stable_baselines3",
"ray": "ray",
"modin": "modin",
"dask": "dask",
"distributed": "distributed",
"vaex": "vaex",
"polars": "polars",
"duckdb": "duckdb",
"pyodbc": "pyodbc",
"psycopg2": "psycopg2",
"pymysql": "pymysql",
"cx-oracle": "cx_Oracle",
"sqlalchemy": "sqlalchemy",
"alembic": "alembic",
"pandas-profiling": "pandas_profiling",
"sweetviz": "sweetviz",
"autoviz": "autoviz",
"dtale": "dtale",
"shap": "shap",
"lime": "lime",
"eli5": "eli5",
"alibi": "alibi",
"interpret": "interpret",
"imbalanced-learn": "imblearn",
"mlxtend": "mlxtend",
"yellowbrick": "yellowbrick",
"missingno": "missingno",
"pandas-vet": "pandas_vet",
"pandas-summary": "pandas_summary",
"pandasql": "pandasql",
"pandera": "pandera",
"great-expectations": "great_expectations",
"tensorflow-datasets": "tensorflow_datasets",
"torchtext": "torchtext",
"torchvision": "torchvision",
"torchaudio": "torchaudio",
"transformers": "transformers",
"datasets": "datasets",
"tokenizers": "tokenizers",
"accelerate": "accelerate",
"evaluate": "evaluate",
"rouge-score": "rouge_score",
"sacrebleu": "sacrebleu",
"bert-score": "bert_score",
"sentencepiece": "sentencepiece",
"protobuf": "protobuf",
"tensorboard": "tensorboard",
"wandb": "wandb",
"mlflow": "mlflow",
"optuna": "optuna",
"hyperopt": "hyperopt",
"ray[tune]": "ray.tune",
"sigopt": "sigopt",
"ax-platform": "ax",
"bohb": "bohb",
"hpbandster": "hpbandster",
"nevergrad": "nevergrad",
"skopt": "skopt",
"pymoo": "pymoo",
"platypus": "platypus",
"deap": "deap",
"pyswarms": "pyswarms",
"pygmo": "pygmo",
"cma": "cma",
"nlopt": "nlopt",
"dlib": "dlib",
"cvxpy": "cvxpy",
"cvxopt": "cvxopt",
"picos": "picos",
"qpsolvers": "qpsolvers",
"osqp": "osqp",
"scs": "scs",
"ecos": "ecos",
"clarabel": "clarabel",
"proxsuite": "proxsuite",
"highs": "highs",
"ortools": "ortools",
"pulp": "pulp",
"pyomo": "pyomo",
"gekko": "gekko",
"casadi": "casadi",
"sympy": "sympy",
"mpmath": "mpmath",
"sage": "sage",
"sage-all": "sage.all",
"sage-calculus": "sage.calculus",
"sage-combinat": "sage.combinat",
"sage-databases": "sage.databases",
"sage-graphs": "sage.graphs",
"sage-groups": "sage.groups",
"sage-misc": "sage.misc",
"sage-modules": "sage.modules",
"sage-numbers": "sage.numbers",
"sage-plot": "sage.plot",
"sage-rings": "sage.rings",
"sage-schemes": "sage.schemes",
"sage-sets": "sage.sets",
"sage-structure": "sage.structure",
"sage-symbolic": "sage.symbolic",
"sage-topology": "sage.topology",
}
def test_import(package_name: str) -> Tuple[bool, str]:
"""Test if a package can be imported successfully."""
try:
# Get the actual import name from the map, or use the package name if not in the map
import_name = PACKAGE_IMPORT_MAP.get(package_name, package_name)
importlib.import_module(import_name)
return True, f"Successfully imported {package_name} as {import_name}"
except ImportError as e:
return False, f"Failed to import {package_name}: {str(e)}"
except Exception as e:
return False, f"Unexpected error importing {package_name}: {str(e)}"
def test_basic_functionality(package_name: str) -> Tuple[bool, str]:
"""Test basic functionality of key packages."""
try:
# Get the actual import name from the map, or use the package name if not in the map
import_name = PACKAGE_IMPORT_MAP.get(package_name, package_name)
if package_name == "numpy":
import numpy as np
arr = np.array([1, 2, 3])
result = np.sum(arr)
assert result == 6, f"Expected 6, got {result}"
return True, "NumPy basic functionality test passed"
elif package_name == "pandas":
import pandas as pd
df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
result = df.sum().sum()
assert result == 21, f"Expected 21, got {result}"
return True, "Pandas basic functionality test passed"
elif package_name == "matplotlib":
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 4, 9])
plt.close(fig)
return True, "Matplotlib basic functionality test passed"
elif package_name == "scipy":
import scipy
from scipy import stats
result = stats.norm.cdf(0)
assert 0.49 < result < 0.51, f"Expected ~0.5, got {result}"
return True, "SciPy basic functionality test passed"
elif package_name == "scikit-learn":
import sklearn
from sklearn.datasets import load_iris
from sklearn.tree import DecisionTreeClassifier
data = load_iris()
clf = DecisionTreeClassifier()
clf.fit(data.data, data.target)
return True, "Scikit-learn basic functionality test passed"
elif package_name == "jupyter":
import jupyter
return True, "Jupyter basic import test passed"
elif package_name == "flask":
from flask import Flask
app = Flask(__name__)
return True, "Flask basic functionality test passed"
elif package_name == "dash":
import dash
app = dash.Dash(__name__)
return True, "Dash basic functionality test passed"
elif package_name == "requests":
import requests
# Test creating a session without making a network request
session = requests.Session()
# Test creating a Request object without sending it
req = requests.Request('GET', 'https://example.com')
prep = session.prepare_request(req)
# Check that the URL contains our expected domain (be flexible about trailing slash)
assert 'example.com' in prep.url, f"Expected URL to contain 'example.com', got {prep.url}"
return True, "Requests basic functionality test passed (offline)"
elif package_name == "sqlalchemy":
import sqlalchemy
from sqlalchemy import create_engine
engine = create_engine('sqlite:///:memory:')
engine.dispose()
return True, "SQLAlchemy basic functionality test passed"
elif package_name == "pyspark":
import pyspark
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName("Test").getOrCreate()
df = spark.createDataFrame([(1, "a"), (2, "b")], ["id", "value"])
count = df.count()
assert count == 2, f"Expected count 2, got {count}"
spark.stop()
return True, "PySpark basic functionality test passed"
elif package_name == "pyarrow":
import pyarrow as pa
arr = pa.array([1, 2, 3])
assert arr.to_pylist() == [1, 2, 3], f"Expected [1, 2, 3], got {arr.to_pylist()}"
return True, "PyArrow basic functionality test passed"
elif package_name == "h5py":
import h5py
import tempfile
with tempfile.NamedTemporaryFile(suffix='.h5') as f:
with h5py.File(f.name, 'w') as hf:
hf.create_dataset('test_dataset', data=[1, 2, 3])
with h5py.File(f.name, 'r') as hf:
data = hf['test_dataset'][:]
assert list(data) == [1, 2, 3], f"Expected [1, 2, 3], got {list(data)}"
return True, "H5Py basic functionality test passed"
elif package_name == "pillow":
from PIL import Image
import numpy as np
img = Image.fromarray(np.zeros((10, 10, 3), dtype=np.uint8))
assert img.size == (10, 10), f"Expected size (10, 10), got {img.size}"
return True, "Pillow basic functionality test passed"
elif package_name == "scikit-image":
import skimage
from skimage import data
# Use a local image instead of downloading one
image = data.binary_blobs(length=64)
assert image.shape == (64, 64), f"Expected shape (64, 64), got {image.shape}"
return True, "Scikit-image basic functionality test passed"
elif package_name == "sympy":
import sympy
x = sympy.Symbol('x')
expr = sympy.diff(x**2, x)
assert str(expr) == "2*x", f"Expected '2*x', got '{str(expr)}'"
return True, "SymPy basic functionality test passed"
elif package_name == "plotly":
import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(x=['A', 'B', 'C'], y=[1, 3, 2]))
return True, "Plotly basic functionality test passed"
elif package_name == "bokeh":
from bokeh.plotting import figure
p = figure()
p.line([1, 2, 3], [1, 4, 9])
return True, "Bokeh basic functionality test passed"
elif package_name == "dask":
import dask.array as da
x = da.ones((10, 10), chunks=(5, 5))
result = x.sum().compute()
assert result == 100, f"Expected 100, got {result}"
return True, "Dask basic functionality test passed"
elif package_name == "numba":
import numba
@numba.jit
def test_func(x):
return x + 1
result = test_func(5)
assert result == 6, f"Expected 6, got {result}"
return True, "Numba basic functionality test passed"
elif package_name == "pyyaml":
import yaml
data = yaml.safe_load("test: value")
assert data == {"test": "value"}, f"Expected {{'test': 'value'}}, got {data}"
return True, "PyYAML basic functionality test passed"
elif package_name == "lxml":
from lxml import etree
root = etree.Element("root")
child = etree.SubElement(root, "child")
child.text = "text"
assert root.xpath("//child/text()") == ["text"], f"Expected ['text'], got {root.xpath('//child/text()')}"
return True, "lxml basic functionality test passed"
elif package_name == "beautifulsoup4":
import bs4
soup = bs4.BeautifulSoup("<div>test</div>", "html.parser")
assert soup.div.text == "test", f"Expected 'test', got '{soup.div.text}'"
return True, "BeautifulSoup basic functionality test passed"
elif package_name == "cryptography":
import cryptography
from cryptography.fernet import Fernet
key = Fernet.generate_key()
f = Fernet(key)
token = f.encrypt(b"test message")
message = f.decrypt(token)
assert message == b"test message", f"Expected b'test message', got {message}"
return True, "Cryptography basic functionality test passed"
elif package_name == "pyjwt":
import jwt
token = jwt.encode({"test": "data"}, "secret", algorithm="HS256")
data = jwt.decode(token, "secret", algorithms=["HS256"])
assert data == {"test": "data"}, f"Expected {{'test': 'data'}}, got {data}"
return True, "PyJWT basic functionality test passed"
elif package_name == "openpyxl":
import openpyxl
from openpyxl import Workbook
wb = Workbook()
ws = wb.active
ws['A1'] = "test"
assert ws['A1'].value == "test", f"Expected 'test', got {ws['A1'].value}"
return True, "OpenPyXL basic functionality test passed"
elif package_name == "networkx":
import networkx as nx
G = nx.Graph()
G.add_edge(1, 2)
assert list(G.edges()) == [(1, 2)], f"Expected [(1, 2)], got {list(G.edges())}"
return True, "NetworkX basic functionality test passed"
elif package_name == "statsmodels":
import statsmodels.api as sm
import numpy as np
X = np.random.rand(100, 2)
y = X @ np.array([1.5, -2.0]) + np.random.normal(0, 0.1, 100)
X = sm.add_constant(X)
model = sm.OLS(y, X).fit()
assert len(model.params) == 3, f"Expected 3 parameters, got {len(model.params)}"
return True, "Statsmodels basic functionality test passed"
elif package_name == "seaborn":
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
# Create a local dataset instead of downloading one
np.random.seed(42)
tips = pd.DataFrame({
'total_bill': np.random.normal(20, 5, 100),
'tip': np.random.normal(3, 1, 100),
'sex': np.random.choice(['Male', 'Female'], 100),
'smoker': np.random.choice(['Yes', 'No'], 100),
'day': np.random.choice(['Thur', 'Fri', 'Sat', 'Sun'], 100),
'time': np.random.choice(['Lunch', 'Dinner'], 100),
'size': np.random.randint(1, 6, 100)
})
# Test basic plotting with local data
sns.scatterplot(x='total_bill', y='tip', data=tips)
plt.close('all')
return True, "Seaborn basic functionality test passed (offline)"
elif package_name == "ipython":
import IPython
return True, "IPython basic import test passed"
elif package_name == "python-dateutil":
import dateutil
from dateutil.parser import parse
dt = parse("2023-01-01")
assert dt.year == 2023, f"Expected year 2023, got {dt.year}"
return True, "python-dateutil basic functionality test passed"
elif package_name == "GitPython":
import git
return True, "GitPython basic import test passed"
elif package_name == "requests-oauthlib":
import requests_oauthlib
return True, "requests-oauthlib basic import test passed"
elif package_name == "google-auth":
import google.auth
return True, "google-auth basic import test passed"
else:
return True, f"No specific test for {package_name}, import test passed"
except Exception as e:
return False, f"Error testing {package_name} functionality: {str(e)}\n{traceback.format_exc()}"
def main():
"""Main function to run all tests."""
# Extract package names from the pip freeze output
# This is a simplified list based on the provided pip freeze output
# In a real scenario, you might want to parse the actual pip freeze output
packages = [
"numpy", "pandas", "scipy", "matplotlib", "seaborn", "scikit-learn",
"jupyter", "jupyterlab", "ipython", "ipykernel", "notebook",
"flask", "dash", "bokeh", "plotly",
"requests", "urllib3", "httpx",
"sqlalchemy", "pyodbc",
"pyspark", "pyarrow", "dask", "distributed",
"h5py", "pillow", "scikit-image", "imageio",
"sympy", "mpmath",
"pyyaml", "tomli", "tomlkit",
"lxml", "beautifulsoup4",
"cryptography", "pyjwt",
"openpyxl", "xlrd",
"networkx",
"statsmodels",
"numba", "llvmlite",
"click", "tqdm", "colorama",
"python-dateutil", "pytz", "tzlocal",
"setuptools", "wheel", "pip",
"black", "flake8", "pylint", "isort", "autopep8", "yapf",
"GitPython", "requests-oauthlib", "google-auth", "kubernetes",
"pydantic"
]
print(f"Python version: {sys.version}")
print(f"Testing {len(packages)} packages for compatibility with Python 3.13.5 (Offline mode)\n")
results = {}
failed_imports = []
failed_functionality = []
for package in packages:
print(f"Testing {package}...")
# Test import
import_success, import_message = test_import(package)
results[f"{package}_import"] = (import_success, import_message)
if not import_success:
failed_imports.append(package)
print(f" ❌ {import_message}")
continue
# Test basic functionality
func_success, func_message = test_basic_functionality(package)
results[f"{package}_functionality"] = (func_success, func_message)
if func_success:
print(f" ✅ {func_message}")
else:
failed_functionality.append(package)
print(f" ❌ {func_message}")
# Print summary
print("\n" + "="*50)
print("TEST SUMMARY")
print("="*50)
total_packages = len(packages)
successful_imports = total_packages - len(failed_imports)
successful_functionality = successful_imports - len(failed_functionality)
print(f"Total packages tested: {total_packages}")
print(f"Successful imports: {successful_imports}/{total_packages}")
print(f"Successful functionality tests: {successful_functionality}/{successful_imports}")
if failed_imports:
print("\n❌ Packages that failed to import:")
for pkg in failed_imports:
print(f" - {pkg}: {results[f'{pkg}_import'][1]}")
if failed_functionality:
print("\n❌ Packages that failed functionality tests:")
for pkg in failed_functionality:
print(f" - {pkg}: {results[f'{pkg}_functionality'][1]}")
if not failed_imports and not failed_functionality:
print("\n🎉 All packages are compatible with Python 3.13.5!")
return 0
else:
print(f"\n⚠️ {len(failed_imports + failed_functionality)} packages had issues with Python 3.13.5")
return 1
if __name__ == "__main__":
sys.exit(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment