Skip to content
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
34 changes: 29 additions & 5 deletions datashader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,36 @@
from . import datatypes # noqa (API import)

# make pyct's example/data commands available if possible
from functools import partial
from functools import partial, wraps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's del wraps as we did with the others.



def _warn_pyct_deprecated(stacklevel=2):
import warnings

warnings.warn(
"The 'fetch_data()', 'copy_examples()', and 'examples()' functions are "
"deprecated since version 0.19 and will be removed in version 0.20. "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the release candidacy of datashader, I feel like 0.20 would be released at least 6 months after 0.19.

Seems like each minor release has been a year in between (ignoring 0.17.0, which did not correctly drop a Python version).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so do you suggest we remove it in 0.19.xx, and modify the message to that effect?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I suggest 0.20, and not 0.21. We would never drop something in a patch release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, the message is correct then. It says 0.20 already.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but still want to highlight it as we normally do two minor releases.

"For downloading sample datasets, use 'hvsampledata' instead. "
"For example: `hvsampledata.nyc_taxi_remote('pandas')`.",
category=FutureWarning,
stacklevel=stacklevel,
)


def _deprecated_pyct_wrapper(func):
"""Wrapper to add deprecation warning to pyct functions."""
@wraps(func) # noqa: F821
def wrapper(*args, **kwargs):
_warn_pyct_deprecated(stacklevel=3)
return func(*args, **kwargs)
return wrapper


try:
from pyct.cmd import copy_examples as _copy, fetch_data as _fetch, examples as _examples
copy_examples = partial(_copy,'datashader')
fetch_data = partial(_fetch,'datashader')
examples = partial(_examples,'datashader')
copy_examples = _deprecated_pyct_wrapper(partial(_copy, 'datashader'))
fetch_data = _deprecated_pyct_wrapper(partial(_fetch, 'datashader'))
examples = _deprecated_pyct_wrapper(partial(_examples, 'datashader'))
except ImportError:
def _missing_cmd(*args,**kw):
return("install pyct to enable this command (e.g. `conda install pyct or "
Expand All @@ -32,4 +56,4 @@ def _missing_cmd(*args,**kw):
def err():
raise ValueError(_missing_cmd())
fetch_data = copy_examples = examples = err
del partial, _examples, _copy, _fetch
del partial, wraps, _examples, _copy, _fetch
4 changes: 4 additions & 0 deletions datashader/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@


def main(args=None):
try:
import pyct.cmd
from . import _warn_pyct_deprecated
_warn_pyct_deprecated(stacklevel=3)
except ImportError:
import sys
from . import _missing_cmd
Expand Down
10 changes: 5 additions & 5 deletions examples/getting_started/1_Introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
"metadata": {},
"outputs": [],
"source": [
"import datashader as ds, pandas as pd, colorcet as cc\n",
"import datashader as ds, colorcet as cc\n",
"import hvsampledata as hvs\n",
"\n",
"df = pd.read_csv('../data/nyc_taxi.csv', usecols=['dropoff_x', 'dropoff_y'])\n",
"df = hvs.nyc_taxi_remote(\"pandas\", engine_kwargs={\"columns\": ['dropoff_x', 'dropoff_y']})\n",
"df.head()"
]
},
Expand All @@ -35,9 +36,8 @@
"metadata": {},
"source": [
":::{note}\n",
"The file `nyc_taxi.csv` used above is located at\n",
"[nyc_taxi.csv](https://github.com/holoviz/datashader/blob/main/examples/data/.data_stubs/nyc_taxi.csv) in the Datashader repository. When running this example, make sure the file is available locally and update the path accordingly.\n",
":::\n"
"The first time this cell is run, it will download the NYC taxi dataset (about 260MB).\n",
":::"
]
},
{
Expand Down
75 changes: 0 additions & 75 deletions examples/taxi_preprocessing_example.py

This file was deleted.

1 change: 1 addition & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ scikit-image = "*"
shapely = ">=2.0.0"
spatialpandas = "*"
streamz = "*"
hvsampledata = ">=0.1.5a3"

# =============================================
# =================== TESTS ===================
Expand Down
15 changes: 11 additions & 4 deletions scripts/download_data.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from contextlib import suppress

import pyct.cmd
from packaging.version import Version

pyct.cmd.fetch_data(name="data", path="examples", datasets="datasets.yml")
with suppress(ImportError):
import pyct.cmd

pyct.cmd.fetch_data(name="data", path="examples", datasets="datasets.yml")


with suppress(ImportError):
Expand All @@ -21,4 +22,10 @@

gds.get_path("geoda.natregimes")
gds.get_path("nybb")
gds.get_path('geoda health')
gds.get_path("geoda health")


with suppress(ImportError):
import hvsampledata as hvs

path = hvs.download("nyc_taxi_remote")
Loading