Pants: python_binary doesn't have the singular `source=` argument documented

Created on 26 Nov 2019  路  4Comments  路  Source: pantsbuild/pants

See https://www.pantsbuild.org/build_dictionary.html#bdict_python_binary. sources is documented, but not source, which isn't deprecated.

documentation

Most helpful comment

I'm cool with deprecating source.

I'd rather not allow strings as values for sources (i.e. I'd rather require a list/iterable).

All 4 comments

Note from @Eric-Arellano -- this is actually true for all targets, not just python_binary(). We should either have this on every target definition (good idea), or figure out some way to make it clear that source is always a stand-in for singular sources (unclear how this would work yet).

source doesn't play well with the Target API, which is very Field centric. There isn't (currently) a very strong story around two fields being tightly coupled to each other. I'm sure we could figure something out, but it likely wouldn't be ideal.

My other concern is that sources can now be globs, and that means that source can also be a glob. For example, it's possible to say source='*.py'. Semantically, that does not make sense because *.py almost certainly means multiple source files.

--

What do you all think about deprecating source?

The reasons I think we should:

  1. Avoids the semantic weirdness of source="*.py".
  2. Reduces the number of concepts for users.
  3. Makes the Target API much cleaner.

We can throw together a trivial script to rewrite source to sources to distribute to users via migration-support.

If the concern is needing the two extra characters of [], we could allow sources to be Union[str, Iterable[str]], just like compatibility is, and call ensure_str_list. Although, I would strongly discourage that.

cc @benjyw @jsirois @illicitonion @stuhood @blorente

I'm cool with deprecating source.

I'd rather not allow strings as values for sources (i.e. I'd rather require a list/iterable).

Yeah, I'd prefer to get rid of source= entirely, it was just a convenience so you could infer the entry_point.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Eric-Arellano picture Eric-Arellano  路  7Comments

stuhood picture stuhood  路  5Comments

pvcnt picture pvcnt  路  3Comments

cosmicexplorer picture cosmicexplorer  路  8Comments

Eric-Arellano picture Eric-Arellano  路  5Comments