https://pantsbuild.org/ logo
#development
Title
# development
h

hundreds-father-404

01/06/2020, 10:55 PM
First proposed change to prepare for `non-target specs`: rename
Spec
to
AddressSpec
. Why? We don’t want to expand the current definition of
Spec
to include files - it’s a very useful abstraction as is, e.g. that we have logic for
SingleAddress
. At the same time, “specs” is a very useful namespace to describe your specifications for what you want to run against. We would have
AddressSpec
, and
FileSpec
(maybe
DirectorySpec
?). All of these things are `Spec`s. This is a more sound model than something like
Spec
,
File
, and
Directory
, which are all
PositionalArg
.
PositionalArg
is an implementation detail - the real core idea is that this is a specification for something to run against. -- Thoughts and/or opposition?
h

hundreds-breakfast-49010

01/06/2020, 11:11 PM
is there a subtype relationship here? i.e. is
TargetSpec
eventually going to be a subclass of a new abstract class
Spec
that is different from the class currently called
Spec
?
h

hundreds-father-404

01/06/2020, 11:14 PM
Yes, we’ll have an abstract superclass
Spec
and
AddressSpec
and
FileSpec
would be subclasses Conceptually, a
Spec
is a specification of something to run Pants against. That specification can come in different forms, e.g.
src/python/pants/util:strutil
or
src/python/pants/util/strutil.py
A rule could request either
Specs
,
AddressSpecs
, or
FileSpecs
depending on what interface they want to provide. (Possibly, we decide they need to support all 3 interfaces. Unclear, but we can defer that.)
h

hundreds-breakfast-49010

01/06/2020, 11:15 PM
ok, that makes sense to me, and I think that rename you're talking about is fine
w

witty-crayon-22786

01/07/2020, 2:07 AM
fine with that.
💯 1
except maybe for this part:
Possibly, we decide they need to support all 3 interfaces. Unclear, but we can defer that.
you probably do not want to provide
Specs
unless they can be used interchangeably somehow
👍 1
h

hundreds-father-404

01/07/2020, 2:08 AM
@witty-crayon-22786 would we need to do it via a deprecation cycle where we have both
Spec
as an alias of
AddressSpec
or we can do this without deprecation because the engine isn’t public API? (Although, Spec is used by V1 too)
w

witty-crayon-22786

01/07/2020, 2:09 AM
um. unknown.
depends whether API-public...?
h

hundreds-father-404

01/07/2020, 2:09 AM
Technically, no, it’s not
w

witty-crayon-22786

01/07/2020, 2:10 AM
yea, they're not.
and the only way they would be exposed right now is via v2, for which we do not yet have a deprecation policy
👍 1