DigiScore / neoscore

A python library for notating music in a graphics-first paradigm
https://neoscore.org
BSD 3-Clause "New" or "Revised" License
108 stars 9 forks source link

Try using pre-commit framework #79

Closed ajyoon closed 1 year ago

ajyoon commented 1 year ago

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 commented 1 year ago

See https://github.com/hakancelikdev/unimport/issues/229

craigvear commented 1 year ago

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

ajyoon commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

and you've definitely checked out this branch?

craigvear commented 1 year ago

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 commented 1 year ago

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