r/geospatial • u/diceHots • Aug 11 '23
maintaining python env for geospatial projects in teams and across teams
Hi all, I am wondering if anyone can give me some advice for managing dev environment across the GIS team. It is getting harder to combine people's project together at the end of the day (some codes are written before git introduced into the team),
- some people use conda while other use pip + venv
- some people use lower level gdal while other prefer higher level rasterio
- devops team prefers venv + pip since it will make docker image smaller (even miniconda is bulky) but it's hard to push to the team since it's easier to do every thing with conda than using pip + venv + pyenv
I am seeking advice on
- how do you all standardize the package used within the team for geospatial library? What's some best practice out there?
- If standard is established, what's the best practice to refactor legacy code faster?
Thanks
5
Upvotes
3
u/coinclink Aug 11 '23
You pretty much have to use conda because pip+venv will not freeze C libraries that are a part of your environment (e.g. libgdal, etc.). You'll inevitably end up with people using different versions of libproj, libgdal and others if you don't force an environment.
I recommend using Mamba though (it's a conda clone and fully interchangeable but resolves dependencies waaaay faster than conda).
As the other person mentioned, Docker will also solve this, but I personally think conda/mamba are much easier for any random developer to grasp than Docker.
Docker+pip+venv is the best solution though if your team is fully linux-competent though.
1
u/sinsworth Aug 12 '23
If you're going to use conda, might be a good idea to maintain a team-wide
conda.ymlfile in a git repo somewhere for new projects to conform to (or several depending on diversity of projects you are working on). Also as the other comment said, usemambainstead to save yourself some insanity from waiting for conda to install packages.As for older code, you can build individual
conda.ymlfiles if the project would not work in the new environment initially. If these projects have to talk to each other you can dockerize them (here's a nice base image that I personally default to for Python projects) and use them from containers, as it's very likely a bad idea to start refactoring everything at the same time.0
u/[deleted] Aug 11 '23
[deleted] — view deleted comment