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

Expand plugins documentation to multiple pages #687

Closed
simonw opened this issue Feb 28, 2020 · 11 comments
Closed

Expand plugins documentation to multiple pages #687

simonw opened this issue Feb 28, 2020 · 11 comments

Comments

@simonw
Copy link
Owner

simonw commented Feb 28, 2020

I think the plugins docs need to extend beyond a single page now. I want to add a whole section on writing tests for plugins, showing how httpx can be used as seen in simonw/datasette-atom#3 and suchlike.

@simonw
Copy link
Owner Author

simonw commented Feb 28, 2020

Current plugin docs: https://datasette.readthedocs.io/en/0.37/plugins.html

@simonw
Copy link
Owner Author

simonw commented Feb 28, 2020

Suggested pages:

  • plugins/tutorial.html
  • plugins/hooks.html
  • plugins/testing.html
  • plugins/packaging.html

@simonw simonw changed the title Documentation on how to use httpx to write tests for plugins Expand plugins page to be multiple pages Feb 29, 2020
@simonw
Copy link
Owner Author

simonw commented Feb 29, 2020

The tutorial should start by taking about development environments - how to get a new fresh copy of Datasette that you can start hacking plugins for, in a fresh virtual environment.

It should then explain the --plugins-dir mechanism, and show how to use it to create a simple plugin that adds a custom SQL function.

Does --reload work against plugins in the plugins/ directory? It should.

Then it should demonstrate a more complex plugin that uses the datasette argument to render a template.

It should promote the next page which lists the plugin hooks.

The hooks page should include links next to each hook to examples of plugins that use them.

The packaging page can explain setup.py for distributing packages (let's not bother explaining single modules) and also needs to show how to bundle package data such as templates.

It should also show how to use pip install -e .[test] for development, and mention that this works with --reload.

@simonw simonw changed the title Expand plugins page to be multiple pages Expand plugins page to be multiple pages, add tutorial Feb 29, 2020
@simonw simonw changed the title Expand plugins page to be multiple pages, add tutorial Expand plugins documentation to multiple pages, add tutorial Feb 29, 2020
@simonw
Copy link
Owner Author

simonw commented Feb 29, 2020

Eventually I can also document what to do if your plugin needs to include its own CLI tool. I'm goong it show how to ship a CLI tool with the same name as the plugin using Click and setup.py.

@simonw
Copy link
Owner Author

simonw commented Jun 20, 2020

The tutorial can start by showing how to use the new cookiecutter template from #642.

@simonw
Copy link
Owner Author

simonw commented Jun 20, 2020

I think I want the "Plugin hooks" page to be top-level, parallel to "Plugins" and "Internals for Plugins". It's the page of documentation refer to most often so I don't want to have to click down a hierarchy from the side navigation to find it.

@simonw simonw added this to the Datasette 0.45 milestone Jun 20, 2020
@simonw
Copy link
Owner Author

simonw commented Jun 21, 2020

So the new plan is NOT to have a plugins/ folder, but instead have several top-level pages:

  • Plugins (exists)
  • Writing plugins
  • Plugin hooks
  • Testing plugins
  • Internals for plugins (exists)

@simonw
Copy link
Owner Author

simonw commented Jun 21, 2020

I'm going to break out the plugin hooks first in a single commit to make for a cleaner commit history (since that way git can hopefully detect that the content moved).

@simonw
Copy link
Owner Author

simonw commented Jun 22, 2020

Maybe add this to the plugins.rst page near the top:


.. toctree::
   :caption: See also
   :maxdepth: 1

   plugin_hooks
   internals

@simonw simonw changed the title Expand plugins documentation to multiple pages, add tutorial Expand plugins documentation to multiple pages Jun 22, 2020
@simonw
Copy link
Owner Author

simonw commented Jun 22, 2020

Now split into four pages:

Still need to add the "Testing plugins" page, then I can close this issue.

I should also do #855, documenting the new datasette-plugin cookiecutter template. That can go in writing_plugins.rst.

@simonw
Copy link
Owner Author

simonw commented Jun 22, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant