Setting up local development environment from Gramps Web API

I have done some local testing of sending emails with Python and I think I may be able to contribute a PR for better handling of email sending for the Gramps Web API backend.

In order to test the PR before submitting it, and perhaps write a test to include in the repository, I have been getting the local development environment setup. I’ve been doing so with a python virtual environment (and I’ll probably soon submit a PR to the docs to better document working with a virtual environment).

I’m getting this warning message when issuing pip install -e .:

DEPRECATION: Legacy editable install of gramps-webapi==2.4.2 from file:///home/johnrdorazio/development/gramps-web-api (setup.py develop) is deprecated. pip 25.0 will enforce this behaviour change. A possible replacement is to add a pyproject.toml or enable --use-pep517, and use setuptools >= 64. If the resulting installation is not behaving as expected, try using --config-settings editable_mode=compat. Please consult the setuptools documentation for more information. Discussion can be found at Deprecate `pip install --editable` calling `setup.py develop` · Issue #11457 · pypa/pip · GitHub

Is the editable mode required? I’m not familiar with working in “editable” mode so I’m not sure of the consequences of using it or not using it.

1 Like

I’ve been reading up on the --editable flag and I understand now that it allows to develop the local package without having to reinstall it with pip every time a change is made.

So I started from scratch, and I created a pyproject.toml with:

[build-system]
# XXX: If your project needs other packages to build properly, add them to this list.
requires = ["setuptools >= 64"]
build-backend = "setuptools.build_meta"

The presence of pyproject.toml should make the installation an “editable” installation.

Then I ran pip install -e . within the virtual environment. I no longer got a warning, and on inspecting /lib/python3.12/site-packages within the virtual environment I see that gramps_webapi is no longer installed there as a package, whereas in dist-info folder for gramps_webapi I see a direct_url.json file with contents:

{"dir_info": {"editable": true}, "url": "file:///path_to_project/gramps-web-api"}

I believe that solved the editable install issue. Will now add this info to the PR I’m preparing for the documentation.