-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from kbaseapps/PUBLIC-2591_python_312_update
PUBLIC-2591: Python 3.12 update
- Loading branch information
Showing
6 changed files
with
58 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
FROM kbase/sdkpython:3.8.10 | ||
FROM python:3.12-bookworm | ||
LABEL maintainer="KBase Developers [[email protected]]" | ||
|
||
WORKDIR /kb/module | ||
# Update | ||
RUN apt-get update \ | ||
&& apt-get upgrade -y && \ | ||
update-ca-certificates && \ | ||
apt-get -y install xvfb curl && \ | ||
# these are all needed by PyQt5 | ||
apt-get -y install libdbus-1-3 libxcb-keysyms1 libxcb-image0 libxkbcommon-x11-0 libxkbcommon0 libxcb-icccm4 libxcb-image0 libxcb-render-util0 libxcb-shape0 libxcb-xinerama0 && \ | ||
apt-get clean && \ | ||
# Install FastTree | ||
mkdir -p /kb/module/FastTree/bin && \ | ||
cd /kb/module/FastTree/bin && \ | ||
curl -o FastTree http://www.microbesonline.org/fasttree/FastTree && \ | ||
chmod 555 FastTree && \ | ||
pip install --upgrade pip && \ | ||
# install the python requirements | ||
# Note: You must use PyQt5==5.11.3 on debian | ||
pip install ete3==3.1.2 PyQt5==5.11.3 numpy==1.23.1 pytest coverage pytest-cov vcrpy | ||
pip install --upgrade pip | ||
|
||
COPY ./ /kb/module | ||
|
||
RUN mkdir -p /kb/module/work && \ | ||
# install the python requirements | ||
RUN pip install -r requirements.txt && \ | ||
mkdir -p /kb/module/work && \ | ||
chmod -R a+rw /kb/module && \ | ||
mv /kb/module/compile_report.json /kb/module/work/compile_report.json | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
coverage==7.6.1 | ||
ete3==3.1.3 | ||
jinja2==3.1.4 | ||
jsonrpcbase==0.2.0 | ||
numpy==2.0.1 | ||
PyQt5==5.15.11 | ||
pytest==8.3.2 | ||
pytest-cov==5.0.0 | ||
pytest-recording==0.13.2 | ||
requests==2.32.3 | ||
ruff==0.5.7 | ||
six==1.16.0 | ||
vcrpy==6.0.1 | ||
uwsgi==2.0.26 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,44 @@ | ||
"""Generate the deployment config file.""" | ||
|
||
import os | ||
import os.path | ||
import sys | ||
from configparser import ConfigParser | ||
|
||
from jinja2 import Template | ||
from configparser import ConfigParser # py3 | ||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) != 3: | ||
print("Usage: <program> <deploy_cfg_template_file> <file_with_properties>") | ||
print("Properties from <file_with_properties> will be applied to <deploy_cfg_template_file>") | ||
print("template which will be overwritten with .orig copy saved in the same folder first.") | ||
if len(sys.argv) < 2 or len(sys.argv) > 3: | ||
print("Usage:\nprepare_deploy_config.py <deploy_cfg_template_file> <file_with_properties>\nor:") # noqa: T201 | ||
print("KBASE_ENDPOINT=https://kbase.endpoint.url prepare_deploy_config.py <deploy_cfg_template_file>") # noqa: T201 | ||
print( # noqa: T201 | ||
"Properties from <file_with_properties> or the KBASE_ENDPOINT env var will be applied to <deploy_cfg_template_file>" | ||
) | ||
print("template which will be overwritten with .orig copy saved in the same folder first.") # noqa: T201 | ||
sys.exit(1) | ||
file = open(sys.argv[1], 'r') | ||
text = file.read() | ||
|
||
with open(sys.argv[1]) as file: | ||
text = file.read() | ||
t = Template(text) | ||
config = ConfigParser() | ||
config.read(sys.argv[2]) | ||
|
||
if os.path.isfile(sys.argv[2]): | ||
config.read(sys.argv[2]) | ||
elif "KBASE_ENDPOINT" in os.environ: | ||
kbase_endpoint = os.environ.get("KBASE_ENDPOINT") | ||
props = f"[global]\nkbase_endpoint = {kbase_endpoint}\n" | ||
for key in os.environ: | ||
if key.startswith("KBASE_SECURE_CONFIG_PARAM_"): | ||
param_name = key[len("KBASE_SECURE_CONFIG_PARAM_") :] | ||
props += f"{param_name} = {os.environ.get(key)}\n" | ||
config.read_string(props) | ||
else: | ||
err_msg = f"Neither {sys.argv[2]} file nor KBASE_ENDPOINT env var found" | ||
raise ValueError(err_msg) | ||
|
||
props = dict(config.items("global")) | ||
output = t.render(props) | ||
with open(sys.argv[1] + ".orig", 'w') as f: | ||
with open(sys.argv[1] + ".orig", "w") as f: | ||
f.write(text) | ||
with open(sys.argv[1], 'w') as f: | ||
with open(sys.argv[1], "w") as f: | ||
f.write(output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters