简体   繁体   中英

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.

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.

如果你担心人们会错误地将你的软件包上传到pypi,那么这些技巧中的一些可能有助于如何禁用将包上传到PyPi,除非将--public传递给upload命令

Why not checkout setup.py files of big projects @Github?

Example

from setuptools import setup, find_packages
from opensnitch.version import VERSION
import sys


if sys.version_info[0] != 3:
    raise RuntimeError('Unsupported python version "{0}"'.format(
      sys.version_info[0]))

try:
    with open('README.md') as f:
        long_description = f.read()
except:
    long_description = 'OpenSnitch - An application level firewall for GNU/Linux.'  # noqa


setup( name                 = 'opensnitch',
       version              = VERSION,
       description          = long_description,
       long_description     = long_description,
       author               = 'Simone Margaritelli',
       author_email         = 'evilsocket@gmail.com',
       url                  = 'http://www.github.com/evilsocket/opensnitch',
       packages             = find_packages(),
       scripts              = [ 'bin/opensnitch' ],
       package_data         = {'': ['*.ui']},
       license              = 'GPL',
       zip_safe             = False,
       install_requires     = [ 'scapy-python3', 'dpkt', 'NetfilterQueue', 'psutil' , 'pyinotify']
)

Example

from setuptools import setup

setup(
    name='howmanypeoplearearound',
    packages=['howmanypeoplearearound'],
    version='0.1.6',
    description='A tshark wrapper to count the number of cellphones in the vicinity',
    author='schollz',
    url='https://github.com/schollz/howmanypeoplearearound',
    author_email='hypercube.platforms@gmail.com',
    download_url='https://github.com/schollz/howmanypeoplearearound/archive/v0.1.6.tar.gz',
    keywords=['tshark', 'wifi', 'location'],
    classifiers=[],
    install_requires=[
        "click",
    ],
    setup_requires=[],
    tests_require=[],
    entry_points={'console_scripts': [
        'howmanypeoplearearound = howmanypeoplearearound.__main__:main',
    ], },
)

Found here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM