Skip to content

Commit

Permalink
Merge pull request #30 from wildfish/chore/bump-plotly-js
Browse files Browse the repository at this point in the history
Chore/bump plotly js
  • Loading branch information
OmegaDroid authored Dec 9, 2024
2 parents 1159820 + 8cd60ab commit 70120bb
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 107 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ For an overview of what has changed between versions, see the :ref:`changelog`.

.. _changelog:

0.1.8 2024-10-08
-----------------

- Replaces vulnerable `plotly.min.js` `v2.12.1` with `v2.35.2` (https://github.com/wildfish/django-dashboards/issues/29)
- Fixed failing mypy checks

0.1.7 2023-12-14
-----------------

Expand Down
65 changes: 4 additions & 61 deletions dashboards/static/dashboards/vendor/js/plotly.min.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions demos/dashboard/demo/kitchensink/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class ScatterChartSerializer(ChartSerializer):
color: Optional[str] = None
mode: Optional[str] = "markers"

def get_x(self, df) -> str:
def get_x(self, df) -> str | None:
return self.x

def get_y(self, df) -> str:
def get_y(self, df) -> str | None:
return self.y

def get_size(self, df) -> str:
def get_size(self, df) -> str | None:
return self.size

def to_fig(self, df) -> go.Figure:
Expand All @@ -42,10 +42,10 @@ class BarChartSerializer(ChartSerializer):
color: Optional[str] = None
barmode: Optional[str] = "group"

def get_x(self, df) -> str:
def get_x(self, df) -> str | None:
return self.x

def get_y(self, df) -> str:
def get_y(self, df) -> str | None:
return self.y

def to_fig(self, df) -> go.Figure:
Expand Down
2 changes: 1 addition & 1 deletion demos/dashboard/demo/kitchensink/dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class DemoDashboard(Dashboard):
grid_css_classes=Grid.TWO.value,
)
stat_two = Stat(
value=StatData(text="88%", sub_text="decrease", change_by="12%"),
value=StatData(text="88%", sub_text="decrease", change_by_text="12%"),
icon="<i data-feather='users'></i>",
grid_css_classes=Grid.TWO.value,
)
Expand Down
2 changes: 1 addition & 1 deletion demos/dashboard/demo/kitchensink/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def as_view(cls, **initkwargs):
Needed prior to 4.1 for CBV
"""
view = super().as_view(**initkwargs)
view._is_coroutine = asyncio.coroutines._is_coroutine
view._is_coroutine = asyncio.coroutines._is_coroutine # type: ignore
return view

async def get(self, request: HttpRequest, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion demos/dashboard/demo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def CACHES(self):
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": f"redis://{self.REDIS_HOST}:{self.REDIS_PORT}/1",
"KEY_PREFIX": f"{self.PROJECT_ENVIRONMENT_SLUG}_",
"KEY_PREFIX": f"{self.PROJECT_ENVIRONMENT_SLUG}_", # type: ignore
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"PARSER_CLASS": "redis.connection.HiredisParser",
Expand Down
4 changes: 2 additions & 2 deletions demos/dashboard/demo/vehicle/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def fetch_service_count(request, **kwargs):

@staticmethod
def fetch_vehicle_details(*args, **kwargs):
vehicle = kwargs.get("object")
vehicle: Vehicle = kwargs.get("object") # type: ignore
return StatData(
text=dict_to_table(
{
Expand All @@ -92,7 +92,7 @@ def fetch_vehicle_details(*args, **kwargs):

@staticmethod
def fetch_last_route(*args, **kwargs):
vehicle = kwargs.get("object")
vehicle: Vehicle = kwargs.get("object") # type: ignore
locations = vehicle.get_locations_for_last_job()
lat_coords = [location.lat for location in locations]
lon_coords = [location.lon for location in locations]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class Command(BaseCommand):
def handle(self, *args, **options):
if Data.objects.count() == 0:
vehicles = baker.make("Vehicle", _quantity=5, _bulk_create=True)
vehicles = baker.make("Vehicle", _quantity=5, _bulk_create=True) # type: ignore
location_param, _ = Parameter.objects.get_or_create(
name="Current Location", cast_type=Parameter.CastType.COORDINATE
)
Expand Down
2 changes: 1 addition & 1 deletion demos/dashboard/demo/vehicle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ def convert(self):
Coord = namedtuple("Coord", ["lon", "lat"])
return Coord(lon=lon, lat=lat)
elif self.parameter.cast_type == "datetime":
return datetime.strptime(self.value, self.DT_FORMAT)
return datetime.strptime(self.value, self.DT_FORMAT) # type: ignore
2 changes: 1 addition & 1 deletion demos/dashboard/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ django-cors-headers==4.3.1
# via
# -r requirements.in
# django-dashboards
django-dashboards==0.1.7
django-dashboards==0.1.8
# via -r requirements.in
django-eventstream==4.5.1
# via -r requirements.in
Expand Down
2 changes: 1 addition & 1 deletion docs/docs_dj_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PROJECT_NAME = "docs"


ADMINS = []
ADMINS = [] # type: ignore


SECRET_KEY = "somesecretvalue"
Expand Down
1 change: 0 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ django-asset-definitions
# Charts
pandas
plotly
plotly_express

# Dev tools
Faker
Expand Down
36 changes: 7 additions & 29 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile
Expand Down Expand Up @@ -53,7 +53,9 @@ click-plugins==1.1.1
click-repl==0.3.0
# via celery
coverage[toml]==7.3.2
# via pytest-cov
# via
# coverage
# pytest-cov
decorator==5.1.1
# via
# ipdb
Expand Down Expand Up @@ -131,33 +133,20 @@ mypy-extensions==1.0.0
nodeenv==1.8.0
# via pre-commit
numpy==1.26.2
# via
# pandas
# patsy
# plotly-express
# scipy
# statsmodels
# via pandas
packaging==23.2
# via
# black
# build
# plotly
# pytest
# sphinx
# statsmodels
pandas==2.1.3
# via
# -r requirements.in
# plotly-express
# statsmodels
# via -r requirements.in
parso==0.8.3
# via jedi
pathspec==0.11.2
# via black
patsy==0.5.3
# via
# plotly-express
# statsmodels
pexpect==4.8.0
# via ipython
pip-tools==7.3.0
Expand All @@ -167,10 +156,6 @@ platformdirs==3.11.0
# black
# virtualenv
plotly==5.18.0
# via
# -r requirements.in
# plotly-express
plotly-express==0.4.1
# via -r requirements.in
pluggy==1.3.0
# via pytest
Expand Down Expand Up @@ -236,14 +221,9 @@ pyyaml==6.0.1
# via pre-commit
requests==2.31.0
# via sphinx
scipy==1.11.3
# via
# plotly-express
# statsmodels
six==1.16.0
# via
# asttokens
# patsy
# python-dateutil
snowballstemmer==2.2.0
# via sphinx
Expand Down Expand Up @@ -283,8 +263,6 @@ sqlparse==0.4.4
# via django
stack-data==0.6.3
# via ipython
statsmodels==0.14.0
# via plotly-express
syrupy==4.6.0
# via -r requirements.in
tenacity==8.2.3
Expand Down Expand Up @@ -325,4 +303,4 @@ wheel==0.41.3

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
# setuptools
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = django-dashboards
version = 0.1.7
version = 0.1.8
description = Tools for building data dashboards with Django
long_description = file: README.rst
url = https://github.com/wildfish/django-dashboards
Expand Down Expand Up @@ -34,7 +34,6 @@ install_requires =
django-asset-definitions
pandas
plotly
plotly_express
typing_extensions # required for 3.9 support atm

[tool:pytest]
Expand Down

0 comments on commit 70120bb

Please sign in to comment.