-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add pip builds #27
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
env/manifest.lock linguist-generated=true linguist-language=JSON |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
run/ | ||
cache/ | ||
lib/ | ||
log/ | ||
!env/ |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "quotes-app-pip", | ||
"version": 1 | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,130 @@ | ||||||
version = 1 | ||||||
|
||||||
[install] | ||||||
python3.pkg-path = "python312" | ||||||
pip.pkg-path = "python312Packages.pip" | ||||||
setuptools.pkg-path = "python312Packages.setuptools" | ||||||
|
||||||
[hook] | ||||||
on-activate = """ | ||||||
# Autogenerated by Flox | ||||||
|
||||||
# Setup a Python virtual environment | ||||||
|
||||||
export PYTHON_DIR="$FLOX_ENV_CACHE/python" | ||||||
if [ ! -d "$PYTHON_DIR" ]; then | ||||||
echo "Creating python virtual environment in $PYTHON_DIR" | ||||||
python -m venv "$PYTHON_DIR" | ||||||
fi | ||||||
|
||||||
# Quietly activate venv and install packages in a subshell so | ||||||
# that the venv can be freshly activated in the profile section. | ||||||
( | ||||||
source "$PYTHON_DIR/bin/activate" | ||||||
# install the dependencies for this project based on pyproject.toml | ||||||
# <https://pip.pypa.io/en/stable/cli/pip_install/> | ||||||
pip install -e . | ||||||
) | ||||||
|
||||||
# End autogenerated by Flox | ||||||
""" | ||||||
|
||||||
[profile] | ||||||
bash = """ | ||||||
# Autogenerated by Flox | ||||||
|
||||||
echo "Activating python virtual environment" >&2 | ||||||
source "$PYTHON_DIR/bin/activate" | ||||||
|
||||||
# End autogenerated by Flox | ||||||
""" | ||||||
fish = """ | ||||||
# Autogenerated by Flox | ||||||
|
||||||
echo "Activating python virtual environment" >&2 | ||||||
source "$PYTHON_DIR/bin/activate.fish" | ||||||
|
||||||
# End autogenerated by Flox | ||||||
""" | ||||||
tcsh = """ | ||||||
# Autogenerated by Flox | ||||||
|
||||||
echo "Activating python virtual environment" >&2 | ||||||
source "$PYTHON_DIR/bin/activate.csh" | ||||||
|
||||||
# End autogenerated by Flox | ||||||
""" | ||||||
zsh = """ | ||||||
# Autogenerated by Flox | ||||||
|
||||||
echo "Activating python virtual environment" >&2 | ||||||
source "$PYTHON_DIR/bin/activate" | ||||||
|
||||||
# End autogenerated by Flox | ||||||
""" | ||||||
|
||||||
[build.quotes-app-pip] | ||||||
command = ''' | ||||||
# Create a virtual environment for the project and its dependencies. | ||||||
mkdir -p $out/libexec | ||||||
python3 -m venv $out/libexec/venv | ||||||
source $out/libexec/venv/bin/activate | ||||||
|
||||||
# Install the project and its dependencies into the virtual environment | ||||||
pip install . | ||||||
|
||||||
# Symlink the project from the virtual environment into the `$out/bin` | ||||||
# directory. | ||||||
mkdir $out/bin | ||||||
cd $out/bin | ||||||
ln -s ../libexec/venv/bin/quotes-app-pip . | ||||||
|
||||||
echo "OUT" | ||||||
ls -al $out | ||||||
echo | ||||||
echo "LIBEXEC" | ||||||
ls -al $out/libexec/venv/lib/python3.12/site-packages/pip-25.0.1.dist-info/ | ||||||
zmitchell marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
''' | ||||||
runtime-packages = ["python3"] | ||||||
|
||||||
[build.quotes-app-pip-deps] | ||||||
command = ''' | ||||||
# Prevent install being a noop when run from an existing activation that | ||||||
zmitchell marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
# already has the virtualenv and dependencies installed. | ||||||
unset VIRTUAL_ENV | ||||||
|
||||||
# The virtual environment is only needed to be able to run | ||||||
# pip commands | ||||||
mkdir -p $out/libexec | ||||||
python3 -m venv $out/libexec/venv | ||||||
source $out/libexec/venv/bin/activate | ||||||
|
||||||
# Download wheels/source-dists of all of the dependencies | ||||||
mkdir -p $out/libexec/deps | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit
Suggested change
Is this only used by the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We recommend to users to use FHS, so I'm just following that convention. |
||||||
pip download --dest $out/libexec/deps . | ||||||
|
||||||
# We don't want/need to package the virtual environment in this step | ||||||
rm -rf $out/libexec/venv | ||||||
''' | ||||||
|
||||||
[build.quotes-app-pip-pure] | ||||||
command = ''' | ||||||
# Create a virtual environment for the project and its dependencies. | ||||||
mkdir -p $out/libexec | ||||||
python3 -m venv $out/libexec/venv | ||||||
source $out/libexec/venv/bin/activate | ||||||
|
||||||
# Install dependencies from the impure step | ||||||
pip install ${quotes-app-pip-deps}/libexec/deps/* | ||||||
|
||||||
# Install this project, skipping the deps we've just installed | ||||||
pip install --no-build-isolation --no-deps . | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note for reviewers: This |
||||||
|
||||||
# Symlink the project from the virtual environment into the `$out/bin` | ||||||
# directory. | ||||||
mkdir $out/bin | ||||||
cd $out/bin | ||||||
ln -s ../libexec/venv/bin/quotes-app-pip quotes-app-pip-pure | ||||||
''' | ||||||
sandbox = "pure" | ||||||
runtime-packages = ["python3"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question nonblocking: do we want to rename quotes-app-python -> quotes-app-poetry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually, but I'd also like it to be
*-python-poetry
to be more descriptive.