Skip to content

Commit

Permalink
Release 3.0.4 (spotify#140)
Browse files Browse the repository at this point in the history
This update is a maintanaince release with no new features and mainly behind the scenes updates:
* Update github actions
* Limit versions of bokeh, Jinja, and importlib-metadata to fix build error. This is only necessary for python 3.6 it seems.
* Updated required versions of pytest and coverage
* Update setup.py (spotify#135)
* Update options.py (spotify#133)
* Change ChromeDriver link to avoid deprecated site (spotify#134)
* Added test case and fix from [PR spotify#127](spotify#127)
* Eliminate a number of deprecation warnings
* Add publish to PyPi workflow

Co-authored-by: Anurag Kumar <[email protected]>
Co-authored-by: Moad Akhraz <[email protected]>
Co-authored-by: Damian <[email protected]>
Co-authored-by: Damian <[email protected]>
  • Loading branch information
5 people authored Oct 18, 2022
1 parent b8c27d4 commit b27473b
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 18 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
4 changes: 2 additions & 2 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install python dependencies
Expand Down
7 changes: 7 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
History
=======

3.0.3 (2022-10-18)
------------------

* Updated package requirements
* Got rid of future deprecation warnings
* Bugfix related to legend for graphs with multiple groups and colors

3.0.2 (2020-10-21)
------------------

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Installation

2. Install chromedriver requirement (Optional. Needed for PNG output):
- Install google chrome.
- Download the appropriate version of chromedriver for your OS `here <https://sites.google.com/a/chromium.org/chromedriver/downloads>`_.
- Download the appropriate version of chromedriver for your OS `here <https://sites.google.com/chromium.org/driver/>`_.
- Copy the executable file to a directory within your PATH.
- View directorys in your PATH variable: ``echo $PATH``
- Copy chromedriver to the appropriate directory, e.g.: ``cp chromedriver /usr/local/bin``
Expand Down
2 changes: 1 addition & 1 deletion chartify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

__author__ = """Chris Halpert"""
__email__ = '[email protected]'
__version__ = '3.0.3'
__version__ = '3.0.4'

_IPYTHON_INSTANCE = False

Expand Down
8 changes: 4 additions & 4 deletions chartify/_core/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from chartify._core.colors import Color, color_palettes
from chartify._core.axes import NumericalYMixin, NumericalXMixin

from scipy.stats.kde import gaussian_kde
from scipy.stats import gaussian_kde


class BasePlot:
Expand Down Expand Up @@ -1062,7 +1062,7 @@ def _construct_source(self,
# Sort the categories
if categorical_order_by == 'values':
# Recursively sort values within each level of the index.
row_totals = source.sum(axis=1)
row_totals = source.sum(axis=1, numeric_only=True)
row_totals.name = 'sum'
old_index = row_totals.index
row_totals = row_totals.reset_index()
Expand All @@ -1082,7 +1082,7 @@ def _construct_source(self,
source = source.reindex(row_totals.index)
elif categorical_order_by == 'labels':
source = source.sort_index(
0, ascending=categorical_order_ascending)
axis=0, ascending=categorical_order_ascending)
# Manual sort
elif order_length is not None:
source = source.reindex(categorical_order_by, axis='index')
Expand Down Expand Up @@ -2020,7 +2020,7 @@ def scatter(self,
legend = None
sliced_data = data_frame
else:
legend = bokeh.core.properties.value(str(color_value))
legend = str(color_value)
sliced_data = data_frame[data_frame[color_column] ==
color_value]
# Filter to only relevant columns.
Expand Down
4 changes: 2 additions & 2 deletions chartify/_core/radar_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def perimeter(self,
coord_df[[self._X_COLUMN, self._Y_COLUMN]] = self._to_xy_coords(
coord_df, radius_column, self._THETA_COLUMN)
# Add endpoint
coord_df = coord_df.append(coord_df.iloc[0])
coord_df = pd.concat([coord_df, pd.DataFrame([coord_df.iloc[0]])])

source = self._named_column_data_source(
coord_df, series_name=color_value)
Expand Down Expand Up @@ -300,7 +300,7 @@ def area(self,
coord_df[[self._X_COLUMN, self._Y_COLUMN]] = self._to_xy_coords(
coord_df, radius_column, self._THETA_COLUMN)
# Add endpoint
coord_df = coord_df.append(coord_df.iloc[0])
coord_df = pd.concat([coord_df, pd.DataFrame([coord_df.iloc[0]])])

source = self._named_column_data_source(
coord_df, series_name=color_value)
Expand Down
6 changes: 3 additions & 3 deletions docs/_static/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
pandas>=1.0.0<2.0.0
Pillow>=6.2.0
Pillow>=8.4.0
# Avoid selenium bug:
# https://github.com/SeleniumHQ/selenium/issues/5296
selenium>=3.7.0,<=3.8.0
bokeh>=2.0.0,<3.0.0
bokeh>=2.0.0,<2.3.0
scipy>=1.0.0,<2.0.0
ipykernel>=5.0
ipython>=7.0
pyyaml>=5.3.1
Jinja2<3.1.0
7 changes: 4 additions & 3 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ twine==1.11.0
watchdog==0.8.3
flake8==3.8.2
tox>=3.13.2
coverage==4.1
coverage==6.2
Sphinx==1.7.7
commonmark==0.5.4
recommonmark==0.4.0

pytest==3.2.3
pytest==7.0.1
pytest-cov==2.5.1
coverage-badge==0.2.0
pytest-runner==2.11.1
pylint==1.7.4
pyflakes==2.2.0
pyflakes==2.2.0
importlib-metadata<5.0
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def find_meta(meta):
'Natural Language :: English',
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"License :: OSI Approved :: Apache Software License"
],
test_suite='tests',
Expand Down
11 changes: 11 additions & 0 deletions tests/test_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ def test_reverse_vertical_legend_bar(self):
assert np.array_equal(labels,
['US', 'JP', 'GB', 'CA', 'BR'])

def test_legen_with_grouping_and_color(self):
df = pd.DataFrame.from_dict({"data": [1, 1, 2, 2, 3, 3],
"group": ["a", "a", "a", "b", "b", "b"]})
ch = chartify.Chart(x_axis_type='categorical')
ch.plot.scatter(
data_frame=df,
categorical_columns="group",
numeric_column="data",
color_column="group",
)


class TestChart:

Expand Down

0 comments on commit b27473b

Please sign in to comment.