Skip to content

Doc: Improve examples with use cases #258

Open
@tomschr

Description

@tomschr

Situation

Thanks for this wonderful project! 👍 I'm slowly understanding it. 😉

Maybe others has the same difficulties than I. Although I really appreciate the examples, it was still a bit hard to follow. IMHO, the current approach has a gap between "A complete example" and "More real world examples".

It misses one use case which is needed most: having a bunch of plugin files in a specific directory and how to structure and use them with pluggy. I think, this is quite common and it should be covered.

Additionally, it would be helpful to share some "best practices". For example, how to structure and where to place specification and implementation.

Proposal

So my proposal would be to add a new section to fill this gap. Depending on whether you like this approach, we could go a little bit further. So here is a more ambitious change.

IMHO, I would propose the following structure:

  • Use Cases
    • Creating a Simple Example
      That would be basically the content from the section "A toy example". Basically, it adds specification and implementation in one file.
    • Separating Specification and Implementation in Different Files
      That would be the content from "A complete example".
    • Discovering Plugins in Directories
      => That would be the new one
    • More real world examples

As you can see, the difficulty of the examples grow from easy to difficult.

Additionally, I would suggest:

  • add a small paragraph when the respective example is most beneficial. For example, if you need to load the plugins dynamically, you would probably not use the simplest example.
  • give recommendations how to structure your code and where to place specification and implementation. I think, this is not always clear from the text.

I would be happy to add a first draft if you consider this issue to be useful. 😉

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions