ics-py / ics-py

Pythonic and easy iCalendar library (rfc5545)

Home Page:http://icspy.readthedocs.org/en/stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ModuleNotFoundError: No module named 'ics.parse'

codingjoe opened this issue · comments

Hi there,

We get the following error when upgrading to the latest bugfix release 0.7.1 from 0.7.0 on Python 3.10.

Traceback (most recent call last):
  File "/home/runner/work/voiio-platform/voiio-platform/manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/runner/.local/share/virtualenvs/voiio-platform-nKjb5cjp/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/home/runner/.local/share/virtualenvs/voiio-platform-nKjb5cjp/lib/python3.10/site-packages/django/core/management/__init__.py", line 420, in execute
    django.setup()
  File "/home/runner/.local/share/virtualenvs/voiio-platform-nKjb5cjp/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/runner/.local/share/virtualenvs/voiio-platform-nKjb5cjp/lib/python3.10/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/home/runner/.local/share/virtualenvs/voiio-platform-nKjb5cjp/lib/python3.10/site-packages/django/apps/config.py", line 304, in import_models
    self.models_module = import_module(models_module_name)
  File "/opt/hostedtoolcache/Python/3.10.5/x64/lib/python3.10/importlib/__init__.py", line [12](https://github.com/voiio/voiio-platform/runs/7176992444?check_suite_focus=true#step:11:13)6, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line [24](https://github.com/voiio/voiio-platform/runs/7176992444?check_suite_focus=true#step:11:25)1, in _call_with_frames_removed
  File "/home/runner/work/voiio-platform/voiio-platform/camps/models.py", line 33, in <module>
    from ics.parse import ContentLine
ModuleNotFoundError: No module named 'ics.parse'

Cheers
-Joe!

Sure that you are upgrading from 0.7? That version also didn't have a parser module there. The correct import for 0.7(.1) is from ics.grammar.parse import ContentLine, for 0.8 it will be from ics.contentline import ContentLine.

Bump ics from 0.7 to 0.7.1 #5626

According to dependabot, we are :/

You are right, it seems that the 0.7 wheel (but not the source dist) on PyPi contains a duplicate parse file. 🙈
No idea how that ended up there...
It's weird that it worked that way, because the classes should be different from the ones we actually use and the import will only work if you installed from the wheel.

I'd recommend putting your deployment process in a GitHub action. That way, I could help debug it. I recently switched all my packages to build. It's much more reliable, since it creates a fresh environment for each build.

Does the duplicate file issue happen on a clean build again? Otherwise, an empty commit and a new bugfix release would do the trick, right?

Thanks for all the effort :)

Should you be looking for an example action:

name: Release

on:
  release:
    types: [published]

jobs:

  PyPi:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-python@v4
      with:
        python-version: "3.10"
    - run: python -m pip install --upgrade pip build wheel twine
    - run: python -m build --sdist --wheel
    - run: python -m twine upload dist/*
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
commented

I'd recommend putting your deployment process in a GitHub action.

Indeed, we know that releasing manually is not the best. That's why we have a (stale) PR to fix that (#274). We already have GitHub actions tokens named PYPI_TOKEN and TEST_PYPI_API_TOKEN in the repo so it's just a matter of making the action work now :D

You are right, it seems that the 0.7 wheel (but not the source dist) on PyPi contains a duplicate parse file. 🙈
No idea how that ended up there...

I'm the one that pushed the wheel while you are the one to have pushed the sdist, almost a year later (see #283) so i guess that why we have a difference. (But how did i end up with a duplicate parse file, that i don't know :D )

We moved the import. That solves the problem for us. Therefore, I will close the issue. I am sure you'll track the PyPi release action elsewhere. If you need any help with that, please let me know. I'm happy to help. Best Joe!