Using venv for a development environment

@comeng , @codefarmer , and anyone else uses a venv as their development environment:

Are these instructions complete? Do you do anything additional, or differently? (For example, nothing is said about environment variables; do they need to be set differently in the dev environment?)

Are you able to run both versions of Gramps (your regular installation and your dev version) simultaneously, without one affecting the other in any way?

Do you do anything to make your dev version look different when it’s running (color, fonts, etc.)?

Anything else that I don’t even know I should be asking about?

Thanks very much for any additional guidance.

(FYI, my environment is Debian 13 “trixie”.)

George

If you are running Trixie then you do not need to set up venv unless you
have something else you use and wish to protect that from any potential
GRAMPS issues
I am running GRAMPS 6.0.6 with no venv on Trixie quite happily.
phil

Yes, Gramps 6 runs fine on Trixie. I want to protect it from my own Gramps development efforts :slight_smile: .

I want each environment to have not only its own code, but also its own user directory (database, .ini files, custom filters, etc.).

I would like to be able to run both versions simultaneously so as to compare results.

My main Gramps platform for genealogy work is Windows which I don’t mix with development, with the exception of testing my fixes.

For development I maintain the following:

  1. Windows code editing and run environment.
  2. MSYS2 on Windows for coding, debugging, and building the AIO installer.
  3. Ubuntu under Windows Subsystem for Linux (WSL) coding and debugging environment for fixing bugs which require debugging or testing on Linux. I’m not using a venv right now, even though I believe isolating the dev env is a good idea. I did create a venv previously but now Gramps doesn’t run in that venv and I haven’t bothered to figure out what’s wrong.

The wiki documents steps that I remember taking to set up my environment, with the exception of step 4 (install Gramps in the build environment) - i just run it from source. Maybe I need to try out that step when I set up a new environment.

So far, it seems that running my dev version from source with a different value for GRAMPSHOME gives me the isolation I need, for example:

GRAMPSHOME=$HOME/gramps-dev python3 Gramps.py

creates a single user directory in ~/gramps-dev rather than in these two places:

~/.config/gramps [for .ini files and custom filters]

~/.local/share/gramps [for plugins and databases]

This wiki page might be out of date, as it doesn’t mention the .config directory.

I see that I also have data in ~/.cache/gramps (thumbnails?). The location is set in gramps/gen/const.py like this:

USER_CACHE = os.path.join(get_user_cache_dir(), “gramps”)

It seems that this location can’t be overridden?

Assuming I use a different media path for my dev version vs. my regular install, does it mean that I will have only one set of thumbnails used by both? (Rather than making a copy all of all my media – thousands of images – I am thinking of having only a small subset in my dev environment.)

Is there also a cache for map tiles or other things?

Are there other locations where user data is stored?

Though this started out as a question about venvs, I would appreciate input from anyone successfully running multiple versions of gramps on a single machine.

It looks like this unconditional setting is a result of PR2103 though I can find no reason in the notes as to why the cache is now being treated differently than the config and data. @Nick-Hall can you please explain? (Why shouldn’t I want my cache within my GRAMPSHOME directory structure?)

Meanwhile, I guess making it conditional again will be the first change I make in my dev environment :slight_smile: .

The second change I made in my dev environment is to allow that version of Gramps to run simultaneously with another version (avoiding the “Gramps is already running” error). To do this, I changed the value of the application_id to “org.gramps_project.Gramps_dev” in the GrampsApplication class in gramps/gui/grampsgui.py.

It is convenient to keep the cache directory separate because it is usual to exclude it from backups.

The location can be configured by setting the XDG_CACHE_HOME environment variable.