Skip to content
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

Try using pre-commit framework #79

Merged
merged 5 commits into from
Nov 30, 2022
Merged

Try using pre-commit framework #79

merged 5 commits into from
Nov 30, 2022

Conversation

ajyoon
Copy link
Collaborator

@ajyoon ajyoon commented Nov 29, 2022

The unimport maintainer suggested this may help with flaky environment issues.
It's also a useful change since it simplifies hook setups and makes them work nicer on Windows.

@craigvear could you try this out? Check out the branch and run:

poetry install  # install new pre-commit dependency
pre-commit install -f  # install new pre-commit hook, overriding old one
# If pre-commit is not found, be sure to activate your environment with `poetry shell`
# Now test the hook without needing to actually commit changes
pre-commit run --all-files

@ajyoon
Copy link
Collaborator Author

ajyoon commented Nov 29, 2022

See hakancelikdev/unimport#229

@craigvear
Copy link
Contributor

Just tried. getting error: command not found: pre-commit even after poetry shell and install

@ajyoon
Copy link
Collaborator Author

ajyoon commented Nov 29, 2022

Hmmm, could you try in a clean poetry environment? I don't see why it wouldn't be available if it's installed and the env is activated properly

@craigvear
Copy link
Contributor

just created 2 new poetry envs in PyCharm using Python 3.8 then 3.7. Poetry shell activated. Still getting error
command not found: pre-commit

@ajyoon
Copy link
Collaborator Author

ajyoon commented Nov 29, 2022

Could you share your full terminal logs? Including running which python. It still sounds like your terminal is not running with the poetry environment activated or installed properly.

@ajyoon
Copy link
Collaborator Author

ajyoon commented Nov 29, 2022

and you've definitely checked out this branch?

@craigvear
Copy link
Contributor

Was in Tuplet branch. Sorry. Just finishing a new algo for text centring. Will complete than, then push. then check out this branch and try again 👍

@craigvear
Copy link
Contributor

Works!

Installing dependencies from lock file

Package operations: 19 installs, 2 updates, 0 removals

• Updating typing-extensions (4.3.0 -> 3.10.0.2)
• Installing mypy-extensions (0.4.3)
• Installing distlib (0.3.6)
• Installing filelock (3.8.0)
• Installing platformdirs (2.5.4)
• Installing pyyaml (6.0)
• Installing typing-inspect (0.8.0)
• Installing cfgv (3.3.1)
• Installing click (8.1.3)
• Installing identify (2.5.9)
• Installing libcst (0.4.9)
• Installing nodeenv (1.7.0)
• Installing pathspec (0.10.2)
• Updating pikepdf (5.3.1 -> 5.1.5.post1)
• Installing toml (0.10.2)
• Installing typed-ast (1.5.4)
• Installing virtualenv (20.17.0)
• Installing black (22.10.0)
• Installing isort (5.10.1)
• Installing pre-commit (2.20.0)
• Installing unimport (0.12.2)

Installing the current project: neoscore (0.1.7)
   ~/Py/neoscore  on   pre-commit-framework  pre-commit install -f
pre-commit installed at .git/hooks/pre-commit
   ~/Py/neoscore  on   pre-commit-framework  pre-commit run --all-files
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/hakancelikdev/unimport.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/PyCQA/isort.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/hakancelikdev/unimport.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/PyCQA/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Check Yaml...............................................................Passed
unimport.................................................................Passed
black....................................................................Passed
isort....................................................................Passed

@ajyoon ajyoon merged commit 46d124c into main Nov 30, 2022
@ajyoon ajyoon deleted the pre-commit-framework branch November 30, 2022 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants