mwvgroup / Pitt-Google-Broker

A Google Cloud-based alert broker for LSST and ZTF
https://pitt-broker.readthedocs.io/en/latest/index.html
4 stars 0 forks source link

Update to Python 3.12 #214

Open wmwv opened 8 months ago

wmwv commented 8 months ago

Google Cloud Functions will deprecate Python 3.7 in 2024 January. Use this motivation to update to Python 3.12.

Steps

  1. [x] Update deploy.sh scripts to specify --runtime python312 instead of --runtime python37.
  2. [x] Test cloud functions locally to check requirements.
  3. [x] Check requirements.txt files to see if there are extra pins.
  4. [x] Test deployment in test framework on GCP.
wmwv commented 6 months ago

Pins:

[...]
apache-beam[gcp]==2.25.0
astropy==3.2.1
fastavro==0.22.3
# apache-beam 2.25.0 requires pyarrow<0.18.0,>=0.15.1
# but google-cloud-bigquery>=2.10.0 requires pyarrow>=3
google-cloud-bigquery<2.10
google-cloud-core>==1.4.1
google-cloud-dataflow
google-cloud-datastore>==1.15
google-cloud-storage==1.38.0
iminuit==1.4.9
matplotlib==3.1.1
# older pyarrow versions require numpy<1.20 to successfully convert datatypes
# gcp_utils needs this to load a pandas dataframe to bigquery
# this is a numpy bug: https://github.com/numpy/numpy/issues/17913
numpy==1.19.5
pandas==0.24.2
[...]
sncosmo==2.2.0
[...]

Why does the night_conductor need sncosmo?

Plus two in docs/source/working-notes/troyraen which we can ignore.

troyraen commented 6 months ago

Thanks for posting these. broker/night_conductor/requirements.txt definitely looks bloated. Looks more like past-me just copy/pasted some other requirements.txt file I was using and never cleaned it up. I can't think of any reason it should need sncosmo, and definitely not apache-beam[gcp].

troyraen commented 6 months ago

But, I recommend not spending any time on night_conductor w.r.t. this issue. It is troubled (it runs the metadata collector), but it works right now so I try not to touch it. If we are going to do any work on it, we should replace it rather than fix it. See #171.

wmwv commented 6 months ago

Ah, okay. Restrict this ticket to only things that need Cloud Functions (Cloud Run).

troyraen commented 6 months ago

Which is:

troyraen commented 6 months ago

FWIW, from my notes about the astropy pin, night_conductor requirements, etc.

pip3 install pgb-broker-utils==0.2.28 &> install_broker_utils_0.2.28.out
# this does not succeed
# astropy requires jinja2 which requires MarkupSafe.soft_unicode
# but this was removed in v2.1.0
# https://markupsafe.palletsprojects.com/en/2.1.x/changes/#version-2-1-0
troyraen commented 3 weeks ago

@hernandezc1 Is this complete? I think it is, just checking.