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
Minimum version dependency testing #6802
Changes from all commits
8ee49d7
528c688
b2a3b3b
a111d88
7ab31d4
37b9b5f
1d4beee
d2f26c2
d701597
400ea90
90d223e
8d5211e
7484e7e
c335cd8
ab013bb
4ba92fb
0bad70a
0c49d61
8b5af0c
af96928
bc63854
62a6946
3852266
c808c48
f8f5d2d
662158c
d574e56
de17c61
30ffb8a
c1eef1e
d68275c
990d138
6bfb8f0
c56b9ec
3a411f7
e7045fd
3482e02
42819e6
0fddccd
7bb3f58
b8156ce
dece0f4
afd05e2
61bb0fb
4068dcd
a0e9582
33a7e54
5347517
35d86ef
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,178 @@ | ||
name: Python Dependency Minimum Versions | ||
|
||
on: | ||
push: | ||
branches: | ||
- "develop" | ||
- "feature/**" | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
# Allows workflow to be called from other workflows | ||
workflow_call: | ||
inputs: | ||
ref: | ||
required: true | ||
type: string | ||
secrets: | ||
PARAMETER_PASSWORD: | ||
description: "Token passed from caller workflows for snowflake integration tests" | ||
required: true | ||
|
||
# Avoid duplicate workflows on same branch | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-python-min | ||
cancel-in-progress: true | ||
|
||
defaults: | ||
run: | ||
shell: bash --login -eo pipefail {0} | ||
|
||
env: | ||
FORCE_COLOR: "1" | ||
|
||
jobs: | ||
build_info: | ||
runs-on: ubuntu-latest | ||
|
||
name: "Build info" | ||
|
||
steps: | ||
- name: Checkout Streamlit code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
persist-credentials: false | ||
submodules: "recursive" | ||
fetch-depth: 2 | ||
- name: Set Python version vars | ||
id: build_info | ||
uses: ./.github/actions/build_info | ||
with: | ||
force-canary: ${{ false }} | ||
|
||
outputs: | ||
PYTHON_MIN_VERSION: ${{ steps.build_info.outputs.PYTHON_MIN_VERSION }} | ||
|
||
py_version: | ||
needs: | ||
- build_info | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
# TODO: Should we add developer-friendly name for this job also? | ||
# This will unfortunately require a branch protection update. | ||
|
||
env: | ||
PYTHON_VERSION: "${{needs.build_info.outputs.PYTHON_MIN_VERSION}}" | ||
|
||
steps: | ||
- name: Checkout Streamlit code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
persist-credentials: false | ||
submodules: "recursive" | ||
|
||
- name: Set up Python ${{ env.PYTHON_VERSION }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
# This section is an inlined copy of the make_init action | ||
# Both because we need to do some parts of it differently | ||
# and because it running in a separate action causes the python path | ||
# setup to work weirdly, so some tests fail unless you run an install | ||
# command in the workflow directly. | ||
- name: Restore pre-commit cache | ||
id: cache-pre-commit | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: v1-pre-commit-${{ env.pythonLocation }}-${{ hashFiles('**/.pre-commit-config.yaml') }} | ||
- name: Install pre-commit | ||
run: | | ||
pip install pre-commit | ||
pre-commit install-hooks | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: "yarn" | ||
cache-dependency-path: "**/yarn.lock" | ||
- name: Initialize React | ||
run: | | ||
# Create the cache directory if it does not exist. | ||
mkdir -p $(yarn cache dir) | ||
make react-init | ||
- name: Install system dependencies | ||
run: | | ||
echo "deb http://ppa.launchpad.net/maarten-fonville/protobuf/ubuntu trusty main" | sudo tee /etc/apt/sources.list.d/protobuf.list | ||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4DEA8909DC6A13A3 | ||
sudo apt update | ||
# protobuf, pyodbc, dot, & graphviz dependencies | ||
sudo apt install -y gnupg \ | ||
unixodbc-dev=2.3.9-5 \ | ||
graphviz \ | ||
libgvc6 \ | ||
protobuf-compiler | ||
# We require protoc >= 3.20, but Ubuntu 22.04 - the OS that these Github | ||
# Actions are running as of 2023.05.03 - doesn't have recent versions | ||
# of protoc in its package repository. To work around this, we vendor in | ||
# protoc 3.20.3. | ||
# We can remove the vendored protoc binary and this run step once Github | ||
# Actions moves to a newer version of Ubunutu. | ||
- name: Add vendored `protoc` to $PATH | ||
run: | | ||
echo "./vendor/protoc-3.20.3-linux-x86_64/bin" >> $GITHUB_PATH | ||
# Combine hashes of the Python interpreter, requirements files, and today's | ||
# date into a file whose hash will key the Python virtualenv. | ||
- name: Create Python environment cache key | ||
run: | | ||
md5sum $(which python) > $GITHUB_WORKSPACE/python_cache_key.md5 | ||
md5sum lib/min-constraints-gen.txt >> $GITHUB_WORKSPACE/python_cache_key.md5 | ||
md5sum lib/test-requirements.txt >> $GITHUB_WORKSPACE/python_cache_key.md5 | ||
md5sum lib/setup.py >> $GITHUB_WORKSPACE/python_cache_key.md5 | ||
date +%F >> $GITHUB_WORKSPACE/python_cache_key.md5 | ||
- name: Restore virtualenv from cache | ||
id: cache-virtualenv | ||
uses: actions/cache@v3 | ||
with: | ||
path: venv | ||
key: v1-python-venv-min-${{ hashFiles('**/python_cache_key.md5') }} | ||
- name: Create Virtual Env | ||
run: | | ||
python -m venv venv | ||
source venv/bin/activate | ||
pip install --upgrade pip | ||
deactivate | ||
- name: Activate virtualenv | ||
run: echo 'source venv/bin/activate' >> $HOME/.bash_profile | ||
- name: Generate Protobufs | ||
run: make protobuf | ||
# End of inlined make_init action | ||
|
||
AnOctopus marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Install deps | ||
run: make python-init-test-min-deps | ||
- name: Run Python Tests | ||
run: make pytest | ||
- name: Run Integration Tests | ||
run: make integration-tests | ||
- name: CLI Smoke Tests | ||
run: make cli-smoke-tests | ||
- name: Validate min-constraints-gen | ||
run: | | ||
make gen-min-dep-constraints | ||
|
||
git_status=$(git status --porcelain -- lib/min-constraints-gen.txt) | ||
if [[ -n $git_status ]]; then | ||
echo "::error::The min constraints file is out of date! Please run \`make gen-min-dep-constraints\` and commit the result." | ||
echo "::group::git diff lib/min-constraints-gen.txt" | ||
git diff lib/min-constraints-gen.txt | ||
echo "::endgroup::" | ||
exit 1 | ||
else | ||
echo "min constraints file is up to date." | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
altair==4.0 | ||
blinker==1.0.0 | ||
cachetools==4.0 | ||
click==7.0 | ||
gitpython==3.0.7 | ||
importlib-metadata==1.4 | ||
numpy==1.19.3 | ||
packaging==16.8 | ||
pandas==1.3.0 | ||
pillow==7.1.0 | ||
protobuf==3.20 | ||
pyarrow==6.0 | ||
pydeck==0.8 | ||
pympler==0.9 | ||
python-dateutil==2.7.3 | ||
requests==2.18 | ||
rich==10.14.0 | ||
tenacity==8.0.0 | ||
toml==0.10.1 | ||
tornado==6.0.3 | ||
typing-extensions==4.1.0 | ||
tzlocal==1.1 | ||
validators==0.2 | ||
watchdog==2.1.5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,23 @@ opencv-python>=4.5.3 | |
plotly>=5.3.1 | ||
pyspark>=3.1.1 | ||
pydot>=1.4.2 | ||
rich>=11.2.0 | ||
scipy>=1.7.3 | ||
seaborn>=0.11.2 | ||
setuptools>=65.5.1 | ||
watchdog>=2.1.5 | ||
|
||
urllib3>=1.9 | ||
|
||
hypothesis>=6.17.4 | ||
parameterized | ||
pytest | ||
pytest-cov | ||
requests-mock | ||
testfixtures | ||
|
||
|
||
mypy-protobuf>=3.2 | ||
|
||
Comment on lines
+18
to
+29
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: I think the convention here is to alphabetize all dependencies in the list (and also no extra newlines). Re: the new requirements themselves - it looks like most of these are duplicated from (If the latter, can we add documentation to 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. Some dev requirements (mainly 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. Possibly some of these should be factored out into a 3rd requirements file 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. It's also possible that we don't mind requiring a more recent typing extensions version, or could roll back to an older version of black that doesn't need something so recent (don't remember why we're on the version we have). |
||
# These requirements exist only for `@st.cache` tests. st.cache is deprecated, and | ||
# we're not going to update its associated tests anymore. Please don't modify | ||
# these pinned versions! | ||
|
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.
You may have already experimented with this, but just to confirm - adding a new input flag to the
make_init
action to handle the differences below doesn't work?List of those I could identify:
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.
I didn't try doing it as a new input flag, because it felt like it would result in a bad abstraction. While prototyping this, I made changes to
make_init
directly, and then when I discovered that the path only gets set up correctly if you do an additional install command in the workflow (the existing test workflows domake develop
in a step after themake_init
action), I decided to inline the action's steps.