Daniel Paczuski Bak
Daniel Paczuski Bak

Reputation: 4080

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?

Upvotes: 4

Views: 875

Answers (1)

Gabriel Cappelli
Gabriel Cappelli

Reputation: 4170

You can use Environmental Markers

dataclasses; python_version < '3.7'

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

Upvotes: 6

Related Questions