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

Templated docstring should follow PEP257 conventions. #130

Closed
2 tasks
eirrgang opened this issue Jun 28, 2021 · 3 comments · Fixed by #131
Closed
2 tasks

Templated docstring should follow PEP257 conventions. #130

eirrgang opened this issue Jun 28, 2021 · 3 comments · Fixed by #131

Comments

@eirrgang
Copy link
Contributor

The templated docstring is not consistent with PEP257:

If this is intentional (such as for the workshop participant to correct during an exercise), maybe this could be clarified or made static instead of using the template.

Otherwise:

  • Put a blank line between the first and second line.
  • Use the first line for a concise description according to PEP257 and numpy docstring conventions that will look good when formatted with pydoc or help(). This could mean just removing the molecool\n first line.
@Lnaden
Copy link
Collaborator

Lnaden commented Jun 28, 2021

This isn't consistent, you are correct. However, there isn't really a good solution I've been able to think of.

The main problem here is the Cookiecutter has no idea what will be put in the module name or description, so we can't really make any predictive forecast of what should go where.

In theory, we can put the description as the succinct first line instead of just the module name. PEP 257 says that the first line should be able to fit on one line in its full rendered form. Given that this info is filled in at Cookiecutter creation, either manually or through simple text, its likely to be very short as the person is typing it into command line, but not assured to be short. Given this, I left it as just the module name and let the description occupy the longer block.

Under this assumption though, there should be a blank line between the two auto-populated things.

That said, implicit in all of the cookiecutter is the notion of the user replacing text which is auto filled in. For instance, I don't think anyone would want to ever keep the canvas function which is auto-populated, its just there as a placehodler to provide a functioning skeletal structure on completion. It may be worth changing the default lines which get filled in to include a blatant "REPLACE ME WITH X-Y-Z" information, but I'm hesitant to put something that aggressive into the output which might get missed for someone wanting to set up a project quickly.

@eirrgang
Copy link
Contributor Author

but I'm hesitant to put something that aggressive into the output which might get missed for someone wanting to set up a project quickly

Yes, in my experience, https://github.com/kassonlab/sample_restraint has resulted in people with repositories named sample_restraint and Python packages named myplugin. :-) I have been planning to replace it with a CookieCutter for a while now...

I would recommend making separate "short description" (required) and "long description" (optional) CookieCutter parameters (consistent with normal Python packaging metadata). Then you could use these for the first and third line.

A middle ground could be to add "short description of " to the beginning of the first line.

And the line break.

@eirrgang
Copy link
Contributor Author

I would recommend making separate "short description" (required) and "long description" (optional) CookieCutter parameters (consistent with normal Python packaging metadata). Then you could use these for the first and third line.

See PR #132

A middle ground could be to add "short description of " to the beginning of the first line.

See PR #131

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 a pull request may close this issue.

2 participants