Skip to content

DOC: Create link from "Creating a development environment" to "pre-commit" #48941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Dr-Irv opened this issue Oct 4, 2022 · 19 comments · Fixed by HatimZ/pandas#1 or #49308
Closed

DOC: Create link from "Creating a development environment" to "pre-commit" #48941

Dr-Irv opened this issue Oct 4, 2022 · 19 comments · Fixed by HatimZ/pandas#1 or #49308
Assignees
Labels
Docs good first issue Typing type annotations, mypy/pyright type checking

Comments

@Dr-Irv
Copy link
Contributor

Dr-Irv commented Oct 4, 2022

I had to recreate my pandas environment from environment.yml . Then when I updated a PR, the pre-commit was failing because autotyping was not installed. It needs to be added to environment.yml

This is a docs issue. See #48941 (comment)

@Dr-Irv Dr-Irv added the Typing type annotations, mypy/pyright type checking label Oct 4, 2022
@MarcoGorelli
Copy link
Member

can you show the error please? I wouldn't expect it to fail, because it's listed in the additional dependencies

- autotyping==22.9.0

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Oct 4, 2022

autotyping..............................................................................................Failed
- hook id: autotyping
- exit code: 1

Could not find autotyping in any configured modules

I had to install autotyping myself.

@MarcoGorelli
Copy link
Member

🤔 how odd, I don't have it installed in my environment

(pandas-dev) marcogorelli@DESKTOP-U8OKFP3:~/pandas-dev$ pre-commit run autotyping -a
autotyping...............................................................Passed
(pandas-dev) marcogorelli@DESKTOP-U8OKFP3:~/pandas-dev$ pip freeze | grep autotyping

I'll take a look tomorrow, but I wouldn't think you'd need to add it to environment.yml too

@MarcoGorelli
Copy link
Member

I tried again, with a new virtual environment, and it worked fine again:

(.venv) (base) marcogorelli@DESKTOP-U8OKFP3:~/pandas-dev$ pre-commit run autotyping -a
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
autotyping...............................................................Passed

I've never seen Could not find autotyping in any configured modules TBH - perhaps try opening a bug in https://github.com/pre-commit/pre-commit ? The additional_dependencies should definitely provide you with all you need in a local hook

@MarcoGorelli
Copy link
Member

MarcoGorelli commented Oct 4, 2022

Ah, got it (maybe)

The only way I can reproduce this error is by removing autotyping from

https://github.com/pandas-dev/pandas/blob/8bcc1ebb8babdfc95afe89219dabcaa98614caea/.libcst.codemod.yaml#L14l

Does

git diff upstream/main -- .libcst.codemod.yaml .pre-commit-config.yaml

show nothing?

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Oct 4, 2022

Does

git diff upstream/main -- .libcst.codemod.yaml .pre-commit-config.yaml

show nothing?

Yes, it shows nothing.

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Oct 4, 2022

Maybe there is something I needed to do to set up the pre-commit hook/installs?

@rhshadrach
Copy link
Member

rhshadrach commented Oct 4, 2022

One needs to run pre-commit install within the project directory to setup. I often forget to do this.

@twoertwein
Copy link
Member

Could it maybe be an issue on windows with how LibCST calls autotyping?

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Oct 6, 2022

One needs to run pre-commit install within the project directory to setup. I often forget to do this.

It might be useful to have a link from https://pandas.pydata.org/pandas-docs/stable/development/contributing_environment.html to https://pandas.pydata.org/pandas-docs/stable/development/contributing_codebase.html#pre-commit so that when you are setting up a development environment, you are also told to do the pre-commit install.

I will change the title of the issue accordingly.

@Dr-Irv Dr-Irv changed the title DEV: autotyping missing from environment.yml DOC: Create link from "Creating a development environment" to "pre-commit" Oct 6, 2022
@MarcoGorelli
Copy link
Member

It you don't do pre-commit install, then pre-commit wouldn't run automatically on commit - if it ran for you then you must have already done it, or triggered it manually. pre-commit install isn't necessary for running it manually

I'll try this out on Windows to see if that's the issue

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Oct 6, 2022

I created a new environment, then did a commit, and had the message. Now I had done a pre-commit install on a previous pandas environment, so maybe that is the issue, because it is remembering a previous run?

@MarcoGorelli
Copy link
Member

🤔 hmm yeah, sounds plausible. In which case, linking to the instructions suggesting pre-commit install (as you're suggesting) would be an improvement

@EdwinCXM
Copy link

Hi, I'm a first time contributor, has someone taken this yet? If not I would love to take this

@MarcoGorelli
Copy link
Member

go ahead, thanks!

@EdwinCXM
Copy link

Thanks! Do I need to get assigned this?

@MarcoGorelli
Copy link
Member

if you comment "take" it'll be assigned to you - no need if you've already commented though

@EdwinCXM
Copy link

take

@HatimZ
Copy link
Contributor

HatimZ commented Oct 25, 2022

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs good first issue Typing type annotations, mypy/pyright type checking
Projects
None yet
6 participants