How to use conda_install method in pandera

Best Python code snippet using pandera_python

runtimes.py

Source:runtimes.py Github

copy

Full Screen

1import os2import hashlib3CONDA_DEFAULT_LIST = ["tblib", 4 "numpy", 5 "pytest", 6 "Click", 7 "numba", 8 "boto3", 9 "PyYAML", 10 'six',11 "cython", 'future']12PIP_DEFAULT_LIST = ['glob2', 'boto', 'certifi']13PIP_DEFAULT_UPGRADE_LIST = ['cloudpickle', 'enum34']14CONDA_ML_SET = ['scipy', 'pillow', 'cvxopt', 'scikit-learn']15PIP_ML_SET = ['cvxpy', 'redis']16CONDA_OPT_SET = ['scipy', 'cvxopt', ('mosek', 'mosek')]17PIP_OPT_SET = ['cvxpy' ]18RUNTIMES = {'minimal' : {'pythonvers' : ["2.7", "3.5", "3.6"], 19 'packages' : { 20 'conda_install' : CONDA_DEFAULT_LIST, 21 'pip_install' : PIP_DEFAULT_LIST, 22 'pip_upgrade' : PIP_DEFAULT_UPGRADE_LIST}},23 'ml' : {'pythonvers' : ["2.7", "3.5", "3.6"],24 'packages' : {25 'conda_install' : CONDA_DEFAULT_LIST + CONDA_ML_SET, 26 'pip_install' : PIP_DEFAULT_LIST + PIP_ML_SET, 27 'pip_upgrade' : PIP_DEFAULT_UPGRADE_LIST }},28 'default' : {'pythonvers' : ["2.7", "3.5", "3.6"], 29 'packages' : {30 'conda_install' : CONDA_DEFAULT_LIST + CONDA_ML_SET, 31 'pip_install' : PIP_DEFAULT_LIST + PIP_ML_SET, 32 'pip_upgrade' : PIP_DEFAULT_UPGRADE_LIST}}, 33 'opt' : {'pythonvers' : ["2.7"], 34 'packages' : {35 'conda_install' : CONDA_DEFAULT_LIST + CONDA_OPT_SET, 36 'pip_install' : PIP_DEFAULT_LIST + PIP_OPT_SET, 37 'pip_upgrade' : PIP_DEFAULT_UPGRADE_LIST }}38}39CONDA_TEST_STRS = {'numpy' : "__import__('numpy')", 40 'pytest' : "__import__('pytest')", 41 "numba" : "__import__('numba')", 42 "boto3" : "__import__('boto3')", 43 "PyYAML" : "__import__('yaml')", 44 "boto" : "__import__('boto')", 45 "scipy" : "__import__('scipy')", 46 "pillow" : "__import__('PIL.Image')", 47 "cvxopt" : "__import__('cvxopt')", 48 "scikit-image" : "__import__('skimage')", 49 "scikit-learn" : "__import__('sklearn')"}50PIP_TEST_STRS = {"glob2" : "__import__('glob2')", 51 "cvxpy" : "__import__('cvxpy')", 52 "redis" : "__import__('redis')", 53 "certifi": "__import__('certifi')"}54S3_BUCKET = "s3://ericmjonas-public"55S3URL_STAGING_BASE = S3_BUCKET + "/pywren.runtime.staging"56S3URL_BASE = S3_BUCKET + "/pywren.runtime"57def get_staged_runtime_url(runtime_name, runtime_python_version):58 s3url = "{}/pywren_runtime-{}-{}".format(S3URL_STAGING_BASE, 59 runtime_python_version, runtime_name)60 return s3url + ".tar.gz", s3url + ".meta.json"61def get_runtime_url_from_staging(staging_url):62 s3_url_base, s3_filename = os.path.split(staging_url)63 release_url = "{}/{}".format(S3URL_BASE, s3_filename)64 return release_url65def hash_s3_key(s):66 """67 MD5-hash the contents of an S3 key to enable good partitioning.68 used for sharding the runtimes69 """70 DIGEST_LEN = 671 m = hashlib.md5()72 m.update(s.encode('ascii'))73 digest = m.hexdigest()74 return "{}-{}".format(digest[:DIGEST_LEN], s)75def get_s3_shard(key, shard_num):76 return "{}.{:04d}".format(key, shard_num)77def split_s3_url(s3_url):78 if s3_url[:5] != "s3://":79 raise ValueError("URL {} is not valid".format(s3_url))80 splits = s3_url[5:].split("/")81 bucket_name = splits[0]82 key = "/".join(splits[1:])...

Full Screen

Full Screen

noxfile.py

Source:noxfile.py Github

copy

Full Screen

...3nox.options.sessions = "black", "lint", "mypy"4ADSODIR = ".adso_test"5py_version = ["3.9", "3.8", "3.7"]6def install_this(session):7 session.conda_install("mamba")8 if session.python:9 with open(f"{session.virtualenv.location}/conda-meta/pinned", "w") as f:10 f.write(f"python={session.python}.*")11 session.run(12 "mamba",13 "env",14 "update",15 "--file",16 "environment.yml",17 "--prefix",18 f"{session.virtualenv.location}",19 )20 session.install(".")21@nox.session()22def black(session):23 args = session.posargs or locations24 session.install("black")25 session.run("black", "--exclude", "src/vendor/*", *args)26@nox.session()27def lint(session):28 args = session.posargs or locations29 session.install(30 "flake8",31 "flake8-annotations",32 "flake8-bandit",33 "flake8-black",34 "flake8-bugbear",35 "flake8-docstrings",36 "flake8-import-order",37 "darglint",38 )39 session.run("flake8", *args)40@nox.session(venv_backend="conda")41def mypy(session):42 args = session.posargs or locations43 install_this(session)44 session.conda_install("mypy")45 session.run("python", "-m", "pip", "install", "types-requests")46 session.run("mypy", *args)47@nox.session(python=py_version, venv_backend="conda")48def xdoctest(session):49 args = session.posargs or ["all"]50 install_this(session)51 session.conda_install("xdoctest")52 session.run("python", "-m", "xdoctest", "adso", *args)53@nox.session(venv_backend="conda")54def cov(session):55 install_this(session)56 session.conda_install("coverage", "pytest", "pytest-cov")57 session.run("rm", "-rf", ADSODIR, external=True)58 session.run("rm", "-rf", ".test", external=True)59 session.run(60 "pytest",61 "--cov-config",62 ".coveragerc",63 "--cov-report",64 "html:coverage",65 "--cov-report",66 "term",67 "--cov",68 "adso",69 "-v",70 "--durations=0",71 env={"ADSODIR": ADSODIR},72 )73@nox.session(venv_backend="conda")74def coverage(session):75 install_this(session)76 session.conda_install("coverage", "codecov", "pytest-cov")77 session.run("rm", "-rf", ADSODIR, external=True)78 session.run("rm", "-rf", ".test", external=True)79 session.run(80 "pytest",81 "--cov-config",82 ".coveragerc",83 "--cov",84 "adso",85 env={"ADSODIR": ADSODIR},86 )87 session.run("coverage", "xml", "--fail-under=0")88 session.run("codecov", *session.posargs)89@nox.session(python=py_version, venv_backend="conda")90def test(session):91 install_this(session)92 session.conda_install("pytest")93 session.run("rm", "-rf", ADSODIR, external=True)94 session.run("rm", "-rf", ".test", external=True)95 session.run("pytest", env={"ADSODIR": ADSODIR})96@nox.session(python=py_version)97def pip_test(session):98 session.install("pytest")99 session.install(".")100 session.run("rm", "-rf", ADSODIR, external=True)101 session.run("rm", "-rf", ".test", external=True)102 session.run(103 "pytest",104 "--ignore=tests/test_06_LDAGS.py",105 "--ignore=tests/test_09_TM.py",106 "--ignore=tests/test_10_hSBM.py",107 "--ignore=tests/test_12_UMAP_HDBSCAN.py",108 env={"ADSODIR": ADSODIR},109 )110@nox.session(venv_backend="conda")111def docs(session):112 install_this(session)113 session.conda_install("sphinx", "sphinx-autodoc-typehints", "sphinx-gallery")114 session.run("sphinx-build", "-b", "html", "docs/_source", "docs")115 session.run("sphinx-build", "-M", "latexpdf", "docs/_source", "docs/_latex")...

Full Screen

Full Screen

pythoninstall.py

Source:pythoninstall.py Github

copy

Full Screen

1import sys2import importlib3import importlib.util4import argparse5parser = argparse.ArgumentParser()6parser.add_argument("--gpu", help="install nvidia gpu support", action="store_true", default=False)7args, unknown = parser.parse_known_args()89if importlib.util.find_spec("conda") is None:10 print("Error: A Conda environment is required to install the required packages.", file=sys.stderr)11 exit()1213import conda.cli.python_api as Conda1415# datasets(+huggingface_hub) required by hugging face hub16# scipy required by torchvision: Caltech ImageNet SBD SVHN datasets and Inception v3 GoogLeNet models17# pandas required by the dataset tutorial: https://pytorch.org/tutorials/beginner/data_loading_tutorial.html18# matplotlib-base required by torchstudio renderers19# python-graphviz required by torchstudio graph20# paramiko required for ssh connections21# pysoundfile required on windows by torchaudio: https://pytorch.org/audio/stable/backend.html#soundfile-backend22if sys.platform.startswith('win'):23 if args.gpu:24 conda_install="pytorch torchvision torchaudio cudatoolkit=11.3 datasets scipy pandas matplotlib-base python-graphviz paramiko pysoundfile"25 else:26 conda_install="pytorch torchvision torchaudio cpuonly datasets scipy pandas matplotlib-base python-graphviz paramiko pysoundfile"27elif sys.platform.startswith('darwin'):28 # force a pytorch/mkl version, because pytorch 1.10.2+ depends on mkl 2022 which is incompatible with Rosetta 2 in M1 macs, and update cffi 1.15.0-py39hc55c11b_1 to 1.15.0-py39he338e87_0+ to avoid paramiko error29 conda_install="pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 mkl==2021.4.0 datasets scipy pandas matplotlib-base python-graphviz paramiko cffi"30elif sys.platform.startswith('linux'):31 if args.gpu:32 conda_install="pytorch torchvision torchaudio cudatoolkit=11.3 datasets scipy pandas matplotlib-base python-graphviz paramiko"33 else:34 conda_install="pytorch torchvision torchaudio cpuonly datasets scipy pandas matplotlib-base python-graphviz paramiko"35else:36 print("Error: Unsupported platform.", file=sys.stderr)37 print("Windows, macOS or Linux is required.", file=sys.stderr)38 exit()3940print("Downloading and installing PyTorch and additional packages:")41print(conda_install)42print("")4344# channels: pytorch for pytorch torchvision torchaudio, nvidia for cudatoolkit=11.1 on Linux, huggingface for datasets(+huggingface_hub), conda-forge for everything else except anaconda for python-graphviz45conda_install+=" -c pytorch -c nvidia -c huggingface -c conda-forge -c anaconda"4647# https://stackoverflow.com/questions/41767340/using-conda-install-within-a-python-script ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pandera automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful