Skip Menu |

This queue is for tickets about the constant-defer CPAN distribution.

Report information
The Basics
Id: 102107
Status: resolved
Priority: 0/
Queue: constant-defer

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 5
Fixed in: (no value)



Subject: Suggestion: use develop.requires and test.recommends/suggests instead of optional features

Due to "develop" phase and "recommendations" being well standardised in modern toolchains, you could make the intent and use of the optional dependencies much cleaner from a consumer standpoint.

 

My suggestion would be to migrate current prereqs as follows:

 

`Test` should move from PREREQ_PM to TEST_REQUIRES

maximum_tests should move to metamerge as `prereqs.test.suggests` ( Suggests, because CPAN.pm presently always pulls recommends so its effectively making them requires :( )

 

maximum_devel should move to `prereqs.develop.requires`.

 

This will mean no need for option prompting, and will instead simply be selected automatically by your CPAN installer configuration.

If you also put meta-spec version => 2 in META MERGE, then it will output a nice META 2.0 META.json without merging test requirements into `build` requirements.

 

You may also want to add a compat shim at the bottom of some kind giving legacy compat options.

 

If you have a public repository available for this module I'd gladly attempt patching it myself.

 

( I was forwarded here by a Gentoo staffer who had a little trouble understanding how to package your module and I figured it could be made simpler and more standardised =) )

 

You have this sort of pattern quite frequently in a lot of your modules of also using the more traditional approach of declaring test requirements as "prereqs", which hampers anyone who wants to do a --notest install slightly.

I understand its probably a big ask to ask you to change all your modules over night to a more modern style, but if I can help you modernise it without too much effort or annoyance on your behalf I'm glad to help =).

 

CC: Kent Fredric <KENTNL [...] cpan.org>
Subject: Re: [rt.cpan.org #102107] Suggestion: use develop.requires and test.recommends/suggests instead of optional features
Date: Sat, 14 Feb 2015 12:26:28 +1100
To: bug-constant-defer [...] rt.cpan.org
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
"Kent Fredric via RT" <bug-constant-defer@rt.cpan.org> writes: Show quoted text
> > `Test` should move from PREREQ_PM to TEST_REQUIRES
Also in the core anyway so I suppose either unnecessary or does not harm too ... Show quoted text
> maximum_tests should move to metamerge as `prereqs.test.suggests`
Hmm. I don't think I knew that bit. Show quoted text
> maximum_devel should move to `prereqs.develop.requires`.
I've dropped that everywhere as not worth bothering, but left it to "whenever the next version". I'll upload sooner if actively annoying. Most of what I did have were probably "develop.suggests", if there is such a level. Show quoted text
> You may also want to add a compat shim at the bottom of some kind giving legacy > compat options.
I worried TEST_REQUIRES would break under earlier Makemaker by missing the test requirements. I suppose at worst it only breaks "make test" so can still install, or if I'm just using Test.pm then no problem. Show quoted text
> You have this sort of pattern quite frequently in a lot of your modules of also > using the more traditional approach of declaring test requirements as > "prereqs", which hampers anyone who wants to do a --notest install slightly.
Mostly I pre-date that separation (in Makemaker). I usually don't have anything very exotic as test requires so shouldn't be too much extra dragged in.

On 2015-02-14 14:33:46, user42_kevin@yahoo.com.au wrote:

> I worried TEST_REQUIRES would break under earlier Makemaker by missing
> the test requirements. I suppose at worst it only breaks "make test"
> so
> can still install, or if I'm just using Test.pm then no problem.

It is a legitimate concern =)



But that's why Dzil generated dists inject this stub:

https://metacpan.org/source/DAGOLDEN/Class-Tiny-1.001/Makefile.PL#L44

Its probably not an issue with Test.pm, but I figured the general principle could be useful in other dists =)


Its not so useful for CPAN I guess, but having the right information in the right place makes downstream packagers life much simpler as we communicate dependencies into our packager, as that helps us identify and address CVE issues in dependencies:

 

Eg: imagine Test::More version Y has a CVE in it, and version Y is shipped in a version of Perl.

As long as something explicitly depends on Test::More in vendor packages, then when we ship the non-CVE vulnerable version of Test::More, anything that has that as a dependency will automagically cause an upgrade.  ( Keeping in mind that some downstreams like Gentoo and Arch allow users to run tests on their own machines )

Its a bit of a stretch using Test::More as an example of where this is relevant, and a much more valid case indeed existed lately for Data::Dumper, which few things used, but if anything in their tree uses it, the update is indeed very much wanted.

Though I understand entirely if you don't see much benefit in it for CPAN =).
 

CC: Kent Fredric <KENTNL [...] cpan.org>
Subject: Re: [rt.cpan.org #102107] Suggestion: use develop.requires and test.recommends/suggests instead of optional features
Date: Mon, 16 Feb 2015 12:03:59 +1100
To: bug-constant-defer [...] rt.cpan.org
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
"Kent Fredric via RT" <bug-constant-defer@rt.cpan.org> writes: Show quoted text
Hmm. Can probably be a touch simpler for me (TEST_REQUIRES and PREREQ_PM are disjoint). Show quoted text
> communicate dependencies
Yes, this is good. You probably could like Makemaker itself to ease forward+backward compatibility in author's Makefile.PL. I suppose a version check for which field is not too bad. I'll see if I can do something clean enough for my Test::More bits. Show quoted text
> Data::Dumper
I may have that used but undeclared in some tests (mainly as diagnostics but probably executed even for a successful test).
CC: Kent Fredric <KENTNL [...] cpan.org>
Subject: Re: [rt.cpan.org #102107] Suggestion: use develop.requires and test.recommends/suggests instead of optional features
Date: Fri, 20 Feb 2015 19:03:21 +1100
To: bug-constant-defer [...] rt.cpan.org
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
I uploaded a version 6 which should be better.

Thanks =).

And if you're concerned about legacy EUMM versions, https://metacpan.org/release/App-EUMM-Upgrade may be of use to you.

I don't think I'll use that auto-upgrade but will update each dist on each next release (unless anyone knows something going badly wrong sooner).