sdementen / piecash

Pythonic interface to GnuCash SQL documents
Other
288 stars 75 forks source link

`importlib` migration: Python 3.12 drops support of `imp` module #216

Open almereyda opened 7 months ago

almereyda commented 7 months ago

Installing piecash on the recent Python 3.12 release throws:

Collecting piecash==0.19.0 (from -r requirements.txt (line 2))
  Downloading piecash-0.19.0.tar.gz (3.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.6/3.6 MB 18.6 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "/home/yala/.virtualenvs/gnucash-to-beancount-Baelep4e/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/yala/.virtualenvs/gnucash-to-beancount-Baelep4e/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/yala/.virtualenvs/gnucash-to-beancount-Baelep4e/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-dwiwwu5r/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-dwiwwu5r/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-dwiwwu5r/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-dwiwwu5r/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 4, in <module>
      ModuleNotFoundError: No module named 'imp'
      [end of output]

This is due to imp being removed, as announced in the previous 3.11 cycle.

It is superseded by importlib.

sdementen commented 7 months ago

Could you provide a fix for this (that keeps backward compatibility with python 3.6 onwards)? Thanks!

almereyda commented 7 months ago

importlib is available since 3.1, which means this should be doable.

Let me have a look at this in the coming couple of months.

kapinga commented 7 months ago

Looks like this was already fixed in master in #213 by @teeberg

The version on pypi doesn't have the fix (yet?), but if you install from git master it should work.

almereyda commented 7 months ago

Thanks.

Do we know when a next release could be cut from the trunk?