Skip to content

Conversation

@oatsu-gh
Copy link

@oatsu-gh oatsu-gh commented Sep 22, 2025

Fix #135

  • Replaced the deprecated package pkg_resources to importlib.resources, in order to use nnmnkwii even after 2025-11-30 with the latest setuptools>=81.
    • THIS CHANGE MAKE nnmnkwii INCOMPATIBLE WITH Python<=3.8, because importlib.resources.files is available only in Python>=3.9.
  • Fix typo assertRaisesRegexp -> assertRaisesRegex
  • Tested on Python 3.12.

**Note this change make it unavailable on python<3.9.**

- Use `importlib.resources` instead of `pkg_resources`.
- In `example_label_file`, the argument `phone_level` must be assigned using a keyword name.
python3.2 以降で `assertRaisesRegexp` -> `assertRaisesRegex` に変更されているため修正。
@r9y9
Copy link
Owner

r9y9 commented Sep 23, 2025

Thank you! Can you update github actions settings to drop python 3.9 and add 3.12 instead?

@oatsu-gh
Copy link
Author

oatsu-gh commented Sep 24, 2025 via email

@r9y9
Copy link
Owner

r9y9 commented Sep 24, 2025

looks like lint is failing. can you fix it? I'll triger CI again later

@oatsu-gh
Copy link
Author

OK, checking now

@oatsu-gh
Copy link
Author

Fixed import sort, to fix the isort linting error.

@r9y9
Copy link
Owner

r9y9 commented Sep 24, 2025

https://github.com/r9y9/nnmnkwii/actions/runs/17978488176/job/51140647384?pr=136 looks like CI still complains about linting issues

windows python312 を削除 (pysen のうち flake8 がうまく動かない模様)
- Fixed error `TypeError: 'nnmnkwii.util.files' is not a package`
@oatsu-gh
Copy link
Author

On python312, importlib.metadata.EntryPoints does not have method get, called from flake8.
On python311, it had.

This pysen's error is expected to be come from the flake8 incompatibility. I have no good ideas for now.


Error log of ubuntu-latest, 3.12

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/flake8/__main__.py", line 4, in <module>
    cli.main()
  File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/flake8/main/application.py", line 363, in run
    self._run(argv)
  File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/flake8/main/application.py", line 350, in _run
    self.initialize(argv)
  File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/flake8/main/application.py", line 330, in initialize
    self.find_plugins(config_finder)
  File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/flake8/main/application.py", line 153, in find_plugins
    self.check_plugins = plugin_manager.Checkers(local_plugins.extension)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/flake8/plugins/manager.py", line 356, in __init__
    self.manager = PluginManager(
                   ^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/flake8/plugins/manager.py", line 238, in __init__
    self._load_entrypoint_plugins()
  File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/flake8/plugins/manager.py", line 254, in _load_entrypoint_plugins
    eps = importlib_metadata.entry_points().get(self.namespace, ())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'EntryPoints' object has no attribute 'get'

@oatsu-gh
Copy link
Author

Newer pysen and flake8>=6.1.0 might solve these problems.

https://flake8.pycqa.org/en/latest/release-notes/6.1.0.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need to use importlib.resources instead of pkg_resources in nnmnkwii\util\files.py

2 participants