pypa / twine

Utilities for interacting with PyPI
https://twine.readthedocs.io/
Apache License 2.0
1.59k stars 303 forks source link

Document how third parties use our undocumented/unsupported APIs #665

Open di opened 4 years ago

di commented 4 years ago

In #659 it was pointed out that some third parties use twine's undocumented/unsupported APIs and that certain changes and refactoring should not be made as it might break their usage.

@sigmavirus24 said:

I've worked hard to keep things stable until someone had the time to build the real API.

In the interest of maintaining that stability, I think we should attempt to document how various third-parties are currently using this unsupported API, so we can continue to support them until there is a supported API available, and so that contributors are aware what can and cannot be changed.

List of externally used methods

twine.cli.dispatch

twine.utils.DEFAULT_REPOSITORY, twine.utils.TEST_REPOSITORY

sigmavirus24 commented 4 years ago

buildout uses twine iirc

sigmavirus24 commented 4 years ago

I think https://github.com/wbond/oscrypto/blob/master/dev/release.py insists on never using a CLI and always importing unsupported interfaces in all of their projects (this being one example)

di commented 4 years ago

Looks like oscrypto is using twine.cli.dispatch as well, I've added it above.

I couldn't find any reference to twine in buildout: https://github.com/buildout/buildout/search?q=twine

sigmavirus24 commented 4 years ago

oscrypto was just the project I recalled. I think all of wbond's projects use the same infrastructure/project skeleton

bhrutledge commented 4 years ago

I added hatch to the list.

sigmavirus24 commented 4 years ago

I'm not seeing it in the issue @bhrutledge

bhrutledge commented 4 years ago

@sigmavirus24 It's in the description of this issue, under "Other uses"

di commented 4 years ago

Besides DEFAULT_REPOSITORY/TEST_REPOSITORY, it looks like hatch is just using one of the entry points we've explicitly defined:

https://github.com/pypa/twine/blob/895ac8af383b99d9b1673f2d7edcea92e4b5a429/setup.cfg#L50-L54

Do we consider that to be an unsupported use of an internal API?

sigmavirus24 commented 4 years ago

Those entry points are for us to use so I'd hope they're not using them directly. Also https://github.com/ofek/hatch/blob/666fc1a1b383cf9c882720bbb90a5cdf4d7b8110/hatch/commands/release.py#L114-L115 is shelling out from within python so I don't consider that a problem. python -m twine is a valid way of invoking the tool

di commented 4 years ago

~I'm confused. Invoking twine like python -m twine upload invokes the entrypoint main in twine.commands.upload. Hatch is using that entrypoint, if it wasn't defined in twine/setup.cfg calling python -m twine upload would fail.~

Edit: I see what you're saying now.

duckinator commented 4 years ago

bork uses from twine.cli import dispatch as twine_dispatch, same as zest.releaser.

di commented 4 years ago

Thanks! Added.