From 44a5f2e5cee81ffb61bea50fa23da62bcf653ac7 Mon Sep 17 00:00:00 2001 From: mjziolko Date: Tue, 22 Aug 2023 11:02:09 -0500 Subject: [PATCH 1/5] [CIVIS-6238] Update requirements.txt to require notebook versions < 7.0 --- CHANGELOG.md | 5 +++++ civis_jupyter_notebooks/platform_persistence.py | 8 ++++---- requirements.txt | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b29f9e..fb11399 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased +## [2.1.1] - 2023-08-22 + +### Changed +- Updated to require notebook < 7.0 + ## [2.1.0] - 2022-04-25 ### Added diff --git a/civis_jupyter_notebooks/platform_persistence.py b/civis_jupyter_notebooks/platform_persistence.py index b9ee50b..eef5883 100644 --- a/civis_jupyter_notebooks/platform_persistence.py +++ b/civis_jupyter_notebooks/platform_persistence.py @@ -24,7 +24,7 @@ def initialize_notebook_from_platform(notebook_path): notebook_model = client.notebooks.get(os.environ['PLATFORM_OBJECT_ID']) logger.info('Pulling contents of notebook file from S3') - r = requests.get(notebook_model.notebook_url) + r = requests.get(notebook_model.notebook_url, timeout=60) if r.status_code != 200: raise NotebookManagementError('Failed to pull down notebook file from S3') notebook = nbformat.reads(r.content, nbformat.NO_CONVERT) @@ -53,7 +53,7 @@ def initialize_notebook_from_platform(notebook_path): def __pull_and_load_requirements(url, notebook_path): logger.info('Pulling down the requirements file') - r = requests.get(url) + r = requests.get(url, timeout=60) if r.status_code != 200: raise NotebookManagementError('Failed to pull down requirements.txt file from S3') @@ -117,7 +117,7 @@ def save_notebook(url, os_path): """ Push raw notebook to S3 """ with open(os_path, 'rb') as nb_file: logger.info('Pushing latest notebook file to S3') - requests.put(url, data=nb_file.read()) + requests.put(url, data=nb_file.read(), timeout=60) logger.info('Notebook file updated') @@ -133,7 +133,7 @@ def generate_and_save_preview(url, os_path): preview_path = os.path.splitext(os_path)[0] + '.html' with open(preview_path, 'rb') as preview_file: logger.info('Pushing latest notebook preview to S3') - requests.put(url, data=preview_file.read()) + requests.put(url, data=preview_file.read(), timeout=60) logger.info('Notebook preview updated') diff --git a/requirements.txt b/requirements.txt index ec2ec06..d4b7844 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ civis>=1.9 requests>=2.18 click>=6.7 jupyter-core>=4.6.0 -notebook>=6.4.1 +notebook>=6.4.1,<7.0 tornado>=6.1.0 civis-jupyter-extensions>=1.1.0 GitPython>=2.1 From e883bec8fb0b1845c1a38d8a74932e26227bad74 Mon Sep 17 00:00:00 2001 From: mjziolko Date: Tue, 22 Aug 2023 11:33:09 -0500 Subject: [PATCH 2/5] fix tests --- civis_jupyter_notebooks/tests/test_platform_persistence.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/civis_jupyter_notebooks/tests/test_platform_persistence.py b/civis_jupyter_notebooks/tests/test_platform_persistence.py index 1393b48..aece115 100644 --- a/civis_jupyter_notebooks/tests/test_platform_persistence.py +++ b/civis_jupyter_notebooks/tests/test_platform_persistence.py @@ -48,7 +48,7 @@ def test_initialize_notebook_will_pull_nb_from_url(self, rg, _client, requiremen platform_persistence.get_client().notebooks.get.return_value.notebook_url = url platform_persistence.get_client().notebooks.get.return_value.requirements_url = None platform_persistence.initialize_notebook_from_platform(TEST_NOTEBOOK_PATH) - rg.assert_called_with(url) + rg.assert_called_with(url, timeout=60) requirements.assert_not_called() @patch('os.makedirs') diff --git a/setup.py b/setup.py index 8e63a16..355ba7b 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ def read(fname): setup( name="civis-jupyter-notebook", - version="2.1.0", + version="2.1.1", author="Civis Analytics Inc", author_email="opensource@civisanalytics.com", url="https://www.civisanalytics.com", From 6f2f82821f9229ccd812b17ba1c966262598da9c Mon Sep 17 00:00:00 2001 From: mjziolko Date: Tue, 22 Aug 2023 11:39:02 -0500 Subject: [PATCH 3/5] Drop python 3.7 tests, add python 3.11 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 84ab1d0..169a33c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -95,4 +95,4 @@ workflows: - bandit matrix: parameters: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11"] From 145be2ecebc2aea8918c2d8f29464a02f09d5e46 Mon Sep 17 00:00:00 2001 From: mjziolko Date: Tue, 22 Aug 2023 11:41:54 -0500 Subject: [PATCH 4/5] bump circle from python 3.10 to 3.11 --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 169a33c..3d79471 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ jobs: type: string docker: # Pick the highest Python 3.x version that this project is known to support - - image: cimg/python:3.10 + - image: cimg/python:3.11 steps: - checkout - run: @@ -53,7 +53,7 @@ jobs: name: Test Docker image build working_directory: ~/project/ command: | - if [ << parameters.python-version >> = 3.10 ] + if [ << parameters.python-version >> = 3.11 ] then ./tests/run_docker_tests.sh tests/Dockerfile fi From bb7a33754f9638bd03d6d6ea06e77f7a388190a6 Mon Sep 17 00:00:00 2001 From: mjziolko Date: Tue, 22 Aug 2023 14:19:09 -0500 Subject: [PATCH 5/5] Add clarification to changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb11399..ff7d89c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [2.1.1] - 2023-08-22 ### Changed -- Updated to require notebook < 7.0 +- Updated to require notebook < 7.0, as [jupiter-notebook 7.0](https://jupyter-notebook.readthedocs.io/en/stable/migrate_to_notebook7.html) introduced breaking changes. ## [2.1.0] - 2022-04-25