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

chore: make psycopg2 optional #480

Merged
merged 1 commit into from
May 14, 2021
Merged

chore: make psycopg2 optional #480

merged 1 commit into from
May 14, 2021

Conversation

jenhagg
Copy link
Collaborator

@jenhagg jenhagg commented May 14, 2021

Purpose

Simplify local installation by removing psycopg2 from requirements.txt and separate the code that depends on it, to prevent import errors if psycopg2 is not installed.

What the code is doing

  • Move psycopg2 to optional requirements
  • Nothing is done with Pipfile, so tox will still run the associated sql tests. Anyone who needs to run those tests but isn't using pipenv will need to also install the optional requirements (or just pip install psycopg2).
  • Remove psycopg2 from setup.py - this will cause dependent packages not to install it as well, so we could regenerate the Pipfile.lock in PostREISE and PreREISE.

Testing

tox

Time estimate

5 min

@jenhagg jenhagg requested review from rouille and kasparm May 14, 2021 00:13
@jenhagg jenhagg self-assigned this May 14, 2021
@jenhagg jenhagg added this to the The 4th be with you milestone May 14, 2021
@@ -67,7 +67,7 @@ def _check_content(filepath):
assert CONTENT == f.read()


root_dir = server_setup.DATA_ROOT_DIR
root_dir = server_setup.DATA_ROOT_DIR.rstrip("/")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a funny artifact of the config.ini file I'm using with my other branch - it ends up overriding the DATA_ROOT_DIR with LOCAL_DIR, which is expected, but the trailing slash breaks a couple of tests here which use string concatenation to join paths for simplicity/readability. Real functionality uses os.path.join so this isn't a problem elsewhere.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You lost me. In your other branch, jon/windows I presume, you have a config.ini file where you set the path for the various variables, including DATA_ROOT_DIR. But for what reason it is overwritten by LOCAL_DIR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config.ini sets the deployment mode, which results in using a LocalConfig, where we default the DATA_ROOT_DIR to be equal to LOCAL_DIR since there is no need for separate locations. This caused a test failure since LOCAL_DIR has an extra / at the end. So this is just to make the tests work whether or not there is a config.ini causing this effect.

Copy link
Collaborator

@rouille rouille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@jenhagg jenhagg merged commit d60d707 into develop May 14, 2021
@jenhagg jenhagg deleted the jon/psycopg2 branch May 14, 2021 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants