Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve usability by providing command to build and upload in a single step #160

Closed
mgedmin opened this issue Jan 26, 2016 · 10 comments
Closed
Labels
question Discussion/decision needed from maintainers

Comments

@mgedmin
Copy link
Contributor

mgedmin commented Jan 26, 2016

Imagine you're trying to convince someone new to Python Packaging into uploading their first package to PyPI. Here's what you used to say to them:

  1. Sign up for a PyPI account at https://pypi.python.org/pypi?%3Aaction=register_form
  2. Run python setup.py sdist register upload
  3. Enter your username/password when prompted

EDIT: I'd forgotten that step 1 wasn't necessary -- if you don't have an account, running python setup.py register will offer to create one for you, according to the Python Packaging Guide.

With Twine this instead becomes

  1. Sign up as before
  2. Submit a new package at https://pypi.python.org/pypi?%3Aaction=submit_form (you only need to provide Name and Version; feel free to keep all other fields blank)
  3. Make sure you don't have stale files in dist/: rm -rf dist (assuming they're not using Windows)
  4. Run python setup.py sdist
  5. pip install twine
  6. Run twine upload dist/*
  7. Enter your username/password when prompted

This extra process complexity drives people into continuing to use the less-secure python setup.py sdist register upload alternative. Can we streamline the Twine-based process for uploading new packages?

@sigmavirus24
Copy link
Member

To submit a new package, you simply need to have your package ready to registration and then you can do

twine register dist/my-package.tar.gz (or dist/my-package.whl)

Can we streamline the Twine-based process for uploading new packages?

You've asked us to stream-line something without proposing what pieces to stream-line. Do you want us to remove the necessity to install twine? Do you want twine to build packages for you and then upload just those packages? If so, how do you propose handling breaking twine upload as people already understand it?

@mgedmin
Copy link
Contributor Author

mgedmin commented Jan 26, 2016

It's good to know that twine register exists!

runs to pip install -U twine

My suggestion for streamlining would be to implement the single-command workflow, e.g.

twine upload --register --create=sdist,bdist_wheel

This would

  • wipe dist/ of stale things (or, better yet, ask setup.py sdist/bdist_wheel to put created dists in a new empty temporary directory, if setuptools/distutils allow that)
  • run setup.py sdist bdist_wheel, according to the distribution types you asked for in --create
  • do the equivalent of twine register on the 1st created distribution
  • do the equivalent of twine upload for all created distributions

There's no way to automate the pip install twine step, but 4 steps instead of 3 is better than 7 steps instead of 3.

@sigmavirus24
Copy link
Member

So I'm very wary of overloading upload at this point. Can we compromise on something like:

twine build --upload-to={index-name|index-url} sdist bdist_wheel ...

Which will build the package files (based on the arguments you provide) into dist/ and record which files it has created. Then it would upload just those packages. This allows people to do

twine build sdist bdist_wheel

To test things first.

The other consideration is that we need to know exactly which parameters twine build will need, e.g.,

  • GPG signing: -s/--sign, --sign-with, -i/--identity
  • Repository: --upload-to (instead of --repository)
  • Authentication: -u/--username, -p/--password
  • Configuration: --config-file
  • TLS Verification: --cert, --client-cert

@mgedmin
Copy link
Contributor Author

mgedmin commented Jan 26, 2016

I like that.

@sigmavirus24
Copy link
Member

🍰 I'm working on something right now, but I should be able to get around to this sometime this weekend unless you'd like to take a crack at this.

@hickford
Copy link
Contributor

See also pypa/packaging-problems#60

I'd like commands pip register and pip publish

@annaraven
Copy link
Contributor

pip publish would rock! I do think creating the sdists and/or wheels should be a separate step, but love the idea of being able to use pip to just publish all the recent versions of my extensions or packages. It would be nice if we didn't have to specify the particular sdist or whl like we do now with register. Looking forward to the new api.

@brainwane brainwane changed the title Improve usability Improve usability by providing command to build and upload in a single step Mar 1, 2018
@bhrutledge
Copy link
Contributor

@sigmavirus24 As the last maintainer to comment on this (albeit 3+ years ago), do you have any more thoughts? As a new maintainer, this feels out of scope for Twine, and I'm inclined to close this issue.

@bhrutledge bhrutledge added question Discussion/decision needed from maintainers and removed enhancement labels Oct 3, 2019
@pradyunsg
Copy link
Member

A much broader level discussion on this topic: https://discuss.python.org/t/building-distributions-and-drawing-the-platypus/2062

@bhrutledge
Copy link
Contributor

Closing as a duplicate of #593.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Discussion/decision needed from maintainers
Projects
None yet
Development

No branches or pull requests

7 participants