Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

requirements.txt: conditional on python version

My requirements.txt has got dataclasses in it, to backport for python 3.6

However, some build machines and coworkers use python 3.7, which fails when it attempts to install this module.

Is there a way to make dataclasses only installed if it is necessary?

like image 853
Daniel Paczuski Bak Avatar asked Sep 15 '25 19:09

Daniel Paczuski Bak


1 Answers

You can use Environmental Markers

dataclasses; python_version < '3.7'

Reference: https://www.python.org/dev/peps/pep-0345/#environment-markers

like image 109
Gabriel Cappelli Avatar answered Sep 17 '25 09:09

Gabriel Cappelli