From fceb4afb75d66f4d16844ab8f032051733353a45 Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Fri, 7 Jun 2024 11:43:18 -0500 Subject: [PATCH 1/2] Fix installation This commit modifies several files in order to make the dashboard install-able using the description in the `README.md`. - `README.md` has been updated to describe the dev installation process. - `.pre-commit-config.yaml` has been cleaned up, and a few steps have been removed. - Added an `environment.yaml` file for creating a virtual environment using `mamba`. - Updated `pyproject.toml` to fix requirements and settings. --- .pre-commit-config.yaml | 68 +++++++++++------------------- README.md | 17 +++++--- environment.yaml | 15 +++++++ pyproject.toml | 92 +++++++++++++---------------------------- 4 files changed, 80 insertions(+), 112 deletions(-) create mode 100644 environment.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa60310..caac22d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,17 +7,25 @@ repos: name: ensure we are not committing to branch `main` args: - --branch=main - - # Make sure all imports are absolute in Python files. - - repo: https://github.com/MarcoGorelli/absolufy-imports - rev: v0.3.1 - hooks: - - id: absolufy-imports - name: format Python imports using absolufy-imports + - id: check-json + - id: check-merge-conflict + - id: check-toml + - id: check-yaml + - id: end-of-file-fixer + - id: mixed-line-ending + args: + - --fix=lf + - id: name-tests-test + args: + - --pytest-test-first + - id: pretty-format-json + args: + - --autofix + - id: trailing-whitespace # Sort Python imports using `isort`. - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort name: sort Python imports using isort @@ -30,22 +38,16 @@ repos: - --trailing-comma - --use-parentheses - # Remove unused `# noqa` comments - - repo: https://github.com/asottile/yesqa - rev: v1.5.0 - hooks: - - id: yesqa - # Remove all unused imports for Python files. - repo: https://github.com/hadialqattan/pycln - rev: v2.1.5 + rev: v2.4.0 hooks: - id: pycln name: remove unused Python imports using pycln # Python formatting - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 24.4.2 hooks: - id: black name: format Python code using black @@ -55,7 +57,7 @@ repos: # Lint Python files using `ruff`. - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.275 + rev: v0.4.8 hooks: - id: ruff name: lint Python using ruff @@ -67,7 +69,7 @@ repos: # Markdown formatting - repo: https://github.com/executablebooks/mdformat - rev: 0.7.16 + rev: 0.7.17 hooks: - id: mdformat name: format Markdown using mdformat @@ -76,30 +78,10 @@ repos: additional_dependencies: - mdformat-myst==0.1.5 - mdformat_tables==0.4.1 - - mdformat-frontmatter==2.0.1 - - # YAML formatting - - repo: https://github.com/lyz-code/yamlfix - rev: 1.11.0 - hooks: - - id: yamlfix - name: format YAML using yamlfix - args: - - ./ - - # TOML formatting - - repo: https://github.com/ComPWA/mirrors-taplo - rev: v0.8.0 - hooks: - - id: taplo - name: format TOML using taplo - args: - - format - - --config=.taplo.toml # Check docstrings are formatted correctly - repo: https://github.com/jsh9/pydoclint - rev: 0.0.13 + rev: 0.4.1 hooks: - id: pydoclint args: @@ -107,18 +89,18 @@ repos: # Run `flake8` on Python files. - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: 7.0.0 hooks: - id: flake8 name: inspect Python code using flake8 args: - --verbose additional_dependencies: - - flake8-annotations==3.0.1 - - flake8-builtins==2.1.0 + - flake8-annotations==3.1.1 + - flake8-builtins==2.5.0 - flake8-debugger==4.1.2 - flake8-docstrings==1.7.0 - flake8-eradicate==1.5.0 - - flake8-markdown==0.4.0 + - flake8-markdown==0.5.0 - flake8-print==5.0.0 - flake8-pyproject==1.2.3 diff --git a/README.md b/README.md index d8fc093..386a00d 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,13 @@ same view and interact with them. ### Contributor installation +Clone the repo locally and `cd` into it. + +```bash +git clone the https://github.com/arviz-devs/arviz_dashboard +cd arviz_dashboard +``` + We will use `mamba` to create a virtual environment where we will install a development version of ArviZ Dashboard. The first step is to follow the instructions here [https://github.com/conda-forge/miniforge#mambaforge](https://github.com/conda-forge/miniforge#mambaforge) @@ -18,16 +25,14 @@ to install the correct version of `mamba` for your operating system. **Note** th `conda` installed already, you can exchange the command `mamba` for `conda` with the same results. ```bash -mamba create --name arviz-dashboard pip python -mamba activate arviz-dashboard +mamba env create --file environment.yaml +mamba activate arviz-dashboard-dev ``` -Once the virtual environment has been created, and you have activated it with the above commands, -you can install the development requirements for `arviz_dashboard` with the following commands. +Once the virtual environment has been created and activated, you can install the development +requirements for `arviz_dashboard` using `pip`. ```bash -git clone the https://github.com/arviz-devs/arviz_dashboard -cd arviz_dashboard pip install --editable .[dev,examples] ``` diff --git a/environment.yaml b/environment.yaml new file mode 100644 index 0000000..5e7803c --- /dev/null +++ b/environment.yaml @@ -0,0 +1,15 @@ +name: arviz-dashboard-dev + +channels: + - conda-forge + +dependencies: + - python =3.11 + + # Package managers + - nodejs + - pip + + # Local dependencies + - pynvim + - pyright diff --git a/pyproject.toml b/pyproject.toml index 200412c..d146c73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,25 +1,30 @@ [build-system] -build-backend = "hatchling.build" -requires = ["hatchling"] +build-backend = "setuptools.build_meta" +requires = ["setuptools", "setuptools-scm"] [project] authors = [{name = "arviz-devs"}] classifiers = [ - "Development Status :: 1 - Planning", - "Intended Audience :: Science/Research", - "Intended Audience :: Education", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Scientific/Engineering", - "Topic :: Scientific/Engineering :: Visualization", - "Topic :: Scientific/Engineering :: Mathematics", + "Development Status :: 1 - Planning", + "Intended Audience :: Science/Research", + "Intended Audience :: Education", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Visualization", + "Topic :: Scientific/Engineering :: Mathematics", ] -dependencies = ["arviz>0.15", "jupyterlab>4.0", "panel<1.0"] -description = "Bayesian Dashboards built on top of Panel" +dependencies = [ + "arviz", + "bokeh", + "jupyterlab", + "panel", +] +description = "Dashboards for Bayesian modeling" dynamic = ["version"] keywords = [] license = {file = "LICENSE"} @@ -29,7 +34,12 @@ readme = {file = "README.md", content-type = "text/markdown"} requires-python = ">3.9" [project.optional-dependencies] -dev = ["pre-commit"] +dev = [ + "ipdb", + "pre-commit", + "pyre-check", +] +test = ["pytest", "pytest-cov"] examples = ["pymc"] [project.urls] @@ -38,49 +48,5 @@ examples = ["pymc"] "Homepage" = "https://github.com/arviz-devs/arviz_dashboard" "Repository" = "https://github.com/arviz-devs/arviz_dashboard" -[tool.hatch.version] -path = "src/arviz_dashboard/__init__.py" - -[tool.isort] -force_grid_wrap = 0 -include_trailing_comma = true -line_length = 100 -multi_line_output = 3 -profile = "black" -use_parentheses = true - -[tool.black] -line-length = 100 - -[tool.ruff] -line-length = 100 -per-file-ignores = {"__init__.py" = ["F401"]} - -[tool.pycln] -all = true -disable_all_dunder_policy = true -expand_stars = true -extend_exclude = "__init__.py" -path = "src/arviz_dashboard" -verbose = true - -[tool.yamlfix] -explicit_start = false -line_length = 100 -section_whitelines = 1 -sequence_style = "block_style" -whitelines = 1 - -[tool.flake8] -ignore = [ - "ANN002", # missing type annotations for *args - "ANN003", # missing type annotations for *kwargs - "D100", # missing docstring in public module - "D104", # missing docstring in public package - "D107", # missing docstring in __init__ methods of classes -] -max-line-length = 100 -per-file-ignores = ["__init__.py:F401"] - -[tool.pydoclint] -style = "numpy" +[tool.setuptools.dynamic] +version = {attr = "arviz_dashboard.__version__"} From f191e0a61c9d12399bffa0f83f3cd6d7eb428b7b Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Fri, 7 Jun 2024 12:25:45 -0500 Subject: [PATCH 2/2] remove local deps --- environment.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/environment.yaml b/environment.yaml index 5e7803c..f465aa2 100644 --- a/environment.yaml +++ b/environment.yaml @@ -9,7 +9,3 @@ dependencies: # Package managers - nodejs - pip - - # Local dependencies - - pynvim - - pyright