setup.py - 私有/商业项目的配置

时间:2017-05-16 13:52:08

标签: python python-packaging

我可以在setup.py项目配置文件中告诉开发人员该项目是私有/商业应用程序/库。

目前我设置:

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

任何最佳做法?

注意:

如今,大多数项目都是开源的,并且遵守许可证模型。但是,当您从事该行业时,软件是私有的。我的公司与离岸公司合作,这些公司可能不知道软件可以是私有的。所以,我想通过在setup.py文件中指定它来引起他们的注意。这就是我正在寻找最佳实践的原因。

结论/解

对于私人/专有应用程序,我将关注rth's recommendation

  • 将许可证属性设置为“Proprietary”,
  • 添加分类器“License :: Other / Proprietary License”,
  • 并且可能会添加LICENSE文件。

模板将是这样的:

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

另一种方法是设置“非开源”,如cookiecutter-pypackage模板中定义的那样。

3 个答案:

答案 0 :(得分:4)

从技术上讲,开源许可和专有软件之间没有根本区别。

在这两种情况下,您都应该添加一个LICENSE文件,说明您的软件可以做什么和不可以做什么(参见this related SO question)。还建议为项目中的每个代码文件添加一个简短的版权/许可证标题(如果它们被复制到原始包文件夹之外)。

可以在setup.py中提及许可证类型,但该字段主要用于显示上传到PyPi的Python包的许可证。由于您的代码不是开源的(并且不会上传到PyPi),因此在您的情况下这不是非常相关。

答案 1 :(得分:0)

如果你担心人们会错误地将你的包裹上传到pypi,那么其中一些技巧可能会有所帮助How to disable uploading a package to PyPi unless --public is passed to the upload command

答案 2 :(得分:-1)

为什么不查看大项目的setup.py个文件@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',
    ], },
)

找到here

相关问题