Closed r-barnes closed 1 year ago
Hey @r-barnes, this sounds like a great idea. Let me bring it up in our next team meeting, and I'll let you know what they think.
@connernilsen has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@connernilsen has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@connernilsen merged this pull request in facebook/pyre-check@4f8e05badeda0204cc09142a4bf1bb043f96bfad.
This hook is not working due to failure of pip install .
. pyproject.toml
in the project root does not contain PEP621 configuration for building the package.
$ pre-commit
[INFO] Installing environment for https://github.com/facebook/pyre-check.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/eggplants/.cache/pre-commit/repo6fvdksto/py_en
v-python3.9/bin/python', '-mpip', 'install', '.')
return code: 1
stdout:
Processing /home/eggplants/.cache/pre-commit/repo6fvdksto
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
stderr:
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
error: Multiple top-level packages discovered in a flat-layout: ['api', 'stubs', 'source', 'client', 'pysa_
tutorial', 'pyre_extensions'].
To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.
If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:
1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names
To find more information, look for "package discovery" on setuptools docs.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Check the log at /home/eggplants/.cache/pre-commit/pre-commit.log
docker_image
hook would be a good choice to create a pre-commit hook for this project.
- id: pyre-check-docker
name: Run pyre check with docker
language: docker_image
entry: ghcr.io/facebook/pyre-check:X.Y.Z
Creating Dockerfile, building and publishing image to a container registry such as ghcr.io are needed.
Hook configuration file: https://github.com/igorshubovych/markdownlint-cli/blob/24627da39ba937d102861a5b42f81847c8f57b5e/.pre-commit-hooks.yaml#L15-L28
GitHub workflow for building and publishing: https://github.com/igorshubovych/markdownlint-cli/blob/master/.github/workflows/publish-container-image.yml
Published image: https://github.com/igorshubovych/markdownlint-cli/pkgs/container/markdownlint-cli
Are there additional steps in order to be able to use pyre as a pre-commit hook? It seems that even if the issues raised by @eggplants are addressed, the pre-commit framework requires the library to be able to process a list of files which isn't something Pyre appears to be able to do.
Pre-submission checklist
pip install -r requirements-dev.txt && pre-commit install
pre-commit run
Summary
This should make the Pyre compatible as a pre-commit tool
Test Plan