Skip to content

Fix importlib metadata access (fixes #62, alternative to #63) to fix CI for Python 3.15 - #64

Closed
hartwork wants to merge 1 commit into
dlint-py:masterfrom
hartwork:fix-ci
Closed

hartwork wants to merge 1 commit into
dlint-py:masterfrom
hartwork:fix-ci

Conversation

@hartwork

Copy link
Copy Markdown
Contributor

Fixes #62

Previously, the symptom was:

Installing the current project: dlint (0.16.0)
Traceback (most recent call last):
  [..]
  File "[..]/dlint/dlint/dlint/__init__.py", line 16, in <module>
    __url__ = m['Homepage']
              ~^^^^^^^^^^^^
  File "[..]/python3.15/importlib/metadata/_adapters.py", line 102, in __getitem__
    raise KeyError(item)
KeyError: 'Homepage'

The metadata keys available are:

In [1]: from importlib.metadata import metadata

In [2]: m = metadata('dlint')

In [3]: [(k, v) for k, v in m.items() if k != 'Description']
Out[3]:
[('Metadata-Version', '2.4'),
 ('Name', 'dlint'),
 ('Version', '0.16.0'),
 ('Summary',
  'Dlint is a tool for encouraging best coding practices and helping ensure Python code is secure.'),
 ('License-Expression', 'BSD-3-Clause'),
 ('License-File', 'LICENSE'),
 ('Requires-Python', '>=3.8.1,<4.0.0'),
 ('Classifier', 'Environment :: Console'),
 ('Classifier', 'License :: OSI Approved :: BSD License'),
 ('Classifier', 'Operating System :: MacOS :: MacOS X'),
 ('Classifier', 'Operating System :: Microsoft :: Windows'),
 ('Classifier', 'Operating System :: POSIX'),
 ('Classifier', 'Programming Language :: Python :: 3'),
 ('Classifier', 'Programming Language :: Python :: 3.9'),
 ('Classifier', 'Programming Language :: Python :: 3.10'),
 ('Classifier', 'Programming Language :: Python :: 3.11'),
 ('Classifier', 'Programming Language :: Python :: 3.12'),
 ('Classifier', 'Programming Language :: Python :: 3.13'),
 ('Classifier', 'Programming Language :: Python :: 3.14'),
 ('Classifier', 'Programming Language :: Python :: 3.15'),
 ('Classifier', 'Topic :: Security'),
 ('Classifier', 'Topic :: Software Development :: Quality Assurance'),
 ('Requires-Dist', 'flake8 (>=3.6.0)'),
 ('Project-URL', 'Homepage, https://github.com/dlint-py/dlint'),
 ('Project-URL', 'Repository, https://github.com/dlint-py/dlint'),
 ('Description-Content-Type', 'text/markdown')]

CC @mschwager @hannob

Previously, the symptom was:
> Installing the current project: dlint (0.16.0)
> Traceback (most recent call last):
>   [..]
>   File "[..]/dlint/dlint/dlint/__init__.py", line 16, in <module>
>     __url__ = m['Homepage']
>               ~^^^^^^^^^^^^
>   File "[..]/python3.15/importlib/metadata/_adapters.py", line 102, in __getitem__
>     raise KeyError(item)
> KeyError: 'Homepage'

The metadata keys available are:
> In [1]: from importlib.metadata import metadata
>
> In [2]: m = metadata('dlint')
>
> In [3]: [(k, v) for k, v in m.items() if k != 'Description']
> Out[3]:
> [('Metadata-Version', '2.4'),
>  ('Name', 'dlint'),
>  ('Version', '0.16.0'),
>  ('Summary',
>   'Dlint is a tool for encouraging best coding practices and helping ensure Python code is secure.'),
>  ('License-Expression', 'BSD-3-Clause'),
>  ('License-File', 'LICENSE'),
>  ('Requires-Python', '>=3.8.1,<4.0.0'),
>  ('Classifier', 'Environment :: Console'),
>  ('Classifier', 'License :: OSI Approved :: BSD License'),
>  ('Classifier', 'Operating System :: MacOS :: MacOS X'),
>  ('Classifier', 'Operating System :: Microsoft :: Windows'),
>  ('Classifier', 'Operating System :: POSIX'),
>  ('Classifier', 'Programming Language :: Python :: 3'),
>  ('Classifier', 'Programming Language :: Python :: 3.9'),
>  ('Classifier', 'Programming Language :: Python :: 3.10'),
>  ('Classifier', 'Programming Language :: Python :: 3.11'),
>  ('Classifier', 'Programming Language :: Python :: 3.12'),
>  ('Classifier', 'Programming Language :: Python :: 3.13'),
>  ('Classifier', 'Programming Language :: Python :: 3.14'),
>  ('Classifier', 'Programming Language :: Python :: 3.15'),
>  ('Classifier', 'Topic :: Security'),
>  ('Classifier', 'Topic :: Software Development :: Quality Assurance'),
>  ('Requires-Dist', 'flake8 (>=3.6.0)'),
>  ('Project-URL', 'Homepage, https://github.com/dlint-py/dlint'),
>  ('Project-URL', 'Repository, https://github.com/dlint-py/dlint'),
>  ('Description-Content-Type', 'text/markdown')]
@mschwager

Copy link
Copy Markdown
Contributor

Closing in favor of #63

@mschwager mschwager closed this Oct 20, 2026
@hartwork

Copy link
Copy Markdown
Contributor Author

Closing in favor of #63

@mschwager I'm a little sad now but also happy about the green CI 😄 🍻

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.

KeyError: 'Home-page'

2 participants