I've started writing a plugin to provide support f...
# plugins
a
I've started writing a plugin to provide support for
pants publish
I've got it to the point that it 'works' and can push
python_distribution
targets to
pypi_repository
targets. would be great if someone could spare a few minutes to sanity-check it, https://github.com/xlevus/pants2-plugins/pull/2/files
đź‘€ 1
🙌 1
Things I'm unsure of • Do I need to actually return anthing? • Tests • Have I missed a trick somewhere, which would make it easy to support more generic repositories (e.g. upload wheels to both S3 and pypi or upload both wheels and .pex files to a FTP)
c
That is great! I’ve been thinking about that feature. Will take a look; from my perspective I’d be interested to see how generic we can make this goal, so that it can work on more than just python (such as Docker images, for instance)
a
I've done this with the intentions of it also working with my janky docker implementation (just haven't actually implemented it) But thinking about making it /truly/ generic, you end up with this weird feature-matrix. Some
packages
don't have any concrete artifacts (e.g. docker images), so you couldn't upload them to S3. Some packages with concrete artifacts could be uploaded to S3, but can't be uploaded to pypi or container-registries.
(also, thanks for đź‘€ )
c
Well, technically, you could upload docker images to S3, by first exporting the image to a tar archive, but not saying that is something you’d want to do. But I don’t see what’s weird with what you describe. From a command perspective, I shouldn’t care what artifacts go into what registries, and from a BUILD file point of view, there’s a type system helping out, so it will err, if you attempt to publish a Docker image to a pypi registry, for instance. I’m also thinking, that to make it easier to work with, it could be worth having a “bundle” target, that simply includes a set of distributions, and picks one registered repository/registry target, so that you could say
./pants publish python-bundle docker-bundle py-bundle-s3
or what you’d want to call them..
Took a quick read through of that PR. Looks like a great starting point. I don’t have that many tips&tricks yet, so nothing much to say from just reading it, besides a few usability/naming questions..
a
Thanks for your input on the PR. Agree with all of them.
I was considering using tags to filter/select where you publish to. i.e.
./pants publish --registry-tag=+staging
c
Nice, was actually thinking about how to achieve that. Neat idea.
h
Oh this is cool. I'll take a look!
a
So, I've pretty much refactored it all to support multiple publish-targets. (i.e. both pypi and s3) still got to re-plumb the twine code, just working out why the
PublishRequest
Union thing isn't going to the right rules