biolink / ontobio

python library for working with ontologies and ontology associations
https://ontobio.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
119 stars 30 forks source link

Restrict dataclasses pkg installation to < python 3.7 #631

Closed sransara closed 10 months ago

sransara commented 1 year ago

Solves:

Using environment markers: https://peps.python.org/pep-0508/#environment-markers

Test that it works:

❯ docker run --rm -it python:3.7 sh -c 'pip install git+https://github.com/sransara/ontobio.git@fix-dataclasses-req && python'
[... docker & pip installer output removed for brevity ...]
Python 3.7.16 (default, Mar 14 2023, 03:47:39) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/local/lib/python37.zip', '/usr/local/lib/python3.7', '/usr/local/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/site-packages']
>>> # Simulate environment where pip installed site-packages comes before stdlib packages
>>> sys.path.reverse()
>>> sys.path
['/usr/local/lib/python3.7/site-packages', '/usr/local/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7', '/usr/local/lib/python37.zip', '']
>>>
>>> import ontobio
>>> 
sransara commented 10 months ago

No longer necessary since: https://github.com/biolink/ontobio/commit/34f4300497adc023dcd9b9f42ed9647eb62244ac where required Python version has been upgraded to > Python 3.9