encukou / gitpathlib

Object-oriented paths in Git repositories
https://pypi.python.org/pypi/gitpathlib/0.2
MIT License
6 stars 3 forks source link

naucse-python dies with an error when running for the first time #5

Closed mcurlej closed 1 month ago

mcurlej commented 1 month ago

Hello All,

wanted to add a new course through naucse-python repo. Used this tutorial. Created new venv and run poetry install and then poetry poetry run python -m naucse serve. It died at:

(pyladies) λ  naucse-python git:(main) ✗ poetry run python -m naucse serve
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/mcurlej/Development/python/venv/pyladies/lib/python3.11/site-packages/naucse/__main__.py", line 1, in <module>
    from naucse.cli import main
  File "/home/mcurlej/Development/python/venv/pyladies/lib/python3.11/site-packages/naucse/cli.py", line 3, in <module>
    from naucse.views import make_app
  File "/home/mcurlej/Development/python/venv/pyladies/lib/python3.11/site-packages/naucse/views.py", line 11, in <module>
    from naucse import models
  File "/home/mcurlej/Development/python/venv/pyladies/lib/python3.11/site-packages/naucse/models.py", line 22, in <module>
    from naucse import local_renderer, compiled_renderer
  File "/home/mcurlej/Development/python/venv/pyladies/lib/python3.11/site-packages/naucse/compiled_renderer.py", line 11, in <module>
    from gitpathlib import GitPath
  File "/home/mcurlej/Development/python/venv/pyladies/lib/python3.11/site-packages/gitpathlib/__init__.py", line 4, in <module>
    from gitpathlib.gp_pygit import PygitBackend
  File "/home/mcurlej/Development/python/venv/pyladies/lib/python3.11/site-packages/gitpathlib/gp_pygit.py", line 9, in <module>
    pygit2.GIT_OBJ_COMMIT: 'commit',
    ^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pygit2' has no attribute 'GIT_OBJ_COMMIT'. Did you mean: 'GIT_OBJECT_COMMIT'?
(pyladies) λ  naucse-python git:(main) ✗

running:

(pyladies) λ  naucse-python git:(main) ✗ python --version
Python 3.11.9
(pyladies) λ  naucse-python git:(main) ✗

Discussed with @encukou and it seems like a bug.

encukou commented 1 month ago

Thanks for the report! This should be fixed in the new gitpathlib 0.3.