API:Client code/Gold standard: Difference between revisions
m →==Easy to install ==: fixed code |
mNo edit summary |
||
| (16 intermediate revisions by 14 users not shown) | |||
| Line 18: | Line 18: | ||
<translate> |
<translate> |
||
==Easy to understand== <!--T:11--> |
==Easy to understand== <!--T:11--> |
||
</translate> |
</translate> |
||
| Line 45: | Line 44: | ||
* <translate><!--T:33--> [[<tvar name=1>Special:MyLanguage/API:Etiquette</tvar>|Courteous API usage]] is promoted through code samples and smart defaults</translate> |
* <translate><!--T:33--> [[<tvar name=1>Special:MyLanguage/API:Etiquette</tvar>|Courteous API usage]] is promoted through code samples and smart defaults</translate> |
||
** <translate><!--T:34--> gzip compression is used by default</translate> |
** <translate><!--T:34--> gzip compression is used by default</translate> |
||
** <translate><!--T:35--> Examples show how to create and use a meaningful user-agent header (as in [[<tvar name=1> |
** <translate><!--T:35--> Examples show how to create and use a meaningful user-agent header (as in [[<tvar name=1>wmf:Special:MyLanguage/Policy:User-Agent policy</tvar>|User-Agent policy]])</translate> |
||
** ''<translate><!--T:36--> Platinum standard: generates a unique user-agent string given name/email address/repository location</translate>'' |
** ''<translate><!--T:36--> Platinum standard: generates a unique user-agent string given name/email address/repository location</translate>'' |
||
** <translate><!--T:37--> Efficient usage of API calls</translate> |
** <translate><!--T:37--> Efficient usage of API calls</translate> |
||
| Line 63: | Line 62: | ||
* <translate><!--T:45--> Library maintainers are responsive and courteous, and foster a thoughtful and inclusive community of developers and users</translate> |
* <translate><!--T:45--> Library maintainers are responsive and courteous, and foster a thoughtful and inclusive community of developers and users</translate> |
||
* ''<translate><!--T:46--> Platinum standard: Project sets clear expectations for conduct<ref>See the [<tvar name=1>http://www.rust-lang.org/conduct.html</tvar> Rust language's conduct policy] for a good example.</ref><ref>See the [<tvar name=2>https://www.contributor-covenant.org/</tvar> Contributor Covenant] for another example, open sourced, adopted and deployed in a lot of projects.</ref> for spaces where project-related interactions occur (mailing list, IRC, repository, issue tracker). It should:</translate>'' |
* ''<translate><!--T:46--> Platinum standard: Project sets clear expectations for conduct<ref>See the [<tvar name=1>http://www.rust-lang.org/conduct.html</tvar> Rust language's conduct policy] for a good example.</ref><ref>See the [<tvar name=2>https://www.contributor-covenant.org/</tvar> Contributor Covenant] for another example, open sourced, adopted and deployed in a lot of projects.</ref> for spaces where project-related interactions occur (mailing list, IRC, repository, issue tracker). It should:</translate>'' |
||
** ''<translate><!--T:47--> State desired attitudes and |
** ''<translate><!--T:47--> State desired attitudes and behaviours</translate>'' |
||
** ''<translate><!--T:48--> Provide examples of unwelcome and harassing |
** ''<translate><!--T:48--> Provide examples of unwelcome and harassing behaviour</translate>'' |
||
** ''<translate><!--T:49--> Specify how these expectations will be enforced</translate>'' |
** ''<translate><!--T:49--> Specify how these expectations will be enforced</translate>'' |
||
* <translate><!--T:50--> Pull requests are either accepted or rejected with reason within 3 weeks</translate> (''<translate><!--T:51--> Platinum standard: 3 business days</translate>'') |
* <translate><!--T:50--> Pull requests are either accepted or rejected with reason within 3 weeks</translate> (''<translate><!--T:51--> Platinum standard: 3 business days</translate>'') |
||
| Line 75: | Line 74: | ||
==Notes== <!--T:56--> |
==Notes== <!--T:56--> |
||
</translate> |
</translate> |
||
<references/> |
<references/> |
||
Latest revision as of 08:10, 22 February 2026
The action API client libraries available on API:Client code enable developers to easily and intuitively interact with the MediaWiki API. The libraries currently listed vary widely in capabilities, maintenance status, and code/documentation quality. To make it easier for new users of the API to find a library that meets their needs, we're introducing a "gold standard" that will indicate particularly high-quality, currently-maintained libraries. We also hope that the standard will also help library developers decide how to focus their efforts so that the code they create can be easily used by expert and novice developers alike.
We believe that a good client library should be easy to install, easy to understand, easy to use, easy to debug, and easy to improve. As such, accessible documentation is as important as elegant code. Unless otherwise indicated, the items below belong to the "gold standard": challenging but within reach. The items marked "platinum standard" indicate that library developers and maintainers have gone above and beyond the "gold standard", resulting in an exceptional library.
Easy to install
[edit | edit source]- Installation instructions are correct and easy to find
- Library is packaged for installation through appropriate package library (PyPI, CPAN, npm, Maven, rubygems, etc.)
- Platinum standard: library is packaged for and made available through Linux distributions
Easy to understand
[edit | edit source]- Well designed: makes all intended API calls available with the intended level of abstraction with no redundancies
- Platinum standard: makes the Wikidata API available
- Well documented:
- Code is commented and readable
- Documentation is comprehensive, accurate, and easy to find
- Documentation specifies which MediaWiki versions the library is compatible with
- Deprecated functions are clearly marked as such
- Platinum standard: Documentation is understandable by a novice programmer
- Code uses idioms appropriate to the language the library is written in
Easy to use
[edit | edit source]- Has functioning, simple, and well-written code samples for common tasks
- Demonstrates queries
- Demonstrates edits
- Handles API complications or idiosyncrasies so the user doesn't have to:
- Login/logout
- Cookies
- Tokens
- Query continuations using the new "continue" and not "query-continue"
- Requests via https, including certificate validation
- Courteous API usage is promoted through code samples and smart defaults
- gzip compression is used by default
- Examples show how to create and use a meaningful user-agent header (as in User-Agent policy)
- Platinum standard: generates a unique user-agent string given name/email address/repository location
- Efficient usage of API calls
- Can be used with the most recent stable version of the language it is written in (e.g. Python 3 compatible)
Easy to debug
[edit | edit source]- Contains unit tests for the longest and most frequently modified functions in the library
- Platinum standard: Unit tests for many code paths exist and are maintained
- Terrible hacks/instances of extreme cleverness are clearly marked as such in comments
- Documentation links to the relevant section/subpage of the API documentation
Easy to improve
[edit | edit source]- Library maintainers are responsive and courteous, and foster a thoughtful and inclusive community of developers and users
- Platinum standard: Project sets clear expectations for conduct[1][2] for spaces where project-related interactions occur (mailing list, IRC, repository, issue tracker). It should:
- State desired attitudes and behaviours
- Provide examples of unwelcome and harassing behaviour
- Specify how these expectations will be enforced
- Pull requests are either accepted or rejected with reason within 3 weeks (Platinum standard: 3 business days)
- Issues/bugs are responded to in some manner within 3 weeks (Platinum standard: 3 business days) (but not necessarily fixed)
- The library is updated and a new version is released within 3 weeks (Platinum standard: 3 business days) when breaking changes are made to the API
- Platinum standard: library maintainers contact MediaWiki API maintainers with feedback on the API's design and function
- Library specifies the license it is released under
Notes
[edit | edit source]- ↑ See the Rust language's conduct policy for a good example.
- ↑ See the Contributor Covenant for another example, open sourced, adopted and deployed in a lot of projects.