17

他のライブラリに依存するライブラリを作成しました。ただし、必要なもの (サーバーのバッチ処理など) とオプションの依存関係 (GUI を備えたクライアントなど) があります。

このようなことは可能ですか:

pip install mylib.tar.gz  # automatically downloads and installs with the minimal set of dependencies

pip install mylib.tar.gz  --install-option="complete"  # automatically installs with all dependencies

フラグを見つけましたextra_requireが、どうすればpipそれらを使用するように指示できますか? は次のsetup.pyようになります。

from setuptools import setup

# ...

# Hard library depencencies:
requires = [
    "numpy>=1.4.1",
    "scipy>=0.7.2",
    "traits>=3.4.0"
]

# Soft library dependencies:
recommended = {
    "mpl": ["matplotlib>=0.99.3"],
    "bn": ["bottleneck>=0.6"]
}

# ...

# Installer parameters:
setup(
    name = "mylib",
    #...
    install_requires = requires,
    extras_require = recommended
)
4

2 に答える 2