coala / coala-bears

Bears for coala
https://coala.io/
GNU Affero General Public License v3.0
294 stars 580 forks source link

Bear dependencies should be optional dependencies in setup.py #1000

Open jayvdb opened 8 years ago

jayvdb commented 8 years ago

It should be possible to install this package without any bear dependencies.

setup.py shoukd use extras for each Python dependency that bears use. And then an additional extra "alldeps" which includes all bear deps. Once done, people should migrate to using pip install coala-bears[alldeps] and then we can remove them from the default deps.

Or we could create a coala-bears-minimal package which has no bear deps.

sils commented 8 years ago

I guess they won't be installed by default then?

jayvdb commented 7 years ago

right, which will speed up installation and reduce headaches for all.

jayvdb commented 7 years ago

There are actually two sets of bear dependencies.

Direct imports

bears/python/PEP8Bear.py and bears/python/PEP8NotebookBear.py imports autopep8 directly. bears/natural_language/LanguageToolBear.py imports guess_language and language_check directly. bears/python/PyCommentedCodeBear.py imports eradicate directly. bears/general/InvalidLinkBear.py imports requests directly. etc

Indirect imports

bears/cmake/CMakeLintBear.py invokes cmakelint, which depends on cmakelint etc.

IMO these are all optional. Without them, the bear wont run, but coala will run and other bears can be used.

Which means that dependency_management may be the only actual requirement, as almost every bear needs it, and even that requirement will probably be relocated into the main coala setup.py.

Makman2 commented 7 years ago

how would I install optional packages for a bear (or even all bears if I want to) conveniently?

jayvdb commented 7 years ago

how would I install optional packages for a bear (or even all bears if I want to) conveniently?

See SomeProject[foo, bar] in https://pip.pypa.io/en/stable/reference/pip_install/#requirement-specifiers

For all bears, pip install coala-bears[alldeps] as mentioned in the issue description.

We can make as many extras as we like, with as many overlapping subsets as we want.

e.g. bear specific extras

pip install coala-bears[bear1,bear2,etc]

and language specific extras

pip install coala-bears[python,php,etc]

And a user could mix them like

pip install coala-bears[python,InferBear,etc]

Makman2 commented 7 years ago

For all bears, pip install coala-bears[alldeps] as mentioned in the issue description.

ah sorry seems I've missed that in the text :)

jayvdb commented 7 years ago

blocked on https://github.com/coala/coala-bears/issues/1044

Mixih commented 7 years ago

1044 complete. Pending implementation on ci

jayvdb commented 7 years ago

A lot of auditing required between requirements.txt and the generated version; e,g. https://github.com/coala/coala-bears/issues/1212

jayvdb commented 7 years ago

And PipRequirements (all of package_management) is not ready for this. See https://gitlab.com/coala/package_manager/issues/6

jayvdb commented 7 years ago

Now, the only requirements needed by coala-bears is coala. I think it would be good if we kept it that way.

I've done most of the fixes to python dependencies (see https://github.com/coala/coala-bears/issues/1231 and https://github.com/coala/coala-bears/pull/1230), and then will PR a "switch to using generated bear-requirements.txt".

There are then some extra GCI tasks I can create to improve setup.py and the requirements generator.

jayvdb commented 7 years ago

Not quite solved.

Mixih commented 7 years ago

@jayvdb status? do we still need to remove things?

jayvdb commented 7 years ago

Ya, we need to remove things from setup.py . Ideally we fix the repos that depend on bears being automatically installed. e.g. the docker, but it is broken atm due to https://github.com/coala/docker-coala-base/issues/87

jayvdb commented 7 years ago

Ideally we fix the repos that depend on bears being automatically installed.

coala and the docker have been fixed to use alldeps. coala-atom CI installs coala-bears, which may need fixing, but .. CircleCI is broken anyway: https://github.com/coala/coala-atom/issues/38 Presumably other editor plugin repos also need to be checked.

jayvdb commented 7 years ago

This problem has caused a huge breakage as VintBear is broken until https://github.com/Kuniwak/vint/pull/217 is fixed. Everything fails as can be seen at https://github.com/coala/coala/pull/4283