Re: [Distutils] d2to1 setup.cfg schema

2015-03-31 Thread Robert Collins
On 31 March 2015 at 12:16, Erik Bray  wrote:
> On Mon, Mar 30, 2015 at 7:07 PM, Robert Collins
>  wrote:
>> On 31 March 2015 at 12:03, Erik Bray  wrote:
>>
>>> I haven't followed this whole discussion (I started to in the
>>> beginning, but haven't kept up), but I'm not really sure what's being
>>> said here.  d2to1 *does* support declaring setup-requires dependencies
>>> in setup.cfg, and those dependencies should be loaded before any hook
>>> scripts are used.  Everything in d2to1 is done via various hook
>>> points, and the hook functions can be either shipped with the package,
>>> or come from external requirements installed via setup-requires.  It
>>> works pretty well in most cases.
>>
>> Oh, it does!? I was looking through the source and couldn't figure it
>> out. What key is looked for for setup-requires? Also does it define a
>> schema for extra-requires?
>
> Yeah, sorry about that.  That's one of those things that was never
> actually supported in distutils2 by the time it went poof, and that I
> added later.
>
> You can use:
>
> [metadata]
> setup-requires-dist = foo
>
> So say, for example you have some package called "versionutils" that's
> used to generate the package's version number (by reading it from
> another file, tacking on VCS info, etc.)  You can use:
>
> [metadata]
> setup-requires-dist = versionutils
>
> [global]
> setup-hooks = versionutils.version_hook
>
> or something to that effect.  It will ensure versionutils is
> importable (this uses easy_install just like the normal setup_requires
> feature in setuptools; I would like to change this one day to instead
> use something like Daniel's setup-requires [1] trick).
> It will then, fairly early in the setup process, hand the package
> metadata over to versionutils.version_hook, and let it insert a
> version string.
>
> Erik
>
> [1] https://bitbucket.org/dholth/setup-requires

I'll add setup-requires-dist as an alias for setup-requires in the
declarative work I'm doing.

Did distutils2 support declarative extras?


-- 
Robert Collins 
Distinguished Technologist
HP Converged Cloud
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] d2to1 setup.cfg schema

2015-03-30 Thread Erik Bray
On Mon, Mar 30, 2015 at 7:07 PM, Robert Collins
 wrote:
> On 31 March 2015 at 12:03, Erik Bray  wrote:
>
>> I haven't followed this whole discussion (I started to in the
>> beginning, but haven't kept up), but I'm not really sure what's being
>> said here.  d2to1 *does* support declaring setup-requires dependencies
>> in setup.cfg, and those dependencies should be loaded before any hook
>> scripts are used.  Everything in d2to1 is done via various hook
>> points, and the hook functions can be either shipped with the package,
>> or come from external requirements installed via setup-requires.  It
>> works pretty well in most cases.
>
> Oh, it does!? I was looking through the source and couldn't figure it
> out. What key is looked for for setup-requires? Also does it define a
> schema for extra-requires?

Yeah, sorry about that.  That's one of those things that was never
actually supported in distutils2 by the time it went poof, and that I
added later.

You can use:

[metadata]
setup-requires-dist = foo

So say, for example you have some package called "versionutils" that's
used to generate the package's version number (by reading it from
another file, tacking on VCS info, etc.)  You can use:

[metadata]
setup-requires-dist = versionutils

[global]
setup-hooks = versionutils.version_hook

or something to that effect.  It will ensure versionutils is
importable (this uses easy_install just like the normal setup_requires
feature in setuptools; I would like to change this one day to instead
use something like Daniel's setup-requires [1] trick).
It will then, fairly early in the setup process, hand the package
metadata over to versionutils.version_hook, and let it insert a
version string.

Erik

[1] https://bitbucket.org/dholth/setup-requires
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] d2to1 setup.cfg schema

2015-03-30 Thread Robert Collins
On 31 March 2015 at 12:03, Erik Bray  wrote:

> I haven't followed this whole discussion (I started to in the
> beginning, but haven't kept up), but I'm not really sure what's being
> said here.  d2to1 *does* support declaring setup-requires dependencies
> in setup.cfg, and those dependencies should be loaded before any hook
> scripts are used.  Everything in d2to1 is done via various hook
> points, and the hook functions can be either shipped with the package,
> or come from external requirements installed via setup-requires.  It
> works pretty well in most cases.

Oh, it does!? I was looking through the source and couldn't figure it
out. What key is looked for for setup-requires? Also does it define a
schema for extra-requires?

-Rob

-- 
Robert Collins 
Distinguished Technologist
HP Converged Cloud
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] d2to1 setup.cfg schema

2015-03-30 Thread Erik Bray
On Tue, Mar 24, 2015 at 6:51 PM, Nick Coghlan  wrote:
>
> On 25 Mar 2015 07:35, "Robert Collins"  wrote:
>>
>> This is a break-out thread from the centi-thread that spawned about
>> setup-requires.
>>
>> d2to1 defined some metadata keys in setup.cfg,in particular 'name' and
>> 'requires-dist'. Confusing 'requires-dist' contains the
>> 'install_requires' one might use with setuptools' setup() function.
>
> That particular name comes from PEP 345:
> https://www.python.org/dev/peps/pep-0345/
>
> Extending d2to1 to accept "install-requires" as meaning the same thing as
> the existing "requires-dist" (and complaining if a setup.cfg file contains
> both) would make sense to me, as it provides a more obvious migration path
> from setuptools, and pairs up nicely with a new "setup-requires" section for
> setup.py dependencies.

I would be fine with that, and other similar changes.  Better
documentation of the format is needed too--it used to just rely on the
distutils2 documentation, but since distutils2 is dead d2to1 deserves
documentation in its own right.

> (It also occurs to me that we should probably ask the d2to1 folks if they'd
> be interested in bringing the project under the PyPA banner as happened with
> setuptools, distlib, etc. It's emerged as a key piece of the transition from
> Turing complete build process customisation to static build metadata
> configuration)

As "the d2to1 folks", more or less, (not counting the pbr folks who've
done their own thing and might have opinions), I would be fine with
this.  It has been on my agenda for over a year to release an update
to d2to1 under a new name--something less tied to the failed
distutils2 project (along with its own documentation, see above).

The new name I've been working under cheekily called "setup.cfg", that
is, the actual Python package is named "setup.cfg".  You import
setup.cfg in your setup.py and it basically does the rest.  But if
that ends up being deemed too confusing/silly that would be
understandable--I'm open to other ideas.

>> Since the declarative setup-requires concept also involves putting
>> dependencies in setup.cfg (but setup_requires rather than
>> install_requires), I followed the naming convention d2to1 had started.
>> But - all the reviewers (and I agree) think this is confusing and
>> non-obvious.
>>
>> Since d2to1 is strictly a build-time thing - it reflects the keys into
>> the metadata and thus your egg-info/requires.txt is unaltered in
>> output, I think its reasonable to argue that we don't need to be
>> compatible with it.
>>
>> OTOH folk using d2to1 would not gain the benefits that declarative
>> setup-requires may offer in setuptools // pip.

I haven't followed this whole discussion (I started to in the
beginning, but haven't kept up), but I'm not really sure what's being
said here.  d2to1 *does* support declaring setup-requires dependencies
in setup.cfg, and those dependencies should be loaded before any hook
scripts are used.  Everything in d2to1 is done via various hook
points, and the hook functions can be either shipped with the package,
or come from external requirements installed via setup-requires.  It
works pretty well in most cases.

Erik
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] d2to1 setup.cfg schema

2015-03-24 Thread Robert Collins
On 25 March 2015 at 11:51, Nick Coghlan  wrote:

> Extending d2to1 to accept "install-requires" as meaning the same thing as
> the existing "requires-dist" (and complaining if a setup.cfg file contains
> both) would make sense to me, as it provides a more obvious migration path
> from setuptools, and pairs up nicely with a new "setup-requires" section for
> setup.py dependencies.

I'm inclined to patch setuptools directly; with setuptools no longer
decaying, we don't need to work around the codebase - we can work on
it.

> (It also occurs to me that we should probably ask the d2to1 folks if they'd
> be interested in bringing the project under the PyPA banner as happened with
> setuptools, distlib, etc. It's emerged as a key piece of the transition from
> Turing complete build process customisation to static build metadata
> configuration)

Thanks for reminding me that transitioning to static build metadata
configuration is a /goal/ - that should make the debate around my PR
simpler :).

> As the converse of the above, I think pip should also accept the PEP 345
> defined "requires-dist" as equivalent to "install-requires" (and similarly
> complain if a file defines both, but in pip's case, only emitting a warning
> and then treating them as a single combined section)

I've implemented supporting both, erroring if both are present at
once, and not warning (at this stage - we can add a warning later
methinks). Tis rude to warn when things are bleeding edge.

>> What do folk think?
>
> To summarise my view: I think it makes the most sense to use setuptools
> inspired section names, and teach d2to1 about them, while also having pip
> understand the existing PEP 345 defined section name.

Roughly done; we're pending Jason's input and buy-in ATM on the pip PR :)

-Rob


-- 
Robert Collins 
Distinguished Technologist
HP Converged Cloud
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] d2to1 setup.cfg schema

2015-03-24 Thread Nick Coghlan
On 25 Mar 2015 07:35, "Robert Collins"  wrote:
>
> This is a break-out thread from the centi-thread that spawned about
> setup-requires.
>
> d2to1 defined some metadata keys in setup.cfg,in particular 'name' and
> 'requires-dist'. Confusing 'requires-dist' contains the
> 'install_requires' one might use with setuptools' setup() function.

That particular name comes from PEP 345:
https://www.python.org/dev/peps/pep-0345/

Extending d2to1 to accept "install-requires" as meaning the same thing as
the existing "requires-dist" (and complaining if a setup.cfg file contains
both) would make sense to me, as it provides a more obvious migration path
from setuptools, and pairs up nicely with a new "setup-requires" section
for setup.py dependencies.

(It also occurs to me that we should probably ask the d2to1 folks if they'd
be interested in bringing the project under the PyPA banner as happened
with setuptools, distlib, etc. It's emerged as a key piece of the
transition from Turing complete build process customisation to static build
metadata configuration)

> Since the declarative setup-requires concept also involves putting
> dependencies in setup.cfg (but setup_requires rather than
> install_requires), I followed the naming convention d2to1 had started.
> But - all the reviewers (and I agree) think this is confusing and
> non-obvious.
>
> Since d2to1 is strictly a build-time thing - it reflects the keys into
> the metadata and thus your egg-info/requires.txt is unaltered in
> output, I think its reasonable to argue that we don't need to be
> compatible with it.
>
> OTOH folk using d2to1 would not gain the benefits that declarative
> setup-requires may offer in setuptools // pip.

As the converse of the above, I think pip should also accept the PEP 345
defined "requires-dist" as equivalent to "install-requires" (and similarly
complain if a file defines both, but in pip's case, only emitting a warning
and then treating them as a single combined section)

> What do folk think?

To summarise my view: I think it makes the most sense to use setuptools
inspired section names, and teach d2to1 about them, while also having pip
understand the existing PEP 345 defined section name.

Cheers,
Nick.

>
> -Rob
>
> --
> Robert Collins 
> Distinguished Technologist
> HP Converged Cloud
> ___
> Distutils-SIG maillist  -  Distutils-SIG@python.org
> https://mail.python.org/mailman/listinfo/distutils-sig
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig


[Distutils] d2to1 setup.cfg schema

2015-03-24 Thread Robert Collins
This is a break-out thread from the centi-thread that spawned about
setup-requires.

d2to1 defined some metadata keys in setup.cfg,in particular 'name' and
'requires-dist'. Confusing 'requires-dist' contains the
'install_requires' one might use with setuptools' setup() function.

Since the declarative setup-requires concept also involves putting
dependencies in setup.cfg (but setup_requires rather than
install_requires), I followed the naming convention d2to1 had started.
But - all the reviewers (and I agree) think this is confusing and
non-obvious.

Since d2to1 is strictly a build-time thing - it reflects the keys into
the metadata and thus your egg-info/requires.txt is unaltered in
output, I think its reasonable to argue that we don't need to be
compatible with it.

OTOH folk using d2to1 would not gain the benefits that declarative
setup-requires may offer in setuptools // pip.

What do folk think?

-Rob

-- 
Robert Collins 
Distinguished Technologist
HP Converged Cloud
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig