Page MenuHomePhabricator

Please add `composer/installers` to requirements of Extension:ExternalData
Closed, ResolvedPublicFeature

Description

Extension:ExternalData features a name attribute in composer.json. Therefore it should probably be installable by composer. Unfortunately it is lacking the required composer/installers dependency.

See https://www.mediawiki.org/wiki/Composer/For_extensions

This ticket is meant to discuss https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ExternalData/+/779035

Event Timeline

External Data is not published at Packagist anyway.

Change 779752 had a related patch set uploaded (by Robert Vogel; author: Robert Vogel):

[mediawiki/extensions/ExternalData@master] Allow installation via `composer`

https://gerrit.wikimedia.org/r/779752

Change 779752 merged by jenkins-bot:

[mediawiki/extensions/ExternalData@master] Allow installation via `composer`

https://gerrit.wikimedia.org/r/779752

Osnard claimed this task.

Thanks for merging!

If Composer for this extension is sorted out, perhaps something can be done about T259743, so that manual composer require mongodb/mongodb is no longer necessary to access MongoDB.

@Osnard - I know it's strange to follow up on a patch so much later, but: is the "composer/installers" line really necessary in composer.json? It looks like most extensions' composer.json file lacks such a line - even Semantic Drilldown, which I assume is meant to be installed via Composer: https://github.com/SemanticMediaWiki/SemanticDrilldown/blob/master/composer.json

Well, without composer/installers, composer will install this package into $IP/vendor/ rather than into $IP/extensions/. SemanticDrilldown has a hard dependency to SemanticMediaWiki, which again requires composer/installers [1]. If just one of the extensions you require also requires composer/installers you are good. But as ExternalData is meant to be used standalone, I believe it should have this requirement on its own.

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/4.1.1/composer.json#L47

I did a quick grep trough the composer.json files of various extensions (that are not maintained by Hallo Welt). The files I have may be slightly outdated though. Here is a list of extensions that have composer/installersin their composer.json:

./mediawiki-extensions-AdminLinks/master/composer.json
./mediawiki-extensions-ApprovedRevs/master/composer.json
./mediawiki-extensions-ArticleFeedbackv5/master/composer.json
./mediawiki-extensions-Auth_remoteuser/master/composer.json
./mediawiki-extensions-Babel/master/composer.json
./mediawiki-extensions-ChangeUserPasswords/master/composer.json
./mediawiki-extensions-cldr/master/composer.json
./mediawiki-extensions-CleanChanges/master/composer.json
./mediawiki-extensions-Collection/master/composer.json
./mediawiki-extensions-ConfigManager/master/composer.json
./mediawiki-extensions-ContentTranslation/master/composer.json
./mediawiki-extensions-DataTransfer/master/composer.json
./mediawiki-extensions-GoogleGeocode/master/composer.json
./mediawiki-extensions-GPGMail/master/composer.json
./mediawiki-extensions-GraphViz/master/composer.json
./mediawiki-extensions-I18nTags/master/composer.json
./mediawiki-extensions-ImageMap/master/composer.json
./mediawiki-extensions-InterwikiSorting/master/composer.json
./mediawiki-extensions-InviteSignup/master/composer.json
./mediawiki-extensions-Lingo/master/composer.json
./mediawiki-extensions-LiquidThreads/master/composer.json
./mediawiki-extensions-MetaMaster/master/composer.json
./mediawiki-extensions-MixedNamespaceSearchSuggestions/master/composer.json
./mediawiki-extensions-MultiLanguageManager/master/composer.json
./mediawiki-extensions-NativeSvgHandler/master/composer.json
./mediawiki-extensions-NotesLink/master/composer.json
./mediawiki-extensions-NumerAlpha/master/composer.json
./mediawiki-extensions-OAuthAuthentication/master/composer.json
./mediawiki-extensions-OpenIDConnect/master/composer.json
./mediawiki-extensions-PageForms/master/composer.json
./mediawiki-extensions-PipeEscape/master/composer.json
./mediawiki-extensions-PreferencesList/master/composer.json
./mediawiki-extensions-ProofreadPage/master/composer.json
./mediawiki-extensions-S5SlideShow/master/composer.json
./mediawiki-extensions-SemanticSifter/master/composer.json
./mediawiki-extensions-Sentry/master/composer.json
./mediawiki-extensions-SideBarMenu/master/composer.json
./mediawiki-extensions-TEI/master/composer.json
./mediawiki-extensions-TestLanguageNameGrammar/master/composer.json
./mediawiki-extensions-Translate/master/composer.json
./mediawiki-extensions-UniversalLanguageSelector/master/composer.json
./mediawiki-extensions-UserFunctions/master/composer.json
./mediawiki-extensions-UserOptionStats/master/composer.json
./mediawiki-extensions-Variables/master/composer.json
./mediawiki-extensions-VEForAll/master/composer.json
./mediawiki-extensions-WhoIsWatching/master/composer.json
./mediawiki-extensions-WikibaseCirrusSearch/master/composer.json
./mediawiki-extensions-WikibaseLexemeCirrusSearch/master/composer.json
./mediawiki-extensions-WikibaseStatementUpdater/master/composer.json
./mediawiki-extensions-WikiSEO/master/composer.json
./mediawiki-skins-WikimediaApiPortal/master/composer.json

Thanks for the information - that's very interesting. I had wondered about how Composer could get the code into the extensions/ directory.

Given that, I am surprised at the relatively small number of extensions (and skins?) that contain this line, i.e. are actually installable via Composer. I know your list is far from comprehensive, but still I'm pretty sure that the overall number is quite a bit lower than 50%. Even major extensions like ParserFunctions, VisualEditor and Scribunto lack the line - which I guess means that, until now, their composer.json file has been useless. (?)

One big issue with this line is that it's not clear what the Composer version number should be set to. The "composer.json best practices" page says it should be set to ">= 1.0.1", but links to an example where it's set to "^2|^1.0.1". You set External Data's value to "~2.1", but according to bug T340818 (which caused this whole discussion), that conflicts with Page Forms' value, which is "1.*,>=1.0.1". Is there a single value that will work for all extensions? (And, ideally, will keep working as Composer versions increase?)

Most Wikimedia extensions do not feature this requirement. Wikimedia Foundation uses composer only for CI purposes. They intentionally do not make the composer.json file packagist compatible., as they do not support composer as a installation method. At BlueSpice we have adopted it and all our extensions (even the not BlueSpice-prefixed ones) support installation by composer.

You can set "composer/installers": "~1.0|~2". It should be the most compatible thing.

Thanks again - all that information is helpful. (I sort of knew that composer.json was also used for CI, but wasn't sure about it.)

That value looks good - I might update the "composer.json best practices" page with it, not to mention a bunch of extensions. Would it make sense to set this value for External Data as well?

Actually, maybe 1 - 2 is the easiest-to-understand value, and it seems to be equivalent, according to this. What do you think?

I just changed the value in External Data to include Composer v. 1 as well, here: https://gerrit.wikimedia.org/r/942479