hukkin / mdformat-gfm

Mdformat plugin for GitHub Flavored Markdown compatibility
MIT License
13 stars 2 forks source link

Include linkify-it-py in requirements #13

Closed chrisjsewell closed 3 years ago

chrisjsewell commented 3 years ago

Using:

  - repo: https://github.com/executablebooks/mdformat
    rev: 0.7.9
    hooks:
    - id: mdformat
      additional_dependencies:
      - mdformat-gfm
      - mdformat-black

you get:

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

Traceback (most recent call last):
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/bin/mdformat", line 8, in <module>
    sys.exit(run())
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/mdformat/__main__.py", line 8, in run
    exit_code = mdformat._cli.run(sys.argv[1:])
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/mdformat/_cli.py", line 83, in run
    mdformat.renderer.LOGGER, renderer_warning_printer
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/mdformat/_api.py", line 24, in text
    rendering = mdit.render(md)
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/markdown_it/main.py", line 275, in render
    return self.renderer.render(self.parse(src, env), self.options, env)
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/markdown_it/main.py", line 260, in parse
    self.core.process(state)
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/markdown_it/parser_core.py", line 33, in process
    rule(state)
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/markdown_it/rules_core/linkify.py", line 31, in linkify
    raise ModuleNotFoundError("Linkify enabled but not installed.")
ModuleNotFoundError: Linkify enabled but not installed.
hukkin commented 3 years ago

Hey there!

We do have markdown-it-py[linkify] as a dependency already so it's not clear to me at all why you are having this issue. I've never had the same problem using mdformat-gfm and pre-commit. Could you share the repository that you're running mdformat against?

chrisjsewell commented 3 years ago

Heya: https://github.com/aiidateam/disk-objectstore/pull/112

hukkin commented 3 years ago

Can't reproduce. I get

mdformat.................................................................Passed

in branch chrisjsewell/update-repo.

chrisjsewell commented 3 years ago

yeh bit of a weird one, I just run it completely normally 🤷 Feel free to close if you feel there is nothing to be done

hukkin commented 3 years ago

I noticed you added an explicit linkify-it-py dependency. The hook still gets a PASS on my machine after commenting it out.

hukkin commented 3 years ago

Maybe some old/buggy pip/setuptools/wheel/poetry-core/pre-commit version on your machine? I'll close this now but pls reopen if you can find a way to reproduce on other machines.

chrisjsewell commented 3 years ago

no, if I do the same, I get the error:

(base) disk-objectstore/$ pre-commit run --all          
Check JSON...........................................(no files to check)Skipped
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
setup-cfg-fmt............................................................Passed
check-manifest...........................................................Passed
mdformat.................................................................Failed
- hook id: mdformat
- exit code: 1

Traceback (most recent call last):
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/bin/mdformat", line 8, in <module>
    sys.exit(run())
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/mdformat/__main__.py", line 8, in run
    exit_code = mdformat._cli.run(sys.argv[1:])
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/mdformat/_cli.py", line 83, in run
    mdformat.renderer.LOGGER, renderer_warning_printer
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/mdformat/_api.py", line 24, in text
    rendering = mdit.render(md)
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/markdown_it/main.py", line 275, in render
    return self.renderer.render(self.parse(src, env), self.options, env)
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/markdown_it/main.py", line 260, in parse
    self.core.process(state)
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/markdown_it/parser_core.py", line 33, in process
    rule(state)
  File "/Users/chrisjsewell/.cache/pre-commit/repok_ebq5gi/py_env-python3/lib/python3.7/site-packages/markdown_it/rules_core/linkify.py", line 31, in linkify
    raise ModuleNotFoundError("Linkify enabled but not installed.")
ModuleNotFoundError: Linkify enabled but not installed.

isort....................................................................Passed
pyupgrade................................................................Passed
black....................................................................Passed
pylint...................................................................Passed
(base) disk-objectstore/$ pre-commit run --all
Check JSON...........................................(no files to check)Skipped
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
setup-cfg-fmt............................................................Passed
check-manifest...........................................................Passed
mdformat.................................................................Passed
isort....................................................................Passed
pyupgrade................................................................Passed
black....................................................................Passed
pylint...................................................................Passed

but yeh maybe just a bug in my pre-commit:

base) disk-objectstore/$ conda list
# packages in environment at /Users/chrisjsewell/opt/miniconda3:
#
# Name                    Version                   Build  Channel
alabaster                 0.7.12                   pypi_0    pypi
appdirs                   1.4.3                      py_1    conda-forge
appnope                   0.1.0           py37hc8dfbb8_1001    conda-forge
archive-path              0.2.1              pyhd8ed1ab_0    conda-forge
argcomplete               1.12.1             pyh9f0ad1d_0    conda-forge
argon2-cffi               20.1.0           py37h60d8a13_1    conda-forge
arrow                     0.16.0           py37hc8dfbb8_0    conda-forge
async_generator           1.10                       py_0    conda-forge
attrs                     20.2.0             pyh9f0ad1d_0    conda-forge
babel                     2.8.0                    pypi_0    pypi
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.1                      py_0    conda-forge
beautifulsoup4            4.9.1                      py_1    conda-forge
binaryornot               0.4.4                      py_1    conda-forge
black                     20.8b1                     py_1    conda-forge
bleach                    3.2.1              pyh9f0ad1d_0    conda-forge
blinker                   1.4                        py_1    conda-forge
boolean.py                3.7                        py_0    conda-forge
brotlipy                  0.7.0           py37h60d8a13_1000    conda-forge
bs4                       4.9.1                         0    conda-forge
bzip2                     1.0.8                haf1e3a3_3    conda-forge
ca-certificates           2021.5.30            h033912b_0    conda-forge
cachecontrol              0.12.6                     py_0    conda-forge
cachy                     0.2.0                      py_0    conda-forge
certifi                   2021.5.30        py37hf985489_0    conda-forge
cffi                      1.14.3           py37hf5b7abd_0    conda-forge
cfgv                      3.2.0                      py_0    conda-forge
chardet                   3.0.4           py37hc8dfbb8_1007    conda-forge
cleo                      0.6.8                      py_0    conda-forge
click                     7.1.2              pyh9f0ad1d_0    conda-forge
cmarkgfm                  0.4.2            py37h60d8a13_3    conda-forge
coconut                   1.4.0                 py37_1000    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
colorlog                  3.1.4                 py37_1000    conda-forge
conda                     4.10.3           py37hf985489_0    conda-forge
conda-build               3.19.2           py37hc8dfbb8_3    conda-forge
conda-forge-pinning       2020.09.29.10.44.38               0    conda-forge
conda-pack                0.4.0                      py_0    conda-forge
conda-package-handling    1.7.0            py37h60d8a13_5    conda-forge
conda-smithy              3.7.9                      py_0    conda-forge
cookiecutter              1.7.2              pyh9f0ad1d_0    conda-forge
cryptography              3.1.1            py37h94e4008_0    conda-forge
curl                      7.68.0               h8754def_0    conda-forge
dataclasses               0.7                pyhb2cacf7_7    conda-forge
decorator                 4.4.2                      py_0    conda-forge
defusedxml                0.6.0                      py_0    conda-forge
deprecated                1.2.10             pyh9f0ad1d_0    conda-forge
distlib                   0.3.1              pyh9f0ad1d_0    conda-forge
doc8                      0.8.1              pyh9f0ad1d_0    conda-forge
docker                    4.3.1                    pypi_0    pypi
docutils                  0.16             py37hc8dfbb8_1    conda-forge
editdistance              0.5.3            py37hdadc0f0_1    conda-forge
entrypoints               0.3             py37hc8dfbb8_1001    conda-forge
erlang                    21.3                 h7e52f02_0    conda-forge
expat                     2.2.9                hb1e8313_2    conda-forge
fftw                      3.3.8           nompi_h5c49c53_1109    conda-forge
filelock                  3.0.12             pyh9f0ad1d_0    conda-forge
flit                      3.0.0                      py_0    conda-forge
flit-core                 3.0.0                      py_0    conda-forge
freetype                  2.10.2               h8da9a1a_0    conda-forge
genson                    1.2.2                    pypi_0    pypi
gettext                   0.19.8.1          h46ab8bc_1002    conda-forge
git                       2.23.0          pl526h6951d83_0  
gitdb                     4.0.5                      py_0    conda-forge
gitpython                 3.1.8                      py_0    conda-forge
glob2                     0.7                        py_0    conda-forge
graphviz                  2.42.3               h98dfb87_0    conda-forge
html5lib                  1.1                pyh9f0ad1d_0    conda-forge
icu                       67.1                 hb1e8313_0    conda-forge
identify                  1.5.5              pyh9f0ad1d_0    conda-forge
idna                      2.10               pyh9f0ad1d_0    conda-forge
imagesize                 1.2.0                    pypi_0    pypi
importlib-metadata        1.7.0            py37hc8dfbb8_0    conda-forge
importlib_metadata        1.7.0                         0    conda-forge
ipykernel                 5.3.4            py37h43977f1_0    conda-forge
ipython                   7.16.1           py37h43977f1_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
isodate                   0.6.0                      py_1    conda-forge
jedi                      0.17.2           py37hc8dfbb8_0    conda-forge
jinja2                    2.11.2             pyh9f0ad1d_0    conda-forge
jinja2-time               0.2.0                      py_2    conda-forge
jpeg                      9d                   h0b31af3_0    conda-forge
json5                     0.9.5              pyh9f0ad1d_0    conda-forge
jsonschema                3.2.0            py37hc8dfbb8_1    conda-forge
jupyter_client            6.1.7                      py_0    conda-forge
jupyter_core              4.6.3            py37hc8dfbb8_1    conda-forge
jupyterlab                2.2.9                      py_0    conda-forge
jupyterlab_server         1.2.0                      py_0    conda-forge
jupytext                  1.6.0              pyh9f0ad1d_0    conda-forge
keyring                   21.5.0           py37hf985489_0    conda-forge
krb5                      1.16.4               h1752a42_0    conda-forge
lammps                    2019.06.05         py37_mpich_5    conda-forge
libarchive                3.3.3             hf12134e_1008    conda-forge
libcurl                   7.68.0               h709d2b2_0    conda-forge
libcxx                    10.0.1               h5f48129_0    conda-forge
libedit                   3.1.20191231         h0678c8f_2    conda-forge
libffi                    3.2.1             hb1e8313_1007    conda-forge
libgfortran               3.0.1                         0    conda-forge
libiconv                  1.16                 haf1e3a3_0    conda-forge
liblief                   0.10.1               hb1e8313_1    conda-forge
libpng                    1.6.37               hb0a8c7a_2    conda-forge
libpq                     11.3                 h56406e1_0    conda-forge
libsodium                 1.0.18               haf1e3a3_1    conda-forge
libssh2                   1.9.0                h8a08a2b_5    conda-forge
libtiff                   4.1.0                h2ae36a8_6    conda-forge
libwebp-base              1.1.0                h0b31af3_3    conda-forge
libxml2                   2.9.10               h2c6e4a5_2    conda-forge
license-expression        1.2                        py_0    conda-forge
llvm-openmp               10.0.1               h28b9765_0    conda-forge
lockfile                  0.12.2                     py_1    conda-forge
lz4-c                     1.9.2                hb1e8313_3    conda-forge
lzo                       2.10              haf1e3a3_1000    conda-forge
markdown-it-py            0.5.5                      py_0    conda-forge
markupsafe                1.1.1            py37h60d8a13_1    conda-forge
mistune                   0.8.4           py37h9bfed18_1001    conda-forge
mpi                       1.0                       mpich    conda-forge
mpich                     3.2.1             ha90c164_1014    conda-forge
msgpack-python            1.0.0            py37ha1cc60f_1    conda-forge
msrest                    0.6.19             pyh9f0ad1d_0    conda-forge
mypy                      0.790                    pypi_0    pypi
mypy_extensions           0.4.3            py37hc8dfbb8_2    conda-forge
nbclient                  0.4.1                      py_1    conda-forge
nbconvert                 5.6.1            py37hc8dfbb8_1    conda-forge
nbformat                  5.0.7                      py_0    conda-forge
ncurses                   6.2                  hb1e8313_1    conda-forge
nest-asyncio              1.4.1                      py_0    conda-forge
nodeenv                   1.5.0              pyh9f0ad1d_0    conda-forge
nodejs                    12.4.0               h6de7cb9_0    conda-forge
notebook                  6.1.3            py37hc8dfbb8_0    conda-forge
nox                       2020.5.24                  py_0    conda-forge
oauthlib                  3.0.1                      py_0    conda-forge
openssl                   1.1.1k               h0d85af4_0    conda-forge
packaging                 20.4               pyh9f0ad1d_0    conda-forge
pandoc                    2.10.1               haf1e3a3_0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
parso                     0.7.1              pyh9f0ad1d_0    conda-forge
pastel                    0.1.0                      py_1    conda-forge
pathspec                  0.8.0              pyh9f0ad1d_0    conda-forge
pbr                       5.5.0              pyh9f0ad1d_0    conda-forge
pcre                      8.44                 h4a8c4bd_0    conda-forge
perl                      5.26.2            haec8ef5_1006    conda-forge
pexpect                   4.8.0            py37hc8dfbb8_1    conda-forge
pickle5                   0.0.11                   pypi_0    pypi
pickleshare               0.7.5           py37hc8dfbb8_1001    conda-forge
pip                       21.2.3             pyhd8ed1ab_0    conda-forge
pipx                      0.15.6.0                 pypi_0    pypi
pkginfo                   1.5.0.1                    py_0    conda-forge
pluggy                    0.13.1           py37hc8dfbb8_2    conda-forge
poetry                    0.12.17                  py37_1    conda-forge
postgresql                11.3                 hf10c77c_0    conda-forge
poyo                      0.5.0                      py_0    conda-forge
pre-commit                2.12.0                   pypi_0    pypi
prometheus_client         0.8.0              pyh9f0ad1d_0    conda-forge
prompt-toolkit            3.0.7                      py_0    conda-forge
prompt_toolkit            3.0.7                         0    conda-forge
psutil                    5.7.2            py37h60d8a13_0    conda-forge
ptyprocess                0.6.0                   py_1001    conda-forge
py                        1.9.0              pyh9f0ad1d_0    conda-forge
py-lief                   0.10.1           py37hdadc0f0_1    conda-forge
pycosat                   0.6.3           py37h60d8a13_1004    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pycrypto                  2.6.1           py37h9bfed18_1004    conda-forge
pygithub                  1.53                       py_0    conda-forge
pygments                  2.7.1                      py_0    conda-forge
pyjwt                     1.7.1                      py_0    conda-forge
pylev                     1.3.0                      py_0    conda-forge
pyopenssl                 19.1.0                     py_1    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pyrsistent                0.14.11          py37h9bfed18_1    conda-forge
pysocks                   1.7.1            py37hc8dfbb8_1    conda-forge
python                    3.7.3                h0d93f26_0    conda-forge
python-dateutil           2.8.1                      py_0    conda-forge
python-libarchive-c       2.9              py37hc8dfbb8_1    conda-forge
python-slugify            4.0.1              pyh9f0ad1d_0    conda-forge
python.app                1.3              py37h9bfed18_1    conda-forge
python_abi                3.7                     1_cp37m    conda-forge
pytoml                    0.1.21                     py_0    conda-forge
pytz                      2020.1             pyh9f0ad1d_0    conda-forge
pyyaml                    5.3.1                    pypi_0    pypi
pyzmq                     19.0.2           py37hf1e22d8_0    conda-forge
rabbitmq-server           3.7.16                        0    conda-forge
readline                  7.0               hcfe32e1_1001    conda-forge
readme_renderer           27.0               pyh9f0ad1d_0    conda-forge
regex                     2020.9.27        py37h60d8a13_0    conda-forge
requests                  2.24.0             pyh9f0ad1d_0    conda-forge
requests-oauthlib         1.3.0              pyh9f0ad1d_0    conda-forge
requests-toolbelt         0.8.0                      py_1    conda-forge
requests_download         0.1.2                      py_1    conda-forge
restructuredtext_lint     1.3.1              pyh9f0ad1d_0    conda-forge
rfc3986                   1.4.0              pyh9f0ad1d_0    conda-forge
ripgrep                   12.1.1               h0b31af3_0    conda-forge
ruamel.yaml               0.16.12          py37h60d8a13_0    conda-forge
ruamel.yaml.clib          0.2.2            py37h60d8a13_0    conda-forge
ruamel_yaml               0.15.80         py37h60d8a13_1002    conda-forge
scrypt                    0.8.17           py37h94e4008_0    conda-forge
send2trash                1.5.0                      py_0    conda-forge
setuptools                49.6.0           py37hc8dfbb8_1    conda-forge
shellingham               1.3.2                      py_0    conda-forge
simplejson                3.17.2                   pypi_0    pypi
six                       1.15.0             pyh9f0ad1d_0    conda-forge
smmap                     3.0.4              pyh9f0ad1d_0    conda-forge
snowballstemmer           2.0.0                    pypi_0    pypi
soupsieve                 2.0.1                      py_1    conda-forge
sqlite                    3.28.0               h9721f7c_0    conda-forge
stevedore                 3.2.2            py37hc8dfbb8_0    conda-forge
terminado                 0.9.1            py37hc8dfbb8_0    conda-forge
testpath                  0.4.4                      py_0    conda-forge
text-unidecode            1.3                        py_0    conda-forge
tk                        8.6.10               hb0a8c7a_0    conda-forge
toml                      0.10.1             pyh9f0ad1d_0    conda-forge
tomlkit                   0.5.11           py37hc8dfbb8_1    conda-forge
toolz                     0.11.1                     py_0    conda-forge
tornado                   6.0.4            py37h9bfed18_1    conda-forge
tox                       3.20.0           py37hc8dfbb8_0    conda-forge
tox-conda                 0.8.0              pyhd8ed1ab_0    conda-forge
tqdm                      4.50.0             pyh9f0ad1d_0    conda-forge
traitlets                 5.0.4                      py_1    conda-forge
twine                     3.2.0            py37hc8dfbb8_1    conda-forge
typed-ast                 1.4.1            py37h0b31af3_0    conda-forge
typing_extensions         3.7.4.3                    py_0    conda-forge
tzcode                    2020a                h0b31af3_0    conda-forge
unidecode                 1.1.1                      py_0    conda-forge
unittest2pytest           0.4                        py_0    conda-forge
urllib3                   1.25.10                    py_0    conda-forge
userpath                  1.4.1                    pypi_0    pypi
virtualenv                20.0.20          py37hc8dfbb8_1    conda-forge
vsts-python-api           0.1.22                     py_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
websocket-client          0.57.0                   pypi_0    pypi
wheel                     0.35.1             pyh9f0ad1d_0    conda-forge
whichcraft                0.6.1                      py_0    conda-forge
wrapt                     1.12.1           py37h9bfed18_1    conda-forge
xz                        5.2.5                haf1e3a3_1    conda-forge
yaml                      0.2.5                haf1e3a3_0    conda-forge
zeromq                    4.3.2                h4a8c4bd_3    conda-forge
zipp                      3.2.0                      py_0    conda-forge
zlib                      1.2.11            h7795811_1009    conda-forge
zstd                      1.4.5                h289c70a_2    conda-forge
hukkin commented 3 years ago

I know that e.g. some fairly recent pip-tools version had issues with package[extra] type dependency specifications (although they should be perfectly valid) (see https://github.com/pytest-dev/pytest-cov/pull/472). This seems to me like a similar issue. I don't see anything wrong with mdformat-gfm's dependency specification.

chrisjsewell commented 3 years ago

👍

hukkin commented 3 years ago

Thanks for the issue anyways. BTW are you able to reproduce in https://github.com/aiidateam/disk-objectstore CI?