Commit 89a1061a authored by Kirill Smelkov's avatar Kirill Smelkov

setup: Provide golang.X requirements in pygolang[X]

... and everything that whole pygolang depends on in pygolang[all].

The reason we do this: currently golang.perf.benchlib needs NumPy, but
it would be not ok to depend whole pygolang on numpy. Similarly pybench
needs pytest, but it would be not ok to require pytest unconditionally.

Thus allow users to specify what they need from pygolang via extras,
like pygolang[x.perf.benchlib] or pygolang[cmd.pybench], with
pygolang[all] serving as merge point for all subpackages dependencies.

TODO in the future we'll, hopefully, also provide accumulation points,
like pygolang[x.perf] which contains everything pygolang[x.perf.*]
depends on.

Note: core functionality and gpython are provided always unconditionally.
parent 02f6991f
...@@ -138,6 +138,23 @@ class develop(XInstallGPython, _develop): ...@@ -138,6 +138,23 @@ class develop(XInstallGPython, _develop):
assert self.gpython_installed == 1 assert self.gpython_installed == 1
# requirements of packages under "golang." namespace
R = {
'cmd.pybench': {'pytest'},
'x.perf.benchlib': {'numpy'},
}
# TODO generate `a.b -> a`, e.g. x.perf = join(x.perf.*); x = join(x.*)
Rall = set()
for pkg in R:
Rall.update(R[pkg])
R['all'] = Rall
# extras_require <- R
extras_require = {}
for k in sorted(R.keys()):
extras_require[k] = list(sorted(R[k]))
setup( setup(
name = 'pygolang', name = 'pygolang',
version = version, version = version,
...@@ -156,10 +173,7 @@ setup( ...@@ -156,10 +173,7 @@ setup(
include_package_data = True, include_package_data = True,
install_requires = ['gevent', 'six', 'decorator'], install_requires = ['gevent', 'six', 'decorator'],
extras_require = extras_require,
extras_require = {
'test': ['pytest'],
},
entry_points= {'console_scripts': [ entry_points= {'console_scripts': [
# NOTE gpython is handled specially - see XInstallGPython. # NOTE gpython is handled specially - see XInstallGPython.
......
...@@ -3,7 +3,7 @@ envlist = {py27,py36,py37,pypy,pypy3}-{thread,gevent} ...@@ -3,7 +3,7 @@ envlist = {py27,py36,py37,pypy,pypy3}-{thread,gevent}
[testenv] [testenv]
deps = deps =
.[test] .[all]
# gpython pre-imports installed golang, will get into conflict with # gpython pre-imports installed golang, will get into conflict with
# golang/ if we run pytest from pygolang worktree. Avoid that. # golang/ if we run pytest from pygolang worktree. Avoid that.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment