6

This question concerns any package, not just Python version itself. To give some context: we are planning to build an internal package at work, which naturally will have many dependencies. To give freedom for our developers and avoid messy version conflicts, I want to specify broader constraints for packages requirements(.txt), for example, pandas>=1.0 or pyspark>=1.0.0, <2.0.

There is a way to efficiently determine/test which are the lowest required versions for a given code?

I could install pandas==0.2.4 and I see if the code runs, and so on, but that approach seems to get out of hand pretty fast. It's the first time I work on package building, so I am kinda lost on that. Looking at other package's source-code (on GitHub) didn't help me, because I have no idea what is the methodology developers use to specify dependency constraints.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Gabriel M. Silva
  • 642
  • 4
  • 10
  • I would ask this in software engineering stack exchange where you will get useful insight into package managment and version tradeoffs. It sounds like you need engineering advice rather than code advice. As far as the problem you are actually trying to solve have you considered python virtual environments – kyle Nov 11 '20 at 23:57
  • Thanks for your response, I will try asking there too, maybe its better suited. And I may be wrong, but the problem isn't quite solved by a virtual environment as the idea is that other people install it along with other packages for a variety of projects (with their own virtual environments), like any other Python package. I don't know if there is a pragmatic way to do this, but I can't find anything about it, just "how do I build/replicate an *identical* environment" – Gabriel M. Silva Nov 12 '20 at 02:59
  • I don't think there's going to be any way to do it without installing various versions and seeing what works. How could a tool know whether your code relies on features that were added in a particular version? It could be interesting though to have a tool that uses something like conda to automatically try installing various versions until it finds the minimum one that works. – BrenBarn Nov 12 '20 at 04:27
  • 1
    I think vagrant tries to fill that niche https://www.vagrantup.com/ – kyle Nov 12 '20 at 04:33
  • I'm also bothered by this question now. @GabrielSilva , did you managed to find some good answer/suggestions? – tomy0000000 Jun 12 '22 at 18:17
  • No. It's been a while since I tried to find something about it, but in my case I ended up just collecting requirements for essential packages and crossing info. No automated method. Maybe [mamba's Repoquery](https://mamba.readthedocs.io/en/latest/user_guide/mamba.html#repoquery) could help somehow? – Gabriel M. Silva Jun 15 '22 at 23:45

0 Answers0