pre-commit-ci / issues

public issues for https://pre-commit.ci
17 stars 4 forks source link

conda language support #63

Closed joaander closed 3 years ago

joaander commented 3 years ago

Would it be possible to support the conda language on pre-commit.ci? conda-forge provides a number of useful tools for open source projects that do not have recent versions available through other languages, such as clang-format (mentioned in #59 #11) and clang-tidy.

I would be happy to submit a PR to the runner if you would like.

asottile commented 3 years ago

all of the languages (except maybe docker because it may be impossible to support (?)) are planned at some point

unfortunately, the way things are structured right now the scaling agility of pre-commit.ci is closely tied to the image size of runner-image so I'm currently reworking how additional languages are added.

hopefully in the near future I'll have a concrete way to add languages without impacting the ability to autoscale quickly (currently it takes ~100 seconds to add a host and most of that is pulling runner-image -- realistically I can get that to about ~30s with languages lazy-loaded only as needed)

joaander commented 3 years ago

Excellent, thanks for the update.

asottile commented 3 years ago

this is now implemented! https://groups.google.com/u/3/g/pre-commit-ci/c/0kTrNMDU6J0

joaander commented 3 years ago

Thanks! Unfortunately, it seems that clang-tools is too large to install in the free tier:

build of https://github.com/glotzerlab/pre-commit-clang-format@v1.1.0 for conda@default exceeds tier max size 250MiB: 616.9MiB

https://results.pre-commit.ci/run/github/147663007/1629726403.M4XfBsFCR5O6LM1ZQVhkFg

We will continue to run clang-format locally.

asottile commented 3 years ago

fwiw, this seems to have some potential in the clang-format department -- the 600+ MiB is probably due to containing the full clang toolchain (which ideally wouldn't be necessary?) -- it looks like a standalone clang-format binary is right around ~2MiB even with all of the linked deps -- https://pypi.org/project/clang-format

looks like they're looking for someone to pitch in on maintenance as well: https://github.com/mgevaert/clang-format-wheel/issues/4

joaander commented 3 years ago

Yes, the clang-tools package on conda-forge pulls in much more of the toolchain than is needed to run just clang-format or clang-tidy. However, I use it because it is the only modern (llvm 10 or newer), multi-platform solution I am aware of within the package managers that pre-commit supports. The work in mgevaert/clang-format-wheel#4 looks promising and hope this can provide a better solution in the future.

henryiii commented 3 years ago

This is now working for conda. I think there will be a hook repository for it in github.com/pybind soon (may depend on how far away mgevaert/clang-format-wheel looks to be). The repo is sitting at https://github.com/henryiii/conda-clang-format for the moment. If you use that:

- repo: https://github.com/henryiii/conda-clang-format
  rev: v12.0.1
  hooks:
  - id: clang-format

If you want do it manually with a local hook:

- repo: local
  hooks:
  - id: clang-format
    name: Clang Format
    language: conda
    types: [c++]
    entry: clang-format
    args: [-style=file, -i]
    additional_dependencies: [--channel=conda-forge, clang-format==12.0.1]

Currently sits around 200MB, will probably be reduced a bit more, but still larger and requires conda, compared to a possible PyPI solution. I think cibuildwheel + manylinux2010 + PyPI cmake + the PR I haven't written yet to wheel would make this much easier to do on PyPI.

joaander commented 3 years ago

Great, thanks! I'll give that a try.