um... You should have been pinning all your dependencies from the very start
> Virtual environments doesn't solve any of the problems as python authors either don't specify the version or their dependency author doesn't specify it.
This is a problem of lack of training or willful poor practice, not an issue with venvs themselves which absolutely do solve this issue.
Agreed, the problem would not exist at all if an approach like that of say, node development, existed, but here we are.
You mean only your direct dependencies, right? And yes, of course
These are very solveable (and have been solved for a while) problems. It really pains me that most people are either unaware or do not dive deep enough below the surface to find them.
If you depend on dependency pinning due to unmaintained code then you should go deal with the problem directly. Say you pin 10 external libraries to three year old versions, how many security holes does that expose you to?
That's really my issue with dependency pinning, you end up with software that are just allowed to rot, making upgrades more difficult with every passing year.
> That's really my issue with dependency pinning, you end up with software that are just allowed to rot, making upgrades more difficult with every passing year
You seem to be suggesting not pinning and just pulling in the latest (minor, I presume?) versions every time you redeploy.
A better way is to pin _all_ your direct dependencies and check for minor version upgrades on a regular basis, especially for publically available services. A proper CI system should allow you to do this with confidence.
Occasionally you will be forced into major version upgrades, but in my experience this is rare.
This should be a regular and essential part of software maintenance and security vigilance.
I'd agree with that, I just don't believe that to be happening on any significant scale. Reasonably I think you should be able to do pinning like:
library>=3.0,<4
Depending on the versioning scheme of the library, but yes, pulling in minor release. We currently do that using Debian packages and just rely on the OS to provide security updates to underlying Python packages.Pinning is fine is you manage updates, but if you're then pulling in three year old libraries, which may come with their own pinned third party dependencies, I still think you're doing it wrong. In the example from GP it appears that they are pinning versions as a way to avoid forking and patching a deprecated and unmaintained package.
I'm not oppose to version pinning as such, but if you don't have a plan to stay on top of security updates, then you're better off pulling in any minor update. It's not just at redeploy, you may reasonably need to pull dependency updates more frequently than you redeploy.
If you deploy using Docker e.g. you're CI system needs to be constantly be pulling in updates, rebuilding and testing container images. People just don't do that. Most developers I worked with don't even care to update their container images if they aren't updating their own code. I've on multiple occasions had to deal with developers who absolutely lost their mind because we didn't automatically pull in OS updates, yet they themselves shipped outdated Java libraries or at one point even relied on an out date version of an alpha release of Tomcat that hadn't been updated for three years. The only different was that their dependencies where in containers and therefor, in their mind, "safe".
Why not use a venv or Docker? It's a world of difference. There are multiple issues with relying on the OS package manager for Python dependency management.
Overall it sounds like you know good practice and you know the value of venvs, pinning and Docker but you've had to deal with some workplaces with really shoddy practices. Still, that's no reason to say "venvs don't work" or to give up altogether on the notion of good practice by saying "People just don't do that".
I've worked in shoddy shops, I've worked in shops with excellent practices. In some places I've been the one that made them transition from the former to the latter.
After the Py2 vs. Py3 thing settled down, almost all of the operations issues got away.
That said, Python has a really bad situation about dependencies upgrade on the development side. But Docker won't help you there anyway. Personally, at this point I just assume any old Python program won't work anymore.
./deploy.sh pull sync migrate seed restart
pull calls git pull, sync runs pipenv sync, migrate runs django migrate, seed runs django management command seed, restart calls systemctl --user restart
Target simplicity, it’s the ultimate sophistication.
This is an incredibly common occurrence, especially with ML systems which are not designed by people with an engineering mindset.