GPL-3 places different obligations for conveying "source code" and "object code distribution". See GPL 3.0 / 4. Conveying Verbatim Copies and GPL 3.0 / 6. Conveying Non-Source Forms. Among other things:

You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways [GPL-3.0-S6]

Would python wheels (see examples from psutil here here) be considered "object code" or "source code"?

Wheels in many cases are just ZIP archives with the source code and some metadata - so I think there could be a compelling case to be made than if a tarball of source is source form then so is a python wheel.

Here is a listing of the content of one of the psutils wheels:

$ bsdtar -tf <(curl --silent https://files.pythonhosted.org/packages/13/a7/626f257d22168c954fd3ad69760c02bdec27c0648a62f6ea5060c4d40672/psutil-5.6.7-cp27-none-win32.whl)

Maybe the answer is that it depends on the content of the wheel?

  • 3
    Says the GPL: ‘The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.’ Then: are the contents of the wheels the preferred form of making modifications? Or would the preferred form also contain things like build tool configurations, tests, and so on? E.g. the above wheel contains tests but no setup.py, other wheels might even include binaries.
    – amon
    Feb 11 '20 at 19:45
  • @amon good point and this would go towards the argument that it is not "source code" - still not clearly enough "object code" in my opinion. Feb 11 '20 at 19:47
  • 1
    Does the wheel contain only .py files (i.e. source code files) or does it contain one or more .pyc files (i.e. object files)? I would consider an individual .py file "source code", and an individual .pyc files "object code", so a wheel containing only .py files (source code) might be considered source code as well, similar to a .zip archive containing only source code files.
    – Brandin
    Feb 13 '20 at 8:17

A wheel is either source code or object code. Any form of any work is one or the other, according to the GPL's disjunction:

The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.

If a wheel is source code, then sections 4 and 5 apply and you've satisfied your source-sharing requirement.

If a wheel is object code, then you must offer the "Corresponding Source":

The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities.

The salient questions, if a wheel is indeed object code, are:

  • Does a wheel contain all the necessary material to build a modified version of that wheel, such that the resulting modified wheel may be used/installed/run in a similar capacity as the original?
  • Is this source material free from obfuscation that would make it fail to be the preferred form for making modifications?

I suppose the first question is a partly a broad structural question about wheels but could also vary case by case. The second question is likely purely a case by case determination considering a particular author's code, since, structurally, wheels appear to be perfectly accessible file archives.

If there are special tools needed to prepare or configure a particular wheel, then it might be object code. Generally, though, it seems to me that wheels are source code, insofar as they are readily readable, modifiable, and reusable in and of themselves.

In particular, the wheel specification PEP says

...a wheel file may be installed by simply unpacking into site-packages with the standard 'unzip' tool while preserving enough information to spread its contents out onto their final paths at any later time.

This indicates to me that "installation" really is just a unzip and copy operation on the source contents of the archive.

While a wheel also has a metdata RECORD that must correspond to the wheel file contents in a particular way, this appears to be a simple matter of file path bookkeeping. A hypothetical tool that modifies wheel archives would appear to use the RECORD directly as metadata input; there is no "easier to use" format for this information that might force me to consider wheel metadata an object-code transformation of some original source code. The package metadata in the wheel is the simplest and most direct expression of that information that exists.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.