-
-
Notifications
You must be signed in to change notification settings - Fork 146
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
best practices for GitHub pages? #55
Comments
What's wrong with invoking |
pdoc CLI usage allows for more than one module/package specified: pdoc --html mypackage1 mypackage2 ...
|
Then you'd have another doorway page (like the
No. Specifying multiple projects is the mechanism by which you make pdoc aware of, and thereby link to, symbols in disjunct packages. The problem with 1. is that subsequent runs are not deterministically idempotent. $ pdoc --html -o docs project1
# Creates a different filesystem hierarchy.
# Doesn't reliably warn for overwriting project1.
# Leaves docs/index.html to remain stale and misleading.
$ pdoc --html -o docs project1 project2 This idea also won't work because it would break existing CI / deployments. |
I'm not convinced that running Let's maybe leave this open for a while and see how many votes it accrues. |
Hey! I'm interested in All that said, I totally agree that at least documenting a typical workflow for GitHub pages would be a nice extra. |
FWIW, I have a DoIt script in Python that does some filesystem manipulation to ouput documentation to gh-pages. Would love feedback if there is a better to do this Process:
Directory Structure:
Code: See Result: https://kyleking.me/dash_charts/ |
I have based the documentation for my project on the Cayman theme, but modified it quite a bit to fit my needs. The API reference (which is still very much work in progress) is generated by pdoc and checked in statically. To integrate it with Cayman, I modified the template to include some front matter. This also allows me to change permalink to get rid of the Generating the output is done with a small python hack I did, which also contains a "verify" action that checks if the reference is up-to-date with code and fails otherwise. The "verify" step is run by tox (and in turn GitHub Actions), so it's not possible to merge anything if the documentation is "old". Some links for inspiration:
Not in any way a perfect solution, but works pretty good for my needs. Maybe it serves as inspiration for someone else. 🍰 |
I have a simple redirect at <meta http-equiv="refresh" content="0; url=./{{project-name}}/" /> where one should obviously replace A more performant line suggested by kernc: <link rel="preload prerender" as="document" href="./{{project-name}}/"> |
Hi there, just to say I face the same problem. I guess I will be using @rirze 's proposal. |
Still maybe a new switch for direct output dir can work? Like |
@rirze's solution serves my needs. Here is my current Python package workflow with cookiecutter, pdoc3 and GitHub. Setup package with cookiecutter
Setup documentation with pdoc3
Setup GitHub repo
|
Why not save the ease of use for skipping
entirely? Many users may have tried sphinx, the workflow there is very clean:
In pdoc there is historically a hidden and a bit unexpected behaviour that output dir is not a direct link, but parent directory. What I'm suggesting is too look at the angle of ease of use and predictability of behaviour. My suggestion in adding a new switch that eliminates hidden behavior, the existing switch is left as is, because it is useful for generating several packages' documentation outside of Github Pages usecase. The intended workflow can be:
|
Update: for pdoc we do not even need
Looks like appealing feature to me, advantageous to "there is a best practice advice with several steps involved". |
Because the idea is that you can have multiple modules within a project. It would be great if you could have a simple How do you handle multiple modules? How do you handle projects with a single module? What happens if you switch from single module to multiple modules? If you have answers to these, then, please let us know and even maybe contribute a patch. Until then, I think more manual specification using the redirect is better because there is less under-hood-logic for where the entry point for your docs should be. Plus, setting the redirect is at best a one-time step, at worst, an uncommon edit. It does not affect workflow, only initial setup and possibly major refactors. |
Not sure I understand a use case case with multiple modules for a project, can you point to examples? One piece of documentation is for one package, right? |
What I'm tring to document is:
pdoc will create documentation in |
I'm no expert at Python packaging, but I'll try to explain what I can: A project can consist of multiple packages. The bare minimum that qualifies a package in a project is that a package resides in a top level directory in the project/source root with a This is supported in Python packaging, notably when specifying I cannot confirm this, but I think it is standard practice to not do this, as it lead to confusion and so most authors isolate projects to one module. I could not find any popular packages that bundle multiple modules together. Using your example, a valid Python project can look like this:
I understand your use case only uses one package (as do all my packages as well), but Hopefully this clarifies the topic. |
One may want to specify multiple modules for various reasons and use cases: $ pdoc $(find -name \*.py -and -not -path \*exclude\* | filter however) Note, HTML documents from a single command-line run are all interlinked. Pdoc can also be used as a browsable cross-referenced on-the-fly external docs generator: % pdoc3 -o. html urllib re
% tree
.
├── html
│ ├── entities.md
│ ├── index.md
│ └── parser.md
├── re.md
└── urllib
├── error.md
├── index.md
├── parse.md
├── request.md
├── response.md
└── robotparser.md
2 directories, 10 files |
You can create and commit the meta-refresh file as @rirze recommends. You need to commit it only once. If you worry about redirect delay/performance, might add in there another: <link rel="preload prerender" as="document" href="./{{project-name}}/"> If you worry about result URL prettiness, it's just one
With literally limitless workarounds available, I honestly don't think this warrants complicating logic or a new CLI switch. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
You could simply setup a redirect |
Just for n00bs like me, this looks like a file called <!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=./{{project-name}}/" />
</head>
</html> |
GitHub pages are a common way to host documentation for sites. They require one of the following to host in source code:
Right now I'm using master branch /docs for pygdbmi, and I have what I would assume is a very common project structure, yet my workflow has a little hack in it. I generate my docs with the following make recipe:
Is there a way to generate docs directly to the --output-dir? By namespacing it with the package name, it breaks it for GitHub pages.
The text was updated successfully, but these errors were encountered: