Skip to content

Migrate to pyproject toml #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,28 @@ jobs:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v2
id: setup-python
with:
python-version: 3.8
- name: Install uv
uses: astral-sh/setup-uv@v1
with:
uv-version: 'latest'
- name: Cache uv global directory
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: ${{ runner.os }}-uv-3.8-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-3.8-
- name: Generate coverage report
run: |
python -m pip install --upgrade pip setuptools wheel
pip install pytest pytest-cov
pip install -r requirements_testing.txt
pip install -e .
# Install project with test dependencies (includes pytest and pytest-cov)
uv pip install ".[test]"
pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
flags: unittests
51 changes: 41 additions & 10 deletions .github/workflows/explainerdashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,49 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v1
with:
uv-version: 'latest'
- name: Cache uv global directory
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-${{ matrix.python-version }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install flake8 pytest
pip install --upgrade --upgrade-strategy eager -r requirements_testing.txt
pip install --upgrade --upgrade-strategy eager -e .
- name: Lint with flake8
# Install the current project (.) and its 'test' and 'docs' extras.
# Quotation marks around ".[test,docs]" are good practice for shells.
uv pip install ".[test,docs]" --system
- name: Verify script installation (for debugging)
run: |
echo "Python version: $(python --version)"
echo "uv version: $(uv --version)"
echo "PYTHONUSERBASE: $PYTHONUSERBASE"
echo "PIP_USER: $PIP_USER"
echo "Checking for explainerdashboard script..."
if [[ "$RUNNER_OS" == "Windows" ]]; then
Get-Command explainerdashboard -ErrorAction SilentlyContinue || echo "explainerdashboard not found"
Get-Command explainerhub -ErrorAction SilentlyContinue || echo "explainerhub not found"
echo "PATH: $($env:PATH)"
else
which explainerdashboard || echo "explainerdashboard not found in PATH"
which explainerhub || echo "explainerhub not found in PATH"
echo "PATH: $PATH"
fi
# Show where packages are installed and scripts path
PYTHON_SCRIPTS_PATH=$(python -c "import sysconfig; print(sysconfig.get_path('scripts'))")
echo "Python scripts directory (from sysconfig): $PYTHON_SCRIPTS_PATH"
if [[ -d "$PYTHON_SCRIPTS_PATH" ]]; then
ls -alh "$PYTHON_SCRIPTS_PATH"
else
echo "Scripts directory does not exist or is not accessible."
fi
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
uv run ruff check --ignore=F405,F403,E402
- name: Test with pytest
run: |
pytest -k "not selenium"
pytest -k "not selenium"
22 changes: 20 additions & 2 deletions .github/workflows/upload_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,26 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: python3 -m pip install --upgrade build && python3 -m build
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v1
with:
uv-version: 'latest'
- name: Cache uv global directory
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: ${{ runner.os }}-uv-3.11-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-3.11-
- name: Build package
run: |
uv pip install --upgrade build
python3 -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
password: ${{ secrets.PYPI_TOKEN }}
7 changes: 5 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
version: "3.8" # Match project's minimum Python requirement
install:
- requirements: docs/requirements.txt
- method: pip
path: .
extras:
- docs # This will install dependencies from [project.optional-dependencies.docs]
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include requirements.txt
include pyproject.toml
129 changes: 77 additions & 52 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,34 @@
#
import os
import sys
print('conf.py, adding to path: ', os.path.abspath('../../explainerdashboard/'))
#sys.path.insert(0, os.path.abspath('../../explainerdashboard/'))
#sys.path.insert(0, os.path.abspath('../../explainerdashboard/dashboard_components/'))
print('conf.py, adding to path: ', os.path.abspath('../../'))
sys.path.insert(0, os.path.abspath('../../'))
sys.path.insert(0, os.path.abspath('../..'))

#sys.path.insert(0, os.path.abspath('../explainerdashboard/dashboard_tabs/'))
#sys.path.insert(0, os.path.join(os.path.dirname(__name__), '../explainerdashboard/'))
#print('conf.py, adding to path: ', os.path.join(os.path.dirname(__name__), '../explainerdashboard/'))
#sys.path.append(os.path.join(os.path.dirname(__name__), '../explainerdashboard/'))
print("conf.py, adding to path: ", os.path.abspath("../../explainerdashboard/"))
# sys.path.insert(0, os.path.abspath('../../explainerdashboard/'))
# sys.path.insert(0, os.path.abspath('../../explainerdashboard/dashboard_components/'))
print("conf.py, adding to path: ", os.path.abspath("../../"))
sys.path.insert(0, os.path.abspath("../../"))
sys.path.insert(0, os.path.abspath("../.."))

# sys.path.insert(0, os.path.abspath('../explainerdashboard/dashboard_tabs/'))
# sys.path.insert(0, os.path.join(os.path.dirname(__name__), '../explainerdashboard/'))
# print('conf.py, adding to path: ', os.path.join(os.path.dirname(__name__), '../explainerdashboard/'))
# sys.path.append(os.path.join(os.path.dirname(__name__), '../explainerdashboard/'))


# -- Project information -----------------------------------------------------

project = 'explainerdashboard'
copyright = '2020, Oege Dijk'
author = 'Oege Dijk'
project = "explainerdashboard"
copyright = "2020, Oege Dijk"
author = "Oege Dijk"

# The short X.Y version
version = '0.2'
version = "0.2"
# The full version, including alpha/beta/rc tags
release = '0.2'
release = "0.2"


# -- General configuration ---------------------------------------------------
master_doc = 'index'
master_doc = "index"

# If your documentation needs a minimal Sphinx version, state it here.
#
Expand All @@ -50,37 +51,53 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosectionlabel',
"sphinx.ext.autodoc",
"sphinx.ext.autosectionlabel",
"sphinx_rtd_theme",
'sphinx.ext.napoleon',
'sphinx_autodoc_typehints'
"sphinx.ext.napoleon",
"sphinx_autodoc_typehints",
]

autodoc_mock_imports = ['matplotlib', 'np', 'dash', 'dash_bootstrap_components',
'dash_html_components', 'dash_table', 'dash_core_components',
'dtreeviz', 'numpy', 'pandas', 'pd',
'sklearn', 'shap', 'plotly',
'joblib', 'dash_auth', 'jupyter_dash', 'oyaml', 'click',
'flask', 'flask_simplelogin', 'werkzeug']
autodoc_mock_imports = [
"matplotlib",
"np",
"dash",
"dash_bootstrap_components",
"dash_html_components",
"dash_table",
"dash_core_components",
"dtreeviz",
"numpy",
"pandas",
"pd",
"sklearn",
"shap",
"plotly",
"joblib",
"dash_auth",
"jupyter_dash",
"oyaml",
"click",
"flask",
"flask_simplelogin",
"werkzeug",
]

autoclass_content = "both"

autodoc_default_options = {
'member-order': 'bysource'
}
autodoc_default_options = {"member-order": "bysource"}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['ntemplates']
templates_path = ["ntemplates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -103,9 +120,9 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
#html_theme = 'alabaster'
#html_theme = "nature"
#html_theme = "bizstyle"
# html_theme = 'alabaster'
# html_theme = "nature"
# html_theme = "bizstyle"
html_theme = "sphinx_rtd_theme"

# Theme options are theme-specific and customize the look and feel of a theme
Expand All @@ -117,7 +134,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['nstatic']
html_static_path = ["nstatic"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand All @@ -130,17 +147,18 @@
# html_sidebars = {}

from sphinx.builders.html import StandaloneHTMLBuilder

StandaloneHTMLBuilder.supported_image_types = [
'image/svg+xml',
'image/gif',
'image/png',
'image/jpeg'
"image/svg+xml",
"image/gif",
"image/png",
"image/jpeg",
]

# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'explainerdashboarddoc'
htmlhelp_basename = "explainerdashboarddoc"


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -149,15 +167,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -167,8 +182,13 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'explainerdashboard.tex', 'explainerdashboard Documentation',
'Oege Dijk', 'manual'),
(
master_doc,
"explainerdashboard.tex",
"explainerdashboard Documentation",
"Oege Dijk",
"manual",
),
]


Expand All @@ -177,8 +197,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'explainerdashboard', 'explainerdashboard Documentation',
[author], 1)
(master_doc, "explainerdashboard", "explainerdashboard Documentation", [author], 1)
]


Expand All @@ -188,9 +207,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'explainerdashboard', 'explainerdashboard Documentation',
author, 'explainerdashboard', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"explainerdashboard",
"explainerdashboard Documentation",
author,
"explainerdashboard",
"One line description of project.",
"Miscellaneous",
),
]


Expand All @@ -209,7 +234,7 @@
# epub_uid = ''

# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
epub_exclude_files = ["search.html"]


# -- Extension configuration -------------------------------------------------
2 changes: 1 addition & 1 deletion explainerdashboard/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
___version__ = "0.4.8"
__version__ = "0.4.8"

from .explainers import ClassifierExplainer, RegressionExplainer # noqa
from .dashboards import ExplainerDashboard, ExplainerHub, InlineExplainer # noqa
Loading
Loading