NCAS-CMS / NCAS-CMS/cf-python

Dependency checking with `importlib.metadata`

Open
#906 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

dependency enhancement
Dominant language
Python
Stars
150
Forks
23
Avg merge
1d 11h
Merged PRs (30d)
2

Description

#902 got rid of dependency version checking in init.py (apart from for cfdm)

However, it could still be done cheaply with the importlib.metadata module (as pointed by @sadielbartholomew: https://github.com/NCAS-CMS/cfdm/pull/362#discussion_r2491190645):

>>> from importlib import metadata
>>> metadata.version("cftime")
'1.6.4'
>>> metadata.version("netCDF4")
'1.7.2'
>>> metadata.version("dask")
'2025.7.0'

So, do we want to do this?

Related, is making sure that our libraries return nice things in this manner.

This issue should have the same solution as https://github.com/NCAS-CMS/cfdm/issues/364

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the dependency handling in init.py and compare this issue with cfdm issue #364, which is identified as having the same solution. Check the existing importlib.metadata behavior described here and determine the expected result before deciding what implementation and verification are needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.