pypa / packaging-problems

An issue tracker for the problems in packaging
151 stars 35 forks source link

Can I specify alternative dependencies in pyproject.toml? #610

Closed airtower-luna closed 2 years ago

airtower-luna commented 2 years ago

Is it possible to specify alternative dependencies in pyproject.toml? As in, "this package requires any of these N packages".

Practical example for what I'm trying to do, from a tool that extracts EXIF data from photos:

try:
    import piexif
    get_exif_timestamp = _get_exif_timestamp_piexif
except ImportError:
    import exifread
    get_exif_timestamp = _get_exif_timestamp_exifread

The underscore variables are alternative methods with the same API, implemented using the different EXIF libraries. For the tool to work I just need one of the two modules to be available, which one doesn't matter.

I hope I've just been using the wrong search terms, but "alternative dependencies in pyproject.toml" and similar didn't yield any results. :sweat_smile:

pfmoore commented 2 years ago

No, sorry, it's not possible to do that.

airtower-luna commented 2 years ago

That's unfortunate, but thank you for the quick clarification!