上传到PyPI

markdown
阅读 49 收藏 0 点赞 0 评论 0

pypiupload.md
Uploading to PyPI
================

## Initial things:
1. Make an account on PyPI

1. Make sure you have `twine` and `wheel` installed in your repo: `pip install twine wheel`

1. Make sure you have your `~/.pypirc` file that looks like this:
  ```
  [distutils]
  index-servers =
    pypi

  [pypi]
  username=<INSERT HERE>
  password=<INSERT HERE>
  ```

1. Change permissions of that file: `chmod 600 ~/.pypirc`

1. Add a `setup.cfg` file that looks like this:
  ```
  [metadata]
  description-file = README.md

  [wheel]
  universal = 1

  [egg_info]
  tag_build =
  tag_date = 0
  tag_svn_revision = 0
  ```

1. In your `setup.py`, make sure you have the following `classifiers`:
  ```
  classifiers=[
    'Programming Language :: Python',
    'Programming Language :: Python :: 2',
    'Programming Language :: Python :: 2.7',
    'Programming Language :: Python :: 3',
    'Programming Language :: Python :: 3.5',
    'Programming Language :: Python :: 3.6',
  ],
  ```

## Build and Upload:
1. Tag branch: `git tag <VERSION> -m "Version blah blah blah..."` and then upload: `git push --tags REMOTE`

1. Build it: `python setup.py sdist bdist_wheel --universal`

1. Then upload: `twine upload dist/*`

评论列表


问题


面经


文章

微信
公众号

扫码关注公众号