Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setup.py -- configuration for private / commercial projects

What can I put on our setup.py project configuration file to tell the developers that the project is a private/commercial application/library.

Currently I set:

setup(
    name='MyProject',
    version='0.1.0',
    license='(c) My Company',
    ...
)

Any best practice?

Note:

Nowadays, most of the projects are open source, and adhere to the licences model. However, when you work on the industry, software are private. My company works with off-shore companies which may not be aware of the fact that a software can be private. So, I want to bring this fact to their attention by specifying this in the setup.py file. This is why I'm looking for best practices about that.

Conclusion/Solution

For private/proprietary applications, I will follow rth's recommendation:

  • set the license attribute to “Proprietary”,
  • add the classifier “License :: Other/Proprietary License”,
  • and maybe add a LICENSE file.

The template will be something like that:

setup(
    name='MyProject',
    version='0.1.0',
    license="Proprietary",
    classifiers=[
        'License :: Other/Proprietary License',
        ...
    ],
    ...
)

An alternative could be to set “Not open source”, like defined in the cookiecutter-pypackage template.

like image 900
Laurent LAPORTE Avatar asked May 16 '17 13:05

Laurent LAPORTE


People also ask

Do you need both setup py and setup cfg?

you must have a valid setup.py file apart from setup. cfg and pyproject. toml . You can use the same dummy setup file I shared in the previous section that makes just a single call to the setup() method.

What should setup py contain?

The setup.py file may be the most significant file that should be placed at the root of the Python project directory. It primarily serves two purposes: It includes choices and metadata about the program, such as the package name, version, author, license, minimal dependencies, entry points, data files, and so on.

What is setup py Bdist_wheel?

Building Wheels Building wheels from a setuptools based project is simple: python setup.py bdist_wheel. This will build any C extensions in the project and then package those and the pure Python code into a . whl file in the dist directory.


1 Answers

Technically, there is no fundamental difference between licensing open-source and proprietary software.

In both cases you should include a LICENSE file specifying what can and cannot be done with your software (see this related SO question). It is also advised to add a short copyright / license header to every code file in your project (in case they get copied outside of the original package folder).

It is possible to mention the license type in setup.py, however that field is mainly used to display the license for Python packages uploaded to PyPi. Since your code is not open-source (and won't be uploaded to PyPi), this is not very relevant in your case.

like image 119
rth Avatar answered Sep 19 '22 13:09

rth