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: install extension dependencies from requirements-lock.txt #382

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JamesGuthrie
Copy link
Member

@JamesGuthrie JamesGuthrie commented Jan 22, 2025

We realised that a pip install of the extension project does not use
the locked dependencies in requirements-lock.txt. This change splits
the build.py install-py step into two: first install the project's
dependencies from requiremennts-lock.txt, then install the pgai
project (without dependencies).

@JamesGuthrie JamesGuthrie requested a review from a team as a code owner January 22, 2025 09:44
@JamesGuthrie JamesGuthrie force-pushed the jg/install-ext-deps-from-lockfile branch from c0a791b to 5c69404 Compare January 22, 2025 09:47
Comment on lines +545 to +562
# install (or re-install) pgai
d = version_target_dir.joinpath("ai") # delete module if exists
if d.exists():
shutil.rmtree(d)
for d in version_target_dir.glob(
"pgai-*.dist-info"
): # delete package info if exists
shutil.rmtree(d)
cmd = f'{bin} install -v --no-deps --compile --target "{version_target_dir}" "{ext_dir()}"'
subprocess.run(
cmd,
check=True,
shell=True,
env=os.environ,
cwd=str(ext_dir()),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Re-iterating my question from the thread:
Do we actually need the code to be a package? Can't we just do pip install -r requirements-lock.py and copy the python source files into e.g. a python directory and be done with it?

Copy link
Member Author

Choose a reason for hiding this comment

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

TBH I don't know - what do we gain from that approach vs. this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we just do pip install -r requirements-lock.py and copy the python source files into e.g. a python directory and be done with it?

If this is what we are gonna ask users to do in case they want to use pgai library in their own code base, I don't think it is viable.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, but it also doesn't make sense to have pinned/locked deps in a lib.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is to say: this approach doesn't impose our locked deps on lib users. We do still have the issue of pretty heavily-pinned deps, which we should perhaps consider relaxing a little for users of the lib.

Copy link
Contributor

Choose a reason for hiding this comment

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

TBH I don't know - what do we gain from that approach vs. this?

We'd remove a step from the installation, which removes the dependency of setuptools or any other build tool.

And no this has nothing to do with the pgai library. I'm just questioning if the extensions python code should rly be handled like a "library" which is what we are doing right now. Or if it actually is an application.

We realised that a pip install of the extension project does not use
the locked dependencies in `requirements-lock.txt`. This change splits
the `build.py install-py` step into two: first install the project's
dependencies from `requiremennts-lock.txt`, then install the pgai
project (without dependencies).
@JamesGuthrie JamesGuthrie force-pushed the jg/install-ext-deps-from-lockfile branch from 5c69404 to 5200b78 Compare January 22, 2025 09:57
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.

3 participants