The plone.api is an elegant and simple API, built for humans wishing to develop with Plone. It comes with cookbook-like documentation with step-by-step instructions for doing common development tasks in Plone. Recipes try to assume the user does not have extensive knowledge about Plone internals. The talk will be about the philosophy and rationale behind it, what it offers and how to use it.
Since recently plone.api's code conventions and style guide have been adopted by the Framework Team as the Plone Core conventions. We'll go through these recommendations and discuss why they are there and why you should start using them in your own code also.
Finally, we'll walk through some bits and pieces of plone.api's internal code, to give you the idea of how modern Plone code should be organized and formatted, as an example of coding conventions mentioned above.
19. plone.api
• Started at Plone Konf Munich (2012)
• Alpha release at Belgian Beer Sprint
(2012)
• Beta release at Plone Conference in
Arnhem (2013)
• RC at Wine Sprint Munich (2013)
• 1.0 this week?
petek, 04. oktober 13
38. Import and Usage style
from plone import api
portal = api.portal.get()
user = api.user.create(username='bob')
api.content.move(
source=portal['blog'],
id='old-blog',
)
petek, 04. oktober 13
49. The Style Guide
• PEP 8
• PEP 257
• Rope project
• Google Style Guide
• Pylons Coding Style
• Tim Pope on Git commit messages
petek, 04. oktober 13
50. Line Length
• 80 chars
• # noqa if you need to break it
• configure your editor!
petek, 04. oktober 13
51. Breaking Lines
• 1. Break into next line with one
additional indent block
petek, 04. oktober 13
52. Breaking Lines
• 2. If this still doesn’t fit the 80-char
limit, break into multiple lines
petek, 04. oktober 13
73. Post-Conference sprint
• Implement remaining plone.api methods
• Get the test coverage even higher!
• Native speakers’ love to our docs
• Let’s get 1.0 release out there!
petek, 04. oktober 13
74. Open Tasks
• Deprecate plone.api on RTD
• Sphinx warnings should break the build
• plone.recipe.codeanalysis
• Coveralls.io
• Various bugs
• Proof-reading documentation
petek, 04. oktober 13
75. Open Tasks
• Changelog decision:
• CHANGES.rst or docs/CHANGES.rst
• “CHANGELOG” or “Changelog” or
“CHANGES” or “Changes” for heading
petek, 04. oktober 13
76. Open Tasks
• Permission checks decision:
• apply them?
• go around them?
• let the user decide with “strict=True”?
petek, 04. oktober 13
77. Open Tasks
• THE BIG ONE: usage scope
• use in core? performance issues ...
• use in add-ons? might creep into core
• only allow usage in integration code?
petek, 04. oktober 13
78. Thanks!
&
See you at the sprint
http://github.com/plone/plone.api
petek, 04. oktober 13