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

refactor: Remove direct pandas import #6476

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c6b7ea4
Hide direct pandas import
hoxbro Dec 13, 2024
344a8ba
moving day
hoxbro Dec 13, 2024
6205393
Update to gen_types
hoxbro Dec 13, 2024
6c599fb
Update relative imports
hoxbro Dec 13, 2024
9eda759
Update isinstance
hoxbro Dec 13, 2024
f12f3dc
Update other imports
hoxbro Dec 13, 2024
803c1db
Update comparison
hoxbro Dec 13, 2024
d8bb264
write todo for dimension type formatter
hoxbro Dec 13, 2024
dc063df
add pandas to blocklist import
hoxbro Dec 13, 2024
026810b
Merge branch 'main' into remove_direct_pandas
hoxbro Feb 21, 2025
af07d2f
fixes
hoxbro Feb 21, 2025
dee9c00
fix types import
hoxbro Feb 21, 2025
fb1e9c6
Global pd without direct import
hoxbro Feb 21, 2025
de4c5cc
Support having string key for Dimension.type_formatters
hoxbro Feb 21, 2025
bf0402e
Always have pandas defined as loaded (for now)
hoxbro Feb 21, 2025
601416e
add _lazy_module
hoxbro Feb 23, 2025
5e78338
Don't import for __version__ in _lazy_module
hoxbro Feb 23, 2025
f676395
Add bool to lazy_module
hoxbro Feb 23, 2025
d810980
Add repr and update __version__ to also use package name
hoxbro Feb 23, 2025
05ef59e
Update dir and bool
hoxbro Feb 23, 2025
b5119b6
Move ibis to _lazy_module
hoxbro Feb 23, 2025
5339803
Update module name vs package name
hoxbro Feb 23, 2025
d9cdecd
misc updates
hoxbro Feb 24, 2025
1159920
Add module_bool_check to _lazy_module
hoxbro Feb 24, 2025
ae61e77
Update streams.py
hoxbro Feb 24, 2025
22e6c12
Update pointer_types to gen_types
hoxbro Feb 24, 2025
98d307c
Use pd check
hoxbro Feb 24, 2025
8a8b967
rename compat to dependencies
hoxbro Feb 24, 2025
b899952
Rename to bool_via_sys_modules
hoxbro Mar 3, 2025
b5d8458
lazy module types
hoxbro Mar 3, 2025
18f4db4
deprecate lazy_isinstance
hoxbro Mar 3, 2025
fe84295
Merge branch 'main' into remove_direct_pandas
hoxbro Mar 3, 2025
f17f9f7
Add min version check
hoxbro Mar 10, 2025
880d7c7
Merge branch 'main' into remove_direct_pandas
hoxbro Mar 13, 2025
91fc64a
Merge branch 'main' into remove_direct_pandas
hoxbro Mar 13, 2025
63a5bf3
Merge branch 'main' into remove_direct_pandas
hoxbro Mar 14, 2025
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
Prev Previous commit
Next Next commit
Support having string key for Dimension.type_formatters
hoxbro committed Feb 21, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit de4c5cc41beb229e0b4c4461b9c6bcaabd7844ba
2 changes: 1 addition & 1 deletion holoviews/core/__init__.py
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
Dimension.type_formatters[np.datetime64] = '%Y-%m-%d %H:%M:%S'
Dimension.type_formatters[datetime] = '%Y-%m-%d %H:%M:%S'
Dimension.type_formatters[date] = '%Y-%m-%d'
# Dimension.type_formatters['pandas.Timestamp'] = "%Y-%m-%d %H:%M:%S" # TODO: Implement this
Dimension.type_formatters['pandas._libs.tslibs.timestamps.Timestamp'] = "%Y-%m-%d %H:%M:%S"


def public(obj):
10 changes: 9 additions & 1 deletion holoviews/core/dimension.py
Original file line number Diff line number Diff line change
@@ -405,6 +405,14 @@ def pprint(self):
kws = ", ".join(f'{k}={changed[k]!r}' for k in ordering if k != 'name')
return f'Dimension({self.name!r}, {kws})'

def _get_type_formatters(self, own_type):
if own_type in self.type_formatters:
return self.type_formatters[own_type]

own_type_str = f"{own_type.__module__}.{own_type.__qualname__}"
for otype, formatter in self.type_formatters.items():
if otype == own_type_str:
return formatter

def pprint_value(self, value, print_unit=False):
"""Applies the applicable formatter to the value.
@@ -420,7 +428,7 @@ def pprint_value(self, value, print_unit=False):
"""
own_type = type(value) if self.type is None else self.type
formatter = (self.value_format if self.value_format
else self.type_formatters.get(own_type))
else self._get_type_formatters(own_type))
if formatter:
if callable(formatter):
formatted_value = formatter(value)

Unchanged files with check annotations Beta

{

Check failure on line 1 in examples/user_guide/05-Dimensioned_Containers.ipynb

GitHub Actions / unit:test-313:macos-latest

examples/user_guide/05-Dimensioned_Containers.ipynb::Cell 9 Notebook cell execution failed Cell 9: Cell execution caused an exception Input: ds = grid.collapse() ds.data.head() Traceback: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[1], line 2 1 ds = grid.collapse() ----> 2 ds.data.head() AttributeError: 'collections.OrderedDict' object has no attribute 'head'

Check failure on line 1 in examples/user_guide/05-Dimensioned_Containers.ipynb

GitHub Actions / unit:test-313:ubuntu-latest

examples/user_guide/05-Dimensioned_Containers.ipynb::Cell 9 Notebook cell execution failed Cell 9: Cell execution caused an exception Input: ds = grid.collapse() ds.data.head() Traceback: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[1], line 2 1 ds = grid.collapse() ----> 2 ds.data.head() AttributeError: 'collections.OrderedDict' object has no attribute 'head'
"cells": [
{
"cell_type": "markdown",