Skip to content

Commit

Permalink
chore: Update dependencies in setup.py to include sqlalchemy for data…
Browse files Browse the repository at this point in the history
…base functionality
  • Loading branch information
Alex Al-Saffar committed Sep 2, 2024
1 parent e2b65aa commit 6dcd865
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
7 changes: 4 additions & 3 deletions myresources/crocodile/comms/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,16 @@ def send_and_close(config_name: Optional[str], to: str, subject: str, body: str)
"""If config_name is None, it sends from a generic email address."""
if config_name is None:
config = Email.get_source_of_truth()
_resend = install_n_import("resend")
import resend
try:
resend.api_key = config['resend']['api_key']
api_key = config['resend']['api_key']
to = config["resend"]["signup_email"]
except KeyError as ke:
msggg = "You did not pass a config_name, therefore, the default is to use resend, however, you need to add your resend api key to the emails.ini file."
raise KeyError(msggg) from ke

_resend = install_n_import("resend")
import resend # type: ignore
resend.api_key = api_key
r = resend.Emails.send({
"from": "onboarding@resend.dev",
"to": to,
Expand Down
9 changes: 9 additions & 0 deletions myresources/crocodile/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ def randstr(length: int = 10, lower: bool = True, upper: bool = True, digits: bo
import random
population = (string.ascii_lowercase if lower else "") + (string.ascii_uppercase if upper else "") + (string.digits if digits else "") + (string.punctuation if punctuation else "")
return ''.join(random.choices(population, k=length))
def run_in_isolated_ve(package_name: str, pyscript: str) -> str:
ve_name = randstr()
cmd = f"uv venv $HOME/venvs/tmp/{ve_name} --python 3.11; source $HOME/venvs/tmp/{ve_name}/bin/activate; uv pip install {package_name}"
import subprocess
subprocess.run(cmd, shell=True, check=True)
script_path = Path.home().joinpath("tmp_results/tmp_scripts/python").joinpath(ve_name + f"_script_{randstr()}.py")
script_path.write_text(pyscript, encoding='utf-8')
fire_script = f"source $HOME/venvs/tmp/{ve_name}/bin/activate; python {script_path}"
return fire_script


def save_decorator(ext: str = ""): # apply default paths, add extension to path, print the saved file path
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"paramiko", # for SSH
"requests", # interacting with web
"colorlog", # for colored logging

"sqlalchemy", # for database
]


Expand Down Expand Up @@ -106,9 +106,9 @@
install_requires=install_requires,

extras_require={
'full': ['sqlalchemy', 'tensorflow',
# 'torch',
'scikit-learn', 'dash', 'dash_daq', 'dash_bootstrap_components',
'full': ['tensorflow',
'torch', "keras",
'scikit-learn', # 'dash', 'dash_daq', 'dash_bootstrap_components',
'click',
'types-requests', 'types-paramiko', 'types-tqdm',
'setuptools', 'wheel', 'twine']
Expand Down

0 comments on commit 6dcd865

Please sign in to comment.