Skip to content
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

Validate examples used in documentation #115

Merged
merged 14 commits into from
Mar 19, 2021
Merged

Conversation

fhightower
Copy link
Collaborator

@fhightower fhightower commented Mar 17, 2021

To fix #85, we should:

  • consolidate examples
  • reference examples from .md doc files
  • create a test script to validate examples are working properly

@fhightower fhightower self-assigned this Mar 17, 2021
@fhightower fhightower added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 17, 2021
@codecov
Copy link

codecov bot commented Mar 18, 2021

Codecov Report

Merging #115 (97a5ae9) into main (d201c35) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #115   +/-   ##
=======================================
  Coverage   96.72%   96.72%           
=======================================
  Files           6        6           
  Lines         336      336           
  Branches       39       39           
=======================================
  Hits          325      325           
  Misses          9        9           
  Partials        2        2           

@fhightower fhightower marked this pull request as ready for review March 18, 2021 14:54
@@ -62,7 +62,7 @@ coverage rather than decreasing it.

We use [pytest][pytest-docs] as our testing framework.

#### Stages
### Stages
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Something seemed odd with the level of the headings in this document (on this line and this one). I've made a best-guess at what they should be.

docs/getting-started.md Outdated Show resolved Hide resolved
joaufi
joaufi previously approved these changes Mar 18, 2021
Copy link
Collaborator

@joaufi joaufi left a comment

Choose a reason for hiding this comment

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

This looks great! :D LGTM. As long as the examples template into the docs correctly (which I'll try to run myself as well shortly) then ✨ 🚀

docs/getting-started.md Outdated Show resolved Hide resolved
@joaufi joaufi dismissed their stale review March 18, 2021 19:00

The example references don't seem to work when mkdocs templated- maybe need a plugin?

@joaufi
Copy link
Collaborator

joaufi commented Mar 18, 2021

So I was able to run the mkdocs plugin on the feature branch for this PR with:

docker-compose run --rm --service-ports mkdocs

Edit:
The following command also works to access the mkdocs local site from my local:

docker-compose up mkdocs

I accessed it locally at 0.0.0.0:8000; it doesn't look like the way the examples were referenced was templated in correctly:

image

I wonder if Pydantic uses a plugin to facilitate that linking? I was able to find this Pydantic Issue (it gets a bit salty / heated 😆 ) but unfortunately wasn't able to find any reference to how they accomplish the linking in their docs. 😿

@fhightower
Copy link
Collaborator Author

Thanks, @joaufi ! docker-compose run --rm --service-ports mkdocs works! And thanks for doing some digging into the issue; I'll take a look and get the code snippets rendering properly.

@fhightower
Copy link
Collaborator Author

fhightower commented Mar 18, 2021

Ok, I added the necessary, missing extension (markdown-include) and this is working now. @joaufi : Do you mind taking one last look?

Copy link
Owner

@plannigan plannigan left a comment

Choose a reason for hiding this comment

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

One minor comment

docs/development-guide.md Outdated Show resolved Hide resolved
@fhightower fhightower merged commit 0b2e0b6 into main Mar 19, 2021
@fhightower fhightower deleted the 85-validate-doc-snippets branch March 19, 2021 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store all code examples in documentation as .py files that are evaluated and templated into the docs
3 participants