Skip to content
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

[CIVIS-1555] python patch update #83

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ ENV LANG=en_US.UTF-8 \
BASH_ENV=/etc/profile \
PATH=/opt/conda/bin:$PATH \
CIVIS_MINICONDA_VERSION=4.5.12 \
CIVIS_CONDA_VERSION=4.8.1 \
CIVIS_PYTHON_VERSION=3.7.6
CIVIS_CONDA_VERSION=4.8.5 \
CIVIS_PYTHON_VERSION=3.7.11

# Conda install.
#
Expand Down
40 changes: 20 additions & 20 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
name: datascience
channels:
- defaults
- conda-forge
dependencies:
- awscli=1.17.15
- awscli=1.17.17
- beautifulsoup4=4.8.2
- botocore=1.14.15
- botocore=1.14.17
- boto=2.49.0
- boto3=1.11.15
- bqplot=0.12.3
- boto3=1.11.17
- bqplot=0.12.31
- click=6.7
- cloudpickle=1.2.2
- cython=0.29.15
- cython=0.29.24
- dask=2.10.1
- feather-format=0.4.0
- feather-format=0.4.1
- glmnet=2.1.1
- ipython=7.12.0
- ipywidgets=7.5.1
- jinja2=2.11.1
- jinja2=2.11.3
- joblib=0.14.1
- jsonschema=3.2.0
- jupyter=1.0.0
Expand All @@ -29,33 +28,34 @@ dependencies:
- nomkl=3.0
- notebook=6.0.3
- nose=1.3.7
- numexpr=2.7.1
- numpy=1.17.3
- numexpr=2.7.3
- numpy=1.17.5
- openblas=0.3.6
- pandas=0.25.3
- patsy=0.5.1
- patsy=0.5.2
- pip=20.0.2
- psycopg2=2.8.4
- psycopg2=2.8.6
- pyarrow=0.16.0
- pycrypto=2.6.1
- pytest=5.3.5
- python=3.7.6
- python=3.7.11
- pyyaml=5.2
- requests=2.22.0
- s3fs=0.4.0
- seaborn=0.10.0
- s3fs=0.4.2
- seaborn=0.10.1
- scipy=1.4.1
- scikit-learn=0.22.1
- statsmodels=0.11.0
- urllib3=1.25.7
- scikit-learn=0.22.2.post1
- statsmodels=0.11.1
- urllib3=1.25.11
- xgboost=0.81
- pip:
- civis==1.15.1
- civisml-extensions==0.2.1
- dropbox==9.4.0
- ftputil==3.4
- muffnn==2.3.1
- muffnn==2.3.2
- pubnub==4.3.0
- pysftp==0.2.9
- requests-toolbelt==0.9.1
- tensorflow==1.15.4
- tensorflow==1.15.5
name: datascience
46 changes: 46 additions & 0 deletions upgrade_env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import json
import yaml
from urllib.request import urlopen
from urllib.error import HTTPError
import packaging.version

def newest_patch_version(package_name, version):
version = packaging.version.parse(version)
url = "https://pypi.org/pypi/%s/json" % (package_name,)
try:
data = json.load(urlopen(url))
versions = [packaging.version.parse(r) for r in data["releases"].keys()]
versions.sort(reverse=True)
return [v for v in versions
if not isinstance(v, packaging.version.LegacyVersion) and
version.major == v.major and
version.minor == v.minor][0]
except (HTTPError, IndexError) as e:
print(f"Error: {e}")
return version

env = yaml.safe_load(open('environment.yml', 'r'))
new_dependencies = []
for package in env['dependencies']:
if isinstance(package, dict):
new_pip = []
for pkg in package['pip']:
name, version = pkg.split('==')
print(name)
print(version)
new_version = newest_patch_version(name, version)
print(new_version)
new_pip.append(f'{name}=={new_version}')
new_dependencies.append({'pip': new_pip})
continue
print(package)
name, version = package.split('=')
print(name)
print(version)
new_version = newest_patch_version(name, version)
print(new_version)
new_dependencies.append(f'{name}={new_version}')

env['dependencies'] = new_dependencies
with open('environment.yml', 'w') as f:
yaml.dump(env, f)