Skip to content

Commit

Permalink
Merge pull request #444 from zestsoftware/leplatrem-option-upload-pypi
Browse files Browse the repository at this point in the history
(From Leplatrem): option upload pypi
  • Loading branch information
reinout committed Feb 5, 2024
2 parents aed25b9 + 7bf60f7 commit caf45cb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
5 changes: 4 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ Changelog for zest.releaser
9.1.2 (unreleased)
------------------

- Nothing changed yet.
- If you want to build a release package (release=true, the default), but don't want to
actually upload it, you can now set the ``upload-pypi`` option to false (default is
true).
[leplatrem]


9.1.1 (2023-10-11)
Expand Down
6 changes: 0 additions & 6 deletions doc/source/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ If you have docker installed, all you need to do to run the tests is::
$ docker build . -t zest:dev
$ docker run --rm zest:dev

The "build" step runs bootstrap and buildout. Re-run it periodically to get
the latest versions of if you've changed the buildout config.

Note: buildout should not be needed anymore, because we use ``tox``.
So the Dockerfile was updated, but not tested.

The "run" command runs the tests. It uses the code copied into the dockerfile
in the build step, but you probably want to test your current version. For
that, mount the code directory into the docker::
Expand Down
5 changes: 5 additions & 0 deletions doc/source/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ release = true / false
default answer for the question if you want to create a checkout
of the tag.

upload-pypi = true / false
Default: true. Normally you won't use this setting. Only if you want to make a
release without actually uploading it, set it to false. (Note that you still need
release=true).

create-wheel = true / false
Default: true, if the recommended ``wheel`` package is installed.
Set to false if you do not want zest.releaser to create Python wheels.
Expand Down
13 changes: 13 additions & 0 deletions zest/releaser/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,19 @@ def create_wheel(self):
return False
return self.config.get("create-wheel", True)

def upload_pypi(self):
"""Should we upload the package to Pypi?
[Configure this mode by adding a ``upload-pypi`` option::
[zest.releaser]
upload-pypi = no
The default when this option has not been set is True.
"""
return self.config.get("upload-pypi", True)

def register_package(self):
"""Should we try to register this package with a package server?
Expand Down
3 changes: 3 additions & 0 deletions zest/releaser/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ def _upload_distributions(self, package):
self.data["tagworkingdir"],
)
builder.build("wheel", "./dist/")
if not self.zest_releaser_config.upload_pypi():
logger.info("Upload to PyPI was disabled in the configuration.")
return
if not self.pypiconfig.is_pypi_configured():
logger.error(
"You must have a properly configured %s file in "
Expand Down

0 comments on commit caf45cb

Please sign in to comment.