Closed jorenham closed 1 week ago
I don't quite understand why it fails within pre-commit, but succeeds when I pip install .
a local clone of basedpyright
within a fresh venv
🤔
ideally it should just use the wheel from pypi instead of trying to build it. maybe @KotlinIsland could take a look as he's more familiar with pre-commit than me
As I mentioned in https://github.com/AThePeanut4/docify/issues/3, I believe that adding a valid pyproject.toml
to docify
would be enough in this case.
But I agree that a PyPI dependency would be best.
I'm seeing this, not sure what anything here means 😅
uv pip install git+https://github.com/AThePeanut4/docify@8896d7f4f3543b4f48ef8ebdec3b96250d5d1900
Updated https://github.com/AThePeanut4/docify (8896d7f)
error: Failed to build: `git+https://github.com/AThePeanut4/docify@8896d7f4f3543b4f48ef8ebdec3b96250d5d1900`
Caused by: Invalid source distribution: The archive contains neither a `pyproject.toml` nor a `setup.py` file at the top level
it shouldnt need to install docify at all because it shouldn't be trying to build the package itself. is there a way to make pre-commit install it from pypi instead?
In the pre-commit docs it says
The installed package will provide an executable that will match the
entry
– usually throughconsole_scripts
orscripts
in setup.py.
So if I understand correctly, after it does a pip install .
, it manually looks in the pyproject.toml
for a script that matches the hook.
So that must be where it attempts to install docify
. No idea why though...
I don't think that's what it means, I think it means that within the environment, there must be an executable with the name of the 'entry', in this case basedpyright
.
I think that pre-commit always installs the repo at the url and doesn't use pypi, we could refactor to a config that uses a local
instead?
pre-commit is not a very good tool, I don't know why it's considered industry standard...
Maybe this?
- name: basedpyright
- description: 'pyright fork with various type checking improvements, improved vscode support and pylance features built into the language server'
- entry: basedpyright
- language: local
- 'types_or': [ python, pyi ]
- require_serial: true
- additional_dependencies: [ basedpyright==1.13.0 ]
- minimum_pre_commit_version: '2.9.2'
ergh, I think we would need to do something like this https://github.com/psf/black-pre-commit-mirror/blob/main/.pre-commit-hooks.yaml
Create a new repo that just installs basedpyright...
At least a repo like that doesn't seem like it's a lot of effort to create or maintain 🤷🏻
just forked the black mirror. wanna check if this works? https://github.com/DetachHead/basedpyright-pre-commit-mirror
@DetachHead I checked it, but this is what I get:
[INFO] Initializing environment for https://github.com/DetachHead/basedpyright-pre-commit-mirror.
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'checkout', 'v1.13.0')
return code: 1
stdout: (none)
stderr:
error: pathspec 'v1.13.0' did not match any file(s) known to git
sorry, forgot to push a tag. try again now
@DetachHead yes it works!
It appears to be related to the
docify
dependency, specifically that it.pre-commit-config.yaml
command:
output:
contents of
~/.cache/pre-commit/pre-commit.log
: