Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to install postgres support #48

Open
aholmes opened this issue Mar 5, 2024 · 1 comment
Open

Document how to install postgres support #48

aholmes opened this issue Mar 5, 2024 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers priority:2 Standard priority issue

Comments

@aholmes
Copy link
Member

aholmes commented Mar 5, 2024

Currently, postgres support requires running pip install BL_Python.database[postgres] or pip install BL_Python.database[postgres-binary]. Document this. Or, is there a better way to go about it?

The reason it is an optional dependency is because the psycopg2 binary must be built, or the pre-built binary must be used. Some machines can build the binary without issue while others require some extra steps. The intent is to make this easier for users.

@aholmes aholmes added the documentation Improvements or additions to documentation label Mar 5, 2024
@aholmes aholmes self-assigned this Mar 5, 2024
@aholmes aholmes added priority:2 Standard priority issue good first issue Good for newcomers labels Mar 22, 2024
@aholmes
Copy link
Member Author

aholmes commented Jul 2, 2024

The Makefile attempts to install the correct psycopg2 dependency. make $(SETUP_DEV_SENTINEL) and make $(SETUP_CICD_SENTINEL) will install the src/database[postgres-binary] dependency, which installs psycopg2-binary. Similarly, make $(PACKAGES) will install BL_Python.database[postgres-binary] if the target is BL_Python.database. There are no checks that the package works correctly; it is assumed that the correct binary package will be installed by pip.

However, in another project (internal name "CAP") we have gone further and verified the installation works and tried to resolve installation problems with it. This project installs BL_Python.database[postgres-binary] (per its pyproject.toml dependencies). This happens automatically when make is run (through the chain of prereqs).

 validate-psycopg2-install: $(VENV) $(SETUP_DEV_BACKEND_SENTINEL)
     @$(ACTIVATE_VENV) && \
     if ! python3 -c 'import psycopg2'; then \
         pip install psycopg2-binary --no-cache-dir --force-reinstall; \
     fi ; \
     if ! python3 -c 'import psycopg2'; then \
         echo "psycopg2 is not properly installed in the venv at $(VENV)"; \
     else \
         echo "psycopg2 is installed and working in the venv at $(VENV)."; \
     fi

Note that we have thus far intentionally avoided compiling psycopg2 on development machines because many of them lack the libxml2 dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers priority:2 Standard priority issue
Projects
None yet
Development

No branches or pull requests

1 participant