DEPRECATED -- Rewritten and moved to https://github.com/NiklasRosenstein/shut/. 🌊 Shore is a distribution and release management tool for pure Python packages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.7 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. # Publishing with Shore
  2. By default, every Shore package has the `setuptools` and `pypi` plugins. (This is defined in
  3. `shore.models.Package.get_plugins()`). The `setuptools` plugin is responsible for building
  4. source distributions. The `pypi` plugin consumes these distributions and publishes them on
  5. a package index using [Twine][] (PyPI and test.pypi.org by default).
  6. [Twine]: https://github.com/pypa/twine
  7. To publish packages, use the `shore publish pypi` command. Optionally add the `--test` option
  8. which will publish to the test PyPI instance instead.
  9. $ shore publish pypi --test
  10. $ shore publish pypi
  11. When adding the `pypi` plugin manually, the defaults do not apply unless you specify
  12. `defaults: true`. If the package is marked as `private`, the default `pypi` plugin configuration
  13. will not be added to the package.
  14. ### Automate publishing in CI checls
  15. You can specify the username and password in the config as environment variables. Most CI systems
  16. allow you to securely store a secret as an environment variable.
  17. ```yml
  18. name: my-package
  19. # ...
  20. use:
  21. - type: pypi
  22. defaults: true
  23. username: __token__
  24. password: '$PYPI_TOKEN'
  25. test_username: __token__
  26. test_password: '$PYPI_TEST_TOKEN'
  27. ```
  28. When you're ready to publish from the CI checks, make it run the following commands:
  29. ```yml
  30. - pip install nr.shore
  31. - shore --version
  32. - shore verify -et "$CI_TAG"
  33. - shore publish pypi
  34. ```
  35. It is also recommended that you add a trial-publish step. Note that we do not pass `-e` to
  36. `shore verify` as most commits during development won't be tagged (so we do not _expect_ a tag
  37. to be present).
  38. ```yml
  39. - pip install nr.shore
  40. - shore --version
  41. - shore verify -t "$CI_TAG"
  42. - shore bump --snapshot
  43. - shore publish pypi --test
  44. ```