Skip to content

Commit

Permalink
Let mkdocs float
Browse files Browse the repository at this point in the history
  • Loading branch information
prescod committed Apr 6, 2024
1 parent c148699 commit b4e6211
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 13 deletions.
File renamed without changes.
5 changes: 3 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
site_name: Snowfakery documentation
site_url: ""
use_directory_urls: False
theme: readthedocs
custom_dir: custom_theme
theme:
name: readthedocs
custom_dir: custom_theme
repo_url: https://github.com/SFDO-Tooling/Snowfakery/
nav:
- index.md
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ black
coverage
coveralls
diff-cover
mkdocs<1.3.0 # need to change Snowfakery monkey-patching before upgrade
mkdocs
mkdocs-exclude-search
pre-commit
pytest
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ markupsafe==2.1.5
# jinja2
mergedeep==1.3.4
# via mkdocs
mkdocs==1.2.4
mkdocs==1.5.3
# via
# -r requirements/dev.in
# mkdocs-exclude-search
Expand Down
6 changes: 2 additions & 4 deletions snowfakery/tools/mkdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
from unittest.mock import patch

from mkdocs.plugins import BasePlugin
import mkdocs
from mkdocs.config import config_options


class Plugin(BasePlugin):
config_scheme = (
("build_locales", mkdocs.config.config_options.Type(bool, default=False)), # type: ignore
)
config_scheme = (("build_locales", config_options.Type(bool, default=False)),)

def on_config(self, config):
"""Look for and load main_mkdocs_plugin in tools/faker_docs_utils/mkdocs_plugins.py
Expand Down
2 changes: 1 addition & 1 deletion tools/faker_docs_utils/faker_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def generate_markdown_for_all_locales(path: Path, locales=None):
generate_markdown_for_fakers(f, locale)


def generate_locales_index(path: Path, locales_list: T.List[str]):
def generate_locales_index(path: T.Union[Path,str], locales_list: T.List[str]):
"Generate markdown index including listed locales. None means all locales"
locales_list = locales_list or AVAILABLE_LOCALES
with Path(path).open("w") as outfile:
Expand Down
4 changes: 0 additions & 4 deletions tools/faker_docs_utils/mkdocs_plugins/main_mkdocs_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ def new_warning(self, *args, **kwargs):
logger_patch = patch("logging.Logger.warning", new=new_warning)

# speed up a critical function
#
# Disabled due to Faker refactoring. After release can look into
# whether it is still needed.
#
lru_patch = patch(
"faker.factory.Factory._find_provider_class",
lru_cache(maxsize=10_000)(Factory._find_provider_class),
Expand Down

0 comments on commit b4e6211

Please sign in to comment.