datalab-org / datalab

datalab is a place to store experimental data and the connections between them.
https://docs.datalab-org.io
MIT License
49 stars 17 forks source link

Changes to pre-commit #785

Closed jdbocarsly closed 4 months ago

jdbocarsly commented 4 months ago

This PR (hopefully) fixes two issues with our pre-commit

  1. The generate-schemas hook used repo:local and language:python, which allows it to run code within our pipenv. However, this means that if pre-commit is ever run from outside the pydatalab virtual environment, it will instead attempt to run the code in the system environment, and fail. This can happen if, for example, the user tries to run git commit without being in the pydatalab pipenv shell or typing pipenv run git commit. The change here uses the language:system option and a bash one-liner to manually ensure that generate-schemas is always run in the correct pipenv.

  2. Recently mypy started breaking with the mysterious AssertionError: Internal error: unresolved placeholder type None. This seems to be related to using the type-all requirement in our mypy pre-commit hook. Here, I replace it with explicity requirements for the type stubs we use:

    • types-python-dateutil
    • types-requests
    • types-paramiko
codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 67.16%. Comparing base (a25aeab) to head (6510ac3).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #785 +/- ## ======================================= Coverage 67.16% 67.16% ======================================= Files 62 62 Lines 3828 3828 ======================================= Hits 2571 2571 Misses 1257 1257 ```
cypress[bot] commented 4 months ago

Passing run #1953 ↗︎

0 40 0 0 Flakiness 0

Details:

Merge 6510ac3f28730fcafd3c29a267ef968ef1822109 into a25aeab677e1b919fd72a985bb49...
Project: datalab Commit: 1d65bf8889 ℹ️
Status: Passed Duration: 01:57 💡
Started: Jun 21, 2024 4:39 AM Ended: Jun 21, 2024 4:41 AM

Review all test suite changes for PR #785 ↗︎