Push created package to PyPI. Requires the following defined environment variables: - TWINE_USERNAME: The PyPI username to upload this package under - TWINE_PASSWORD: The password to the user's account Args: dist (str): The distribution to push. Must be
(dist)
| 17 | |
| 18 | |
| 19 | def _pypi_push(dist): |
| 20 | """Push created package to PyPI. |
| 21 | |
| 22 | Requires the following defined environment variables: |
| 23 | - TWINE_USERNAME: The PyPI username to upload this package under |
| 24 | - TWINE_PASSWORD: The password to the user's account |
| 25 | |
| 26 | Args: |
| 27 | dist (str): |
| 28 | The distribution to push. Must be a valid directory; shell globs are |
| 29 | NOT allowed. |
| 30 | """ |
| 31 | # Register all distributions and wheels with PyPI. We have to list the dist |
| 32 | # directory and register each file individually because `twine` doesn't |
| 33 | # handle globs. |
| 34 | for filename in os.listdir(dist): |
| 35 | full_path = os.path.join(dist, filename) |
| 36 | if os.path.isfile(full_path): |
| 37 | # This will fail if the project has never been uploaded, so use check=false |
| 38 | _shell('twine register ' + shlex.quote(full_path), check=False) |
| 39 | |
| 40 | _shell('twine upload ' + shlex.quote(dist + '/*')) |
| 41 | |
| 42 | |
| 43 | def deploy(target): |