Skip to content

Use --no-deps when installing compiled requirements files #2752

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

Merged
merged 5 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
command: |
python3.8 -m venv venv/
venv/bin/pip install pip-tools --constraint requirements.in
venv/bin/pip-sync
venv/bin/pip-sync --pip-args=--no-deps
Copy link
Contributor

Choose a reason for hiding this comment

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

By default I think pip-sync only looks for requirements.txt, so should this specify both requirements.txt and java-requirements.txt like is done elsewhere?

Suggested change
venv/bin/pip-sync --pip-args=--no-deps
venv/bin/pip-sync --pip-args=--no-deps requirements.txt \
java-requirements.txt

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

java requirements are intentionally left out here, as they are optional and should not be required for unit tests.

- run:
name: Yamllint Test
command: PATH="venv/bin:$PATH" yamllint -c .yamllint.yaml .
Expand Down Expand Up @@ -176,7 +176,8 @@ jobs:
apt update
apt install -y maven default-jdk-headless
mvn dependency:copy-dependencies
venv/bin/pip-sync requirements.txt java-requirements.txt
venv/bin/pip-sync --pip-args=--no-deps requirements.txt \
java-requirements.txt
- run:
name: PyTest Integration Test
# Google's client libraries will check for
Expand Down Expand Up @@ -497,8 +498,8 @@ jobs:
bigquery-etl-main

cd bigquery-etl-main
pip install -r requirements.txt
pip install -r java-requirements.txt
pip install --no-deps -r requirements.txt
pip install --no-deps -r java-requirements.txt
mvn dependency:copy-dependencies
./script/bqetl generate all \
--target-project moz-fx-data-shared-prod
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ WORKDIR /app
FROM base AS python-deps
RUN apt-get update -qqy && apt-get install -qqy gcc libc-dev
COPY java-requirements.txt ./
RUN pip install -r java-requirements.txt
RUN pip install --no-deps -r java-requirements.txt
COPY requirements.txt ./
RUN pip install -r requirements.txt
# use --no-deps to work around https://github.com/pypa/pip/issues/9644
RUN pip install --no-deps -r requirements.txt

# download java dependencies in separate stage because it requires maven
FROM base AS java-deps
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ venv/bin/pre-commit install
4. Download java dependencies
```bash
mvn dependency:copy-dependencies
venv/bin/pip-sync requirements.txt java-requirements.txt
# specify `<(echo mozilla-bigquery-etl)` to retain bqetl from `./bqetl bootstrap`
venv/bin/pip-sync --pip-args=--no-deps requirements.txt java-requirements.txt <(echo mozilla-bigquery-etl)
```

Finally, if you are using Visual Studio Code, you may also wish to use our recommended defaults:
Expand Down
2 changes: 1 addition & 1 deletion bqetl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if [ "$CMD" == "bootstrap" ]; then
# see e.g. https://github.com/scipy/scipy/issues/13102#issuecomment-788160041
export SYSTEM_VERSION_COMPAT=1

venv/bin/pip install -r requirements.txt
venv/bin/pip install --no-deps -r requirements.txt
venv/bin/pip install -e .
echo "bqetl configured! It should now be ready for use."
exit 0
Expand Down
2 changes: 1 addition & 1 deletion docs/cookbooks/common_workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ python3 -m venv venv/
source venv/bin/activate

# If not installed:
pip install pip-tools
pip install pip-tools --constraint requirements.in

# Add the dependency to requirements.in e.g. Jinja2.
echo Jinja2==2.11.1 >> requirements.in
Expand Down
2 changes: 1 addition & 1 deletion docs/cookbooks/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ python3.8 -m venv venv/
./venv/bin/pip install pip-tools -c requirements.in

# install python dependencies with pip-sync (provided by pip-tools)
./venv/bin/pip-sync
./venv/bin/pip-sync --pip-args=--no-deps requirements.txt java-requirements.txt

# install java dependencies with maven
mvn dependency:copy-dependencies
Expand Down
2 changes: 0 additions & 2 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ click==8.0.4
gcsfs==2022.2.0
gcloud==0.18.3
gitpython==3.1.27
google-api-core==1.31.5 # transitive dep that needs dependabot updates
google-cloud-bigquery==2.34.0
google-cloud-storage==2.1.0
googleapis-common-protos==1.54.0 # transitive dep that needs dependabot updates
Comment on lines -8 to -11
Copy link
Collaborator Author

@relud relud Feb 24, 2022

Choose a reason for hiding this comment

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

remove previous workaround from #2064 which was having no impact

importlib-resources>=1.4.0 # jsonschema dep for python<3.9
Jinja2==3.0.3
jsonschema==4.4.0
Expand Down
2 changes: 1 addition & 1 deletion script/glam/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ python3 -m venv venv
source venv/bin/activate

# install dependencies
pip install -r requirements.txt
pip install --no-deps -r requirements.txt
# install bqetl command-line tool
pip install -e .
```
Expand Down