Skip to content

New get-deps command: infer PyPI dependencies from mkdocs.yml#3205

Merged
oprypin merged 6 commits intomasterfrom
getdeps
Jun 9, 2023
Merged

New get-deps command: infer PyPI dependencies from mkdocs.yml#3205
oprypin merged 6 commits intomasterfrom
getdeps

Conversation

@oprypin
Copy link
Copy Markdown

@oprypin oprypin commented May 1, 2023

The user story is that the following command should let you "just build" any MkDocs site:

pip install $(mkdocs get-deps) && mkdocs build

This cross-references 2 files:

  • mkdocs.yml - theme, plugins, markdown_extensions
  • projects.yaml - a registry of all popular MkDocs-related projects and which entry points they provide - downloaded on the fly

-and prints the names of Python packages from PyPI that need to be installed to build the current MkDocs project


Thanks @pawamoy for inspiration and starting https://github.com/pawamoy/best-of-mkdocs

The user story is that the following command should let you "just build" any MkDocs site:

    pip install $(mkdocs get-deps) && mkdocs build

This cross-references 2 files:

* mkdocs.yml - `theme`, `plugins`, `markdown_extensions`
* projects.yaml - a registry of all popular MkDocs-related projects and which entry points they provide - downloaded on the fly

-and prints the names of Python packages from PyPI that need to be installed to build the current MkDocs project
@pawamoy
Copy link
Copy Markdown
Contributor

pawamoy commented May 1, 2023

Thank you @oprypin, that's a great addition!

Copy link
Copy Markdown
Contributor

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing n in "dependencies" (first commit summary)

"""Get names of plugins/extensions from the config - in either a list of dicts or a dict."""

def dig(cfg, keys: str):
"""Receives a string such 'foo.bar' and returns `cfg['foo']['bar']`, or `NotFound`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Receives a string such 'foo.bar' and returns `cfg['foo']['bar']`, or `NotFound`.
"""Receives a string such as 'foo.bar' and returns `cfg['foo']['bar']`, or `NotFound`.

@oprypin

This comment was marked as abuse.

@pawamoy
Copy link
Copy Markdown
Contributor

pawamoy commented Jun 6, 2023

Let plugins declare their own optional dependencies
This is inferred from particular config keys
The current known plugin in need of this is mkdocstrings (handlers)

It means I can add an extra_dependencies key for mkdocstrings in the catalog, listing my extra/optional deps?

@oprypin

This comment was marked as abuse.

@pawamoy
Copy link
Copy Markdown
Contributor

pawamoy commented Jun 6, 2023

Nice! No no, just asking.

What do the keys mean in:

  extra_dependencies:
    plugins.mkdocstrings.handlers.crystal: mkdocstrings-crystal
    plugins.mkdocstrings.handlers.python: mkdocstrings-python

plugins to differentiate from... themes or extensions I suppose? The rest (mkdocstrings.handlers.python) is arbitrary?

@pawamoy
Copy link
Copy Markdown
Contributor

pawamoy commented Jun 6, 2023

Ah, I think I got it, it's the keys in mkdocs.yml 👍

Oleh Prypin added 3 commits June 7, 2023 01:06
This is inferred from particular config keys

The current known plugin in need of this is mkdocstrings (handlers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants