开发者

best tool for building python distro with dependencies/resources

开发者 https://www.devze.com 2023-03-17 19:48 出处:网络
So I\'ve been working on a python project and reached the point that I have to mak开发者_如何学Goe some kind of installer/distribution. Now this project has quite a lot of dependencies and some resour

So I've been working on a python project and reached the point that I have to mak开发者_如何学Goe some kind of installer/distribution. Now this project has quite a lot of dependencies and some resources. So far I'm struggling to create a setup.py but stuff like scipy, matplotlib or even numpy are having some issues with easy_install. Now this should be a cross-platform installer/distribution/exe but a start with mac-os/linux would also be ok. Now I've googled around and Enstaller or Distribute seem like alternatives to setuptools and py2exe/pyinstaller also seem usefull. Now I don't really want to start and struggle with every one and maybe get nowhere so my question is what do you recommend for this considering that the number of dependencies and resources is quite high?

Regards, Bogdan


I dont know if this is what you need, but for python based packaging

  • pip with requirement
  • buildout

You can use pastescript to generate your setup.py (or make project skeleton/templates)

Example of setup.py

simple

from setuptools import setup, find_packages

setup(
    name = "google killer",
    version = "0.1.0",
    url = 'http://example.com/',
    license = 'AGPL',
    description = 'best software ever',
    author = 'me',
    packages = find_packages('src'),
    package_dir = {'': 'src'},
    install_requires = ['numpy', 'scipy', 'sqlalchemy'],
)

complex. made by pastescript in pyramid project

import os

from setuptools import setup, find_packages

here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()

requires = ['pyramid', 'WebError']

setup(name='test',
      version='0.0',
      description='test',
      long_description=README + '\n\n' +  CHANGES,
      classifiers=[
        "Programming Language :: Python",
        "Framework :: Pylons",
        "Topic :: Internet :: WWW/HTTP",
        "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
        ],
      author='',
      author_email='',
      url='',
      keywords='web pyramid pylons',
      packages=find_packages(),
      include_package_data=True,
      zip_safe=False,
      install_requires=requires,
      tests_require=requires,
      test_suite="test",
      entry_points = """\                                                                  
      [paste.app_factory]                                                                  
      main = test:main                                                                     
      """,
      paster_plugins=['pyramid'],
      )

you can find them in most python projects

Also, read The Hitchhiker’s Guide to Packaging for detailed narrative explanation (the quickstart is helpful)

0

精彩评论

暂无评论...
验证码 换一张
取 消