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

(From Leplatrem): option upload pypi #444

Merged
merged 11 commits into from
Feb 5, 2024
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 build a release package (release=true, the default), but don't want to
reinout marked this conversation as resolved.
Show resolved Hide resolved
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
Loading