Vinay Sajip  committed c755876

Added wheel_version to

  • Participants
  • Parent commits 968fd1f

Comments (0)

Files changed (4)

 - wheel
+    - Added wheel_version kwarg to API.
     - Changed Wheel.install API (after consultation on distutils-sig).
     - Added support for PEP 426 JSON metadata (pydist.json).

File distlib/

             p = to_posix(os.path.relpath(record_path, base))
             writer.writerow((p, '', ''))
-    def build(self, paths, tags=None):
+    def build(self, paths, tags=None, wheel_version=None):
         Build a wheel from files in specified paths, and use any specified tags
         when determining the name of the wheel.
                 archive_paths.append((ap, p))
         wheel_metadata = [
-            'Wheel-Version: %d.%d' % self.wheel_version,
+            'Wheel-Version: %d.%d' % (wheel_version or self.wheel_version),
             'Generator: distlib %s' % __version__,
             'Root-Is-Purelib: %s' % is_pure,

File docs/reference.rst

                    build of a named project).
       :type spec: str
-   .. method:: build(paths, tags=None)
+   .. method:: build(paths, tags=None, wheel_version=None)
       Build a wheel. The ``name``, ``version`` and ``buildver`` should already
       have been set correctly.
                    ``'pyver'``, ``'abi'`` and ``'arch'`` indicating lists of
                    tags which indicate environments with which the wheel is
+      :param wheel_version: If specified, this is written to the wheel's
+                            "Wheel-Version" metadata. If not specified, the
+                            implementation's latest supported wheel version is
+                            used.
    .. method:: install(self, paths, maker, **kwargs)

File docs/tutorial.rst

 relate to the building Python. You can similarly pass values using the ``abi``
 and ``arch`` keys in the ``tags`` dictionary.
+Specifying a wheel's version
+You can also specify a particular "Wheel-Version" to be written to the wheel
+metadata of a wheel you're building. Simply pass a (major, minor) tuple in
+the ``wheel_version`` keyword argument to :meth:``. If not
+specified, the most recent version supported is written.
 Installing from wheels