Skip to content

Commit

Permalink
Merge pull request #56 from civisanalytics/civis-6238
Browse files Browse the repository at this point in the history
[CIVIS-6238] Update requirements.txt to require notebook versions < 7.0
  • Loading branch information
mjziolko committed Aug 23, 2023
2 parents c83aeac + bb7a337 commit 450943e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"]
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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, 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

### Added
Expand Down
8 changes: 4 additions & 4 deletions civis_jupyter_notebooks/platform_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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')


Expand All @@ -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')


Expand Down
2 changes: 1 addition & 1 deletion civis_jupyter_notebooks/tests/test_platform_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
url="https://www.civisanalytics.com",
Expand Down

0 comments on commit 450943e

Please sign in to comment.