From 3ddf8d9aba07ee7c4e53ab032834505469c7cf67 Mon Sep 17 00:00:00 2001 From: Douwe Osinga Date: Thu, 7 Nov 2024 22:37:26 +0100 Subject: [PATCH] Fixes (#1) Co-authored-by: Douwe M Osinga --- README.md | 4 +- docker-compose.yml | 9 +- neptyne_kernel/neptyne_api/geo.py | 4 +- requirements.in | 37 ++++- requirements.txt | 246 ++++++++++++++++++++++++++---- 5 files changed, 258 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index b023c4d..ed15da8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The easiest way to get started is to use the docker image. This will give you a ```shell -docker-compose up --build +docker-compose up -d ``` @@ -39,7 +39,7 @@ pip install -r requirements.txt After which you can start neptyne with: ```shell -python server/application.py +PYTHONPATH=. python server/application.py ``` ## Using Neptyne with Google Sheets diff --git a/docker-compose.yml b/docker-compose.yml index f7a4aaf..57e1893 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,11 @@ version: '3.8' services: - app: - build: - context: . - dockerfile: Dockerfile + neptyne: + image: neptyne/neptyne:latest ports: - "8877:8877" volumes: - ./db:/db command: ["python", "server/application.py", "--sqlite-db", "/db/sqlite.db"] - neptyne: - image: neptyne/neptyne:latest + diff --git a/neptyne_kernel/neptyne_api/geo.py b/neptyne_kernel/neptyne_api/geo.py index 54ba4fe..f3044b4 100644 --- a/neptyne_kernel/neptyne_api/geo.py +++ b/neptyne_kernel/neptyne_api/geo.py @@ -2,7 +2,6 @@ from typing import Any, Callable import geopandas -import geoplot import numpy as np import pyproj from folium import GeoJson @@ -86,6 +85,8 @@ def dataset(name_or_url: str) -> GeoDataFrame: """Returns a sample dataset given a name or url. Named datasets are taken from geopandas.datasets, geoplot.datasets and geodatasets. + geoplot is not by default installed, so you need to set it up if you want to depend + on that. Example: =geo.dataset("naturalearth_lowres") @@ -97,6 +98,7 @@ def dataset(name_or_url: str) -> GeoDataFrame: if name_or_url in geopandas.datasets.available: path = geopandas.datasets.get_path(name_or_url) else: + import geoplot try: path = geoplot.datasets.get_path(name_or_url) except ValueError: diff --git a/requirements.in b/requirements.in index 591b3e5..62c8dc5 100644 --- a/requirements.in +++ b/requirements.in @@ -1,29 +1,55 @@ aiocontextvars alembic +altair anthropic appnope +bahttext beautifulsoup4 black +bokeh +calweek contextvars +croniter +db-dtypes +descartes +fastavro +feedparser # ** data.py fire +folium # ** geo.py gcloud-aio-storage -geopandas +geodatasets # ** geo.py +geopandas # ** geo.py +geopy google-api-python-client google-auth-httplib2 google-cloud-aiplatform +google-cloud-bigquery # ** data.py +google-cloud-bigquery-storage # ** data.py +google-generativeai +graphlib gspread gspread_asyncio gspread_formatting html2text +html5lib httpx +iexfinance # ** data.py ipykernel~=6.13.0 ipython~=8.3.0 isort +isoweek +jaconv +json-fix jupyter_client kaleido kubernetes_asyncio libcst +lxml # ** web.py lxml_html_clean +mapboxgl +mapclassify +markdown +matplotlib MonkeyType mypy nbformat @@ -55,17 +81,26 @@ pytest-snapshot pytest-timeout python-dateutil python-dotenv +pyxirr +pyxirr>=0.10.5 +qrcode readability-lxml requests +roman ruff scikit-learn +scipy +seaborn stack-data +statsmodels streamlit +streamlit>=1.36.0 tabulate tiktoken tokenize_rt tornado tornado-sqlalchemy +tweepy types-croniter types-Markdown types-paramiko diff --git a/requirements.txt b/requirements.txt index ef4f6ab..15e31f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,9 @@ aiosignal==1.2.0 alembic==1.11.1 # via -r requirements.in altair==4.2.0 - # via streamlit + # via + # -r requirements.in + # streamlit annotated-types==0.6.0 # via pydantic anthropic==0.30.0 @@ -43,18 +45,26 @@ backoff==2.2.1 # via # gcloud-aio-auth # posthog +bahttext==1.0.2 + # via -r requirements.in beautifulsoup4==4.11.1 # via -r requirements.in black==22.3.0 # via -r requirements.in blinker==1.7.0 # via streamlit +bokeh==3.6.1 + # via -r requirements.in +branca==0.8.0 + # via folium build==0.10.0 # via pip-tools cachetools==5.3.2 # via # google-auth # streamlit +calweek==0.5.0 + # via -r requirements.in certifi==2021.10.8 # via # fiona @@ -73,6 +83,8 @@ charset-normalizer==2.0.12 # via # aiohttp # requests +chroma-py==0.1.0.dev1 + # via mapboxgl click==8.1.3 # via # black @@ -85,20 +97,34 @@ click-plugins==1.1.1 # via fiona cligj==0.7.2 # via fiona +colour==0.1.5 + # via mapboxgl contextvars==2.4 # via -r requirements.in +contourpy==1.3.0 + # via + # bokeh + # matplotlib +croniter==5.0.1 + # via -r requirements.in cryptography==40.0.2 # via # gcloud-aio-auth # types-paramiko cssselect==1.2.0 # via readability-lxml +cycler==0.12.1 + # via matplotlib +db-dtypes==1.3.0 + # via -r requirements.in debugpy==1.6.0 # via ipykernel decorator==5.1.1 # via ipython deprecated==1.2.14 # via opentelemetry-api +descartes==1.1.0 + # via -r requirements.in distro==1.8.0 # via # anthropic @@ -107,14 +133,26 @@ entrypoints==0.4 # via altair et-xmlfile==1.1.0 # via openpyxl +exceptiongroup==1.2.2 + # via + # anyio + # pytest executing==0.8.3 # via stack-data +fastavro==1.9.7 + # via -r requirements.in fastjsonschema==2.19.1 # via nbformat +feedparser==6.0.11 + # via -r requirements.in fiona==1.9.5 # via geopandas fire==0.5.0 # via -r requirements.in +folium==0.18.0 + # via -r requirements.in +fonttools==4.54.1 + # via matplotlib frozenlist==1.3.3 # via # aiohttp @@ -123,42 +161,64 @@ gcloud-aio-auth==5.2.2 # via gcloud-aio-storage gcloud-aio-storage==9.0.0 # via -r requirements.in +geodatasets==2024.8.0 + # via -r requirements.in +geographiclib==2.0 + # via geopy +geojson==3.1.0 + # via mapboxgl geopandas==0.14.1 # via -r requirements.in +geopy==2.4.1 + # via -r requirements.in gitdb==4.0.11 # via gitpython gitpython==3.1.43 # via streamlit +google-ai-generativelanguage==0.6.10 + # via google-generativeai google-api-core==2.14.0 # via + # google-ai-generativelanguage # google-api-python-client # google-cloud-aiplatform # google-cloud-bigquery + # google-cloud-bigquery-storage # google-cloud-core # google-cloud-resource-manager # google-cloud-storage # google-cloud-trace + # google-generativeai google-api-python-client==2.108.0 - # via -r neptyne_kernel/requirements.in + # via + # -r requirements.in + # google-generativeai google-auth==2.23.4 # via + # google-ai-generativelanguage # google-api-core # google-api-python-client # google-auth-httplib2 # google-auth-oauthlib + # google-cloud-bigquery-storage # google-cloud-core # google-cloud-storage + # google-generativeai # gspread google-auth-httplib2==0.1.1 # via - # -r neptyne_kernel/requirements.in + # -r requirements.in # google-api-python-client google-auth-oauthlib==1.1.0 # via gspread google-cloud-aiplatform==1.36.0 # via -r requirements.in google-cloud-bigquery==3.16.0 - # via google-cloud-aiplatform + # via + # -r requirements.in + # google-cloud-aiplatform +google-cloud-bigquery-storage==2.27.0 + # via -r requirements.in google-cloud-core==2.4.1 # via # google-cloud-bigquery @@ -171,6 +231,8 @@ google-cloud-trace==1.11.1 # via opentelemetry-exporter-gcp-trace google-crc32c==1.5.0 # via google-resumable-media +google-generativeai==0.8.3 + # via -r requirements.in google-resumable-media==2.7.0 # via # google-cloud-bigquery @@ -180,6 +242,10 @@ googleapis-common-protos==1.61.0 # google-api-core # grpc-google-iam-v1 # grpcio-status +graphlib==0.9.5 + # via -r requirements.in +greenlet==3.1.1 + # via sqlalchemy grpc-google-iam-v1==0.12.6 # via google-cloud-resource-manager grpcio==1.60.0 @@ -203,6 +269,8 @@ h11==0.14.0 # via httpcore html2text==2024.2.26 # via -r requirements.in +html5lib==1.1 + # via -r requirements.in httpcore==0.17.2 # via httpx httplib2==0.22.0 @@ -211,7 +279,7 @@ httplib2==0.22.0 # google-auth-httplib2 httpx==0.24.1 # via - # -r neptyne_kernel/requirements.in + # -r requirements.in # anthropic # openai idna==3.3 @@ -220,6 +288,8 @@ idna==3.3 # httpx # requests # yarl +iexfinance==0.5.0 + # via -r requirements.in immutables==0.19 # via contextvars importlib-metadata==6.11.0 @@ -227,34 +297,40 @@ importlib-metadata==6.11.0 iniconfig==2.0.0 # via pytest ipykernel==6.13.0 - # via - # -r neptyne_kernel/requirements.in - # -r requirements.in + # via -r requirements.in ipython==8.3.0 # via - # -r neptyne_kernel/requirements.in # -r requirements.in # ipykernel isort==5.12.0 # via -r requirements.in +isoweek==1.3.3 + # via -r requirements.in +jaconv==0.4.0 + # via -r requirements.in jedi==0.18.1 # via ipython jinja2==3.1.2 # via # altair + # bokeh + # branca + # folium + # mapboxgl # pdoc # pydeck jiter==0.5.0 # via anthropic joblib==1.3.2 # via scikit-learn +json-fix==1.0.0 + # via -r requirements.in jsonschema==4.5.1 # via # altair # nbformat jupyter-client==8.2.0 # via - # -r neptyne_kernel/requirements.in # -r requirements.in # ipykernel jupyter-core==5.3.0 @@ -263,20 +339,29 @@ jupyter-core==5.3.0 # nbformat kaleido==0.2.1 # via -r requirements.in +kiwisolver==1.4.7 + # via matplotlib kubernetes-asyncio==24.2.3 # via -r requirements.in libcst==1.3.1 # via - # -r neptyne_kernel/requirements.in + # -r requirements.in # monkeytype lxml==4.9.2 # via + # -r requirements.in # lxml-html-clean # readability-lxml lxml-html-clean==0.2.2 # via -r requirements.in mako==1.2.4 # via alembic +mapboxgl==0.10.2 + # via -r requirements.in +mapclassify==2.8.1 + # via -r requirements.in +markdown==3.7 + # via -r requirements.in markdown-it-py==3.0.0 # via rich markupsafe==2.1.2 @@ -284,6 +369,12 @@ markupsafe==2.1.2 # jinja2 # mako # pdoc +matplotlib==3.9.2 + # via + # -r requirements.in + # descartes + # mapboxgl + # seaborn matplotlib-inline==0.1.3 # via # ipykernel @@ -308,24 +399,37 @@ mypy-extensions==1.0.0 # monkeytype # mypy nbformat==5.10.4 - # via -r neptyne_kernel/requirements.in + # via -r requirements.in nest-asyncio==1.5.5 # via ipykernel networkx==3.0 - # via -r requirements.in + # via + # -r requirements.in + # mapclassify numpy==1.24.2 # via - # -r neptyne_kernel/requirements.in + # -r requirements.in # altair + # bokeh + # contourpy + # db-dtypes + # folium + # mapclassify + # matplotlib # pandas + # patsy # pyarrow # pydeck # scikit-learn # scipy + # seaborn # shapely + # statsmodels # streamlit oauthlib==3.2.0 - # via requests-oauthlib + # via + # requests-oauthlib + # tweepy openai==1.30.1 # via -r requirements.in openpyxl==3.1.2 @@ -367,24 +471,37 @@ orjson==3.9.1 # via -r requirements.in packaging==23.0 # via + # bokeh # build + # db-dtypes # geopandas # google-cloud-aiplatform # google-cloud-bigquery # ipykernel + # matplotlib # opentelemetry-instrumentation-sqlalchemy + # pooch # pytest + # statsmodels # streamlit pandas==1.5.3 # via - # -r neptyne_kernel/requirements.in + # -r requirements.in # altair + # bokeh + # db-dtypes # geopandas + # iexfinance + # mapclassify + # seaborn + # statsmodels # streamlit parso==0.8.3 # via jedi pathspec==0.11.0 # via black +patsy==0.5.6 + # via statsmodels pdoc==14.4.0 # via -r requirements.in pexpect==4.8.0 @@ -393,7 +510,9 @@ pickleshare==0.7.5 # via ipython pillow==9.4.0 # via - # -r neptyne_kernel/requirements.in + # -r requirements.in + # bokeh + # matplotlib # streamlit pip==24.0 # via pip-tools @@ -403,25 +522,33 @@ platformdirs==3.0.0 # via # black # jupyter-core + # pooch plotly==5.8.0 - # via -r neptyne_kernel/requirements.in + # via -r requirements.in pluggy==1.0.0 # via pytest +pooch==1.8.2 + # via geodatasets posthog==3.5.0 # via -r requirements.in prompt-toolkit==3.0.29 # via ipython proto-plus==1.23.0 # via + # google-ai-generativelanguage # google-cloud-aiplatform + # google-cloud-bigquery-storage # google-cloud-resource-manager # google-cloud-trace protobuf==4.25.1 # via + # google-ai-generativelanguage # google-api-core # google-cloud-aiplatform + # google-cloud-bigquery-storage # google-cloud-resource-manager # google-cloud-trace + # google-generativeai # googleapis-common-protos # grpc-google-iam-v1 # grpcio-status @@ -436,7 +563,9 @@ ptyprocess==0.7.0 pure-eval==0.2.2 # via stack-data pyarrow==14.0.2 - # via streamlit + # via + # db-dtypes + # streamlit pyasn1==0.5.0 # via # pyasn1-modules @@ -450,28 +579,30 @@ pycparser==2.21 pydantic==2.4.2 # via # anthropic + # google-generativeai # openai pydantic-core==2.10.1 # via pydantic pydeck==0.8.0 # via - # -r neptyne_kernel/requirements.in + # -r requirements.in # streamlit pyflakes==2.5.0 - # via -r neptyne_kernel/requirements.in + # via -r requirements.in pygments==2.17.2 # via - # -r neptyne_kernel/requirements.in + # -r requirements.in # ipython # pdoc # rich pyjwt==2.7.0 # via - # -r neptyne_kernel/requirements.in # -r requirements.in # gcloud-aio-auth pyparsing==3.0.9 - # via httplib2 + # via + # httplib2 + # matplotlib pyproj==3.6.1 # via geopandas pyproject-hooks==1.0.0 @@ -496,21 +627,30 @@ pytest-timeout==2.1.0 python-dateutil==2.8.2 # via # -r requirements.in + # croniter # google-cloud-bigquery # jupyter-client # kubernetes-asyncio + # matplotlib # pandas # posthog python-dotenv==1.0.1 # via -r requirements.in pytz==2022.1 - # via pandas + # via + # croniter + # pandas +pyxirr==0.10.6 + # via -r requirements.in pyyaml==6.0.1 # via + # bokeh # kubernetes-asyncio # libcst pyzmq==25.0.0 # via jupyter-client +qrcode==8.0 + # via -r requirements.in readability-lxml==0.8.1 # via -r requirements.in regex==2023.6.3 @@ -518,19 +658,27 @@ regex==2023.6.3 requests==2.31.0 # via # -r requirements.in + # folium # google-api-core # google-cloud-bigquery # google-cloud-storage # gspread-asyncio + # iexfinance # opentelemetry-resourcedetector-gcp + # pooch # posthog # requests-oauthlib # streamlit # tiktoken + # tweepy requests-oauthlib==1.3.1 - # via google-auth-oauthlib + # via + # google-auth-oauthlib + # tweepy rich==13.7.1 # via streamlit +roman==4.2 + # via -r requirements.in rsa==4.9 # via # gcloud-aio-storage @@ -538,9 +686,17 @@ rsa==4.9 ruff==0.3.4 # via -r requirements.in scikit-learn==1.3.0 - # via -r requirements.in + # via + # -r requirements.in + # mapclassify scipy==1.10.1 - # via scikit-learn + # via + # -r requirements.in + # mapclassify + # scikit-learn + # statsmodels +seaborn==0.13.2 + # via -r requirements.in setuptools==70.1.1 # via # fiona @@ -548,6 +704,8 @@ setuptools==70.1.1 # kubernetes-asyncio # opentelemetry-instrumentation # pip-tools +sgmllib3k==1.0.0 + # via feedparser shapely==2.0.2 # via # geopandas @@ -557,7 +715,9 @@ six==1.16.0 # asttokens # fiona # fire + # html5lib # kubernetes-asyncio + # patsy # posthog # python-dateutil smmap==5.0.1 @@ -577,8 +737,10 @@ sqlalchemy==1.4.48 # tornado-sqlalchemy stack-data==0.2.0 # via - # -r neptyne_kernel/requirements.in + # -r requirements.in # ipython +statsmodels==0.14.4 + # via -r requirements.in streamlit==1.36.0 # via -r requirements.in tabulate==0.9.0 @@ -594,16 +756,25 @@ threadpoolctl==3.2.0 tiktoken==0.7.0 # via -r requirements.in tokenize-rt==5.0.0 - # via -r neptyne_kernel/requirements.in + # via -r requirements.in tokenizers==0.13.3 # via anthropic toml==0.10.2 # via streamlit +tomli==2.0.2 + # via + # black + # build + # mypy + # pip-tools + # pyproject-hooks + # pytest toolz==0.11.2 # via altair tornado==6.2 # via # -r requirements.in + # bokeh # ipykernel # jupyter-client # streamlit @@ -611,7 +782,9 @@ tornado==6.2 tornado-sqlalchemy==0.7.0 # via -r requirements.in tqdm==4.65.0 - # via openai + # via + # google-generativeai + # openai traitlets==5.9.0 # via # ipykernel @@ -620,6 +793,8 @@ traitlets==5.9.0 # jupyter-core # matplotlib-inline # nbformat +tweepy==4.14.0 + # via -r requirements.in types-croniter==2.0.0.20240106 # via -r requirements.in types-markdown==3.4.2.9 @@ -646,6 +821,7 @@ typing-extensions==4.8.0 # via # alembic # anthropic + # google-generativeai # mypy # openai # opentelemetry-resourcedetector-gcp @@ -654,7 +830,7 @@ typing-extensions==4.8.0 # pydantic-core # streamlit untokenize==0.1.1 - # via -r neptyne_kernel/requirements.in + # via -r requirements.in uritemplate==4.1.1 # via google-api-python-client urllib3==1.26.9 @@ -664,6 +840,8 @@ urllib3==1.26.9 # requests wcwidth==0.2.5 # via prompt-toolkit +webencodings==0.5.1 + # via html5lib wheel==0.40.0 # via pip-tools wrapt==1.15.0 @@ -671,6 +849,10 @@ wrapt==1.15.0 # deprecated # opentelemetry-instrumentation # opentelemetry-instrumentation-sqlalchemy +xyzservices==2024.9.0 + # via + # bokeh + # folium yarl==1.8.2 # via aiohttp zipp==3.18.1