Skip to content

Commit

Permalink
Attempt to fix readthedocs build (#1105)
Browse files Browse the repository at this point in the history
* dummy change

* remove requirements.txt

* 'turn off fail on warnings'

* trying alternative docs env (from foyer)

* add missing package

* turn on fail_on_warning

* add boltons to MOCK_MODULES

* add boltons and networkx to yml

* update intershpinx_mapping syntax

* turn off fail_on_warning

* remove unnecessary lines

* replace pkg_resources import with importlib

* properly replace pkg_resources

* remove commented code

* remove py3.8 support due to incomplete importlib support
  • Loading branch information
daico007 authored May 16, 2023
1 parent d1c1f33 commit b4d2082
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11"]
exclude:
- os: windows-latest
python-version: 3.8
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ formats:
- htmlzip
- pdf
conda:
environment: docs/environment-docs.yml
environment: docs/docs-env.yml
build:
os: ubuntu-20.04
tools:
python: "mambaforge-4.10"
sphinx:
builder: html
configuration: docs/conf.py
fail_on_warning: True
fail_on_warning: false
9 changes: 5 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"gsd.fl",
"freud",
"freud.box",
"treelib",
]
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = mock.Mock()
Expand Down Expand Up @@ -133,10 +134,10 @@
_python_doc_base = "https://docs.python.org/3.9"

intersphinx_mapping = {
_python_doc_base: None,
"https://numpy.org/doc/stable": None,
"https://docs.scipy.org/doc/scipy/reference": None,
"https://scikit-learn.org/stable": None,
"python": ("https://docs.python.org/3.9", None),
"numpy": ("https://numpy.org/doc/stable", None),
"scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
"scikit-learn": ("https://scikit-learn.org/stable", None),
}

# Add any paths that contain templates here, relative to this directory.
Expand Down
21 changes: 21 additions & 0 deletions docs/docs-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: mbuild-docs
channels:
- jaimergp/label/unsupported-cudatoolkit-shim
- conda-forge
dependencies:
- python>=3.8
- pip
- pip:
- boltons
- networkx
- sphinx
- sphinx_rtd_theme
- sphinxcontrib-svg2pdfconverter[CairoSVG]
- cairosvg
- nbsphinx
- networkx >=2.0
- lark-parser
- requests
- lxml
- numpydoc
- widgetsnbextension
21 changes: 0 additions & 21 deletions docs/environment-docs.yml

This file was deleted.

9 changes: 0 additions & 9 deletions docs/requirements.txt

This file was deleted.

6 changes: 4 additions & 2 deletions mbuild/recipes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ class Recipes(object):


recipes = Recipes()
from pkg_resources import iter_entry_points
from importlib import metadata

entry_points = metadata.entry_points()["mbuild.plugins"]

available_methods = []
for entry_point in iter_entry_points(group="mbuild.plugins", name=None):
for entry_point in entry_points:
setattr(recipes, entry_point.name, entry_point.load())
8 changes: 4 additions & 4 deletions mbuild/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@
##############################################################################
"""
import importlib
import importlib.resources as resources
import inspect
import os
import sys
import textwrap
import warnings
from unittest import SkipTest

from pkg_resources import resource_filename


class DelayImportError(ImportError, SkipTest):
"""Error to allow better import handling."""
Expand Down Expand Up @@ -396,10 +395,11 @@ def get_fn(name):
name : str
Name of the file to load (with respect to the reference/ folder).
"""
fn = resource_filename("mbuild", os.path.join("utils", "reference", name))
fn = resources.files("mbuild").joinpath("utils", "reference", name)
# fn = resource_filename("mbuild", os.path.join("utils", "reference", name))
if not os.path.exists(fn):
raise IOError("Sorry! {} does not exists.".format(fn))
return fn
return str(fn)


def run_from_ipython():
Expand Down

0 comments on commit b4d2082

Please sign in to comment.