Skip to content

Consider finding an alternative to python-dateutil #289

Description

@musicinmybrain

Is your feature request related to a problem? Please describe.

In Fedora, it was recently pointed out that the python-dateutil package has some issues. It has not been actively maintained for some time, it may need changes for Python 3.15, and upstream is apparently not responding to attempts to responsibly disclose security issues. There is now a draft Change to deprecate the package in Fedora. This wouldn’t immediately remove the package from Fedora, but would start the process by prohibiting packages from adding new dependencies on it.

Describe the solution you'd like

Find a replacement for dateutil where it’s used in bidscoin – either a better-maintained PyPI dependency, or perhaps functionality now in the Python standard library – and remove the dependency on python-dateutil.

Describe alternatives you've considered

Do nothing for now. Act more urgently if and when python-dateutil breaks significantly with a new Python release.

Downstream, drop the bidscoin package from Fedora if and when python-dateutil is actually removed from the distribution.

Additional context

This gives an idea of the potential scope:

$ rg dateutil
pyproject.toml
29:                    'python-dateutil',

bidscoin/utilities/physio.py
16:import dateutil.parser
344:    physio['ScanDate'] = dateutil.parser.parse(scandate, fuzzy=True).isoformat()
399:    physio['Meta']['AcquisitionTime']   = dateutil.parser.parse(physio['ScanDate']).strftime('%H:%M:%S')

bidscoin/bids.py
19:import dateutil.parser
1863:    fmaptime   = dateutil.parser.parse('1925-01-01')    # Use the BIDS stub acquisition time
1869:        fmaptime = dateutil.parser.parse(scans_table.loc[fmap, 'acq_time'])
1874:            lowerbound = dateutil.parser.parse(scans_table.loc[prevfmap, 'acq_time'])  # Narrow the lower search limit down to the preceding field map
1876:            upperbound = dateutil.parser.parse(scans_table.loc[nextfmap, 'acq_time'])  # Narrow the upper search limit down to the succeeding field map
1877:    except (TypeError, ValueError, KeyError, dateutil.parser.ParserError) as acqtimeerror:
1888:                acqtimes.append((dateutil.parser.parse(scans_table.loc[match, 'acq_time']), match))  # Time + filepath relative to the session-folder

bidscoin/bidseditor.py
16:from dateutil.easter import easter

bidscoin/plugins/spec2nii2bids.py
9:import dateutil.parser
217:                    acq_time = dateutil.parser.parse(acq_time)

bidscoin/plugins/nibabel2bids.py
6:import dateutil.parser
193:            acq_time = dateutil.parser.parse(f"1925-01-01T{metadata.get('AcquisitionTime', '')}")

bidscoin/plugins/dcm2niix2bids.py
9:import dateutil.parser
499:                        acq_time = dateutil.parser.parse(acq_time)

bidscoin/plugins/events2bids.py
5:import dateutil.parser
184:                acq_time = dateutil.parser.parse(run.datasource.attribute('Logfile written') or run.datasource.attribute('date') or '1925-01-01')

bidscoin/plugins/__init__.py
6:import dateutil.parser
81:                        age = dateutil.parser.parse(scandate) - dateutil.parser.parse(dateofbirth)

There are not that many places where dateutil would have to be replaced, but on the other hand, subtle differences in date parsing can be consequential.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions