Skip to content

Commit

Permalink
Merge remote-tracking branch 'altair-viz/master' into it-vega#588-geo…
Browse files Browse the repository at this point in the history
…pandas
  • Loading branch information
iliatimofeev committed May 16, 2018
2 parents 143ad04 + ece1c85 commit 661447d
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 430 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ python:
- 3.5
- 3.6

env:
global:
- TEST_DIR=/tmp/_altair/

before_install:
- pip install pip --upgrade;

Expand All @@ -15,4 +19,5 @@ install:

script:
- flake8 ./;
- python -m pytest --pyargs --doctest-modules altair;
- mkdir -p $TEST_DIR
- cd $TEST_DIR && python -m pytest --pyargs --doctest-modules altair;
21 changes: 19 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
# Altair Change Log

## Version 2.0.0:
## Version 2.1.0 (Unreleased):

Complete rewrite of Altair, focused on supporting Vega-Lite 2.X
- update vega & vega-embed versions in html output (#838)

- update vega-lite to version 2.4.3 (#836)

- Only API change is internal: ``alt.MarkProperties`` is now ``alt.MarkConfig``

- add an ``add_selection()`` method to add selections to charts (#832)

- add ``chart.serve()`` and ``chart.display()`` methods for more flexiblity
in displaying charts (#831)

- allow multiple fields to be passed to encodings such as ``tooltip``
and ``detail`` (#830)


## Version 2.0.0: May 2, 2018

- Complete rewrite of Altair, focused on supporting Vega-Lite 2.X

## Version 1.2.1: October 29, 2017

Expand Down
32 changes: 22 additions & 10 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,51 @@
- in altair/__init__.py
- in doc/conf.py (two places)

2. Commit change and push to master
2. Make sure CHANGES.md is up to date for the release

3. Commit change and push to master

git add . -u
git commit -m "MAINT: bump version to 2.0.0"
git push origin master

3. Tag the release:
4. Tag the release:

git tag -a v2.0.0 -m "version 2.0.0 release"
git push origin v2.0.0

4. publish to PyPI (Requires correct PyPI owner permissions)
5. Build source & wheel distributions

rm -r dist build # clean old builds & distributions
python setup.py sdist # create a source distribution
python setup.py bdist_wheel # create a universal wheel

python setup.py sdist upload
6. publish to PyPI (Requires correct PyPI owner permissions)

5. build and publish docs (Requires write-access to altair-viz/altair-viz.github.io)
twine upload dist/*

7. build and publish docs (Requires write-access to altair-viz/altair-viz.github.io)

cd docs
make clean
make html
bash sync_website.sh

6. update version to, e.g. 2.1.0dev
8. update version to, e.g. 2.1.0dev

- in altair/__init__.py
- in doc/conf.py (two places)

7. Commit change and push to master
9. add a new changelog entry for the unreleased version

10. Commit change and push to master

git add . -u
git commit -m "MAINT: bump version to 2.1.0dev"
git push origin master

8. Update version and hash in the recipe at conda-forge/altair-feedstock:
https://github.com/conda-forge/altair-feedstock/blob/master/recipe/meta.yaml
& submit a pull request
11. Update version and hash in the recipe at conda-forge/altair-feedstock:
https://github.com/conda-forge/altair-feedstock/blob/master/recipe/meta.yaml
& submit a pull request.

Note: the conda-forge bot may take care of this automatically.
13 changes: 8 additions & 5 deletions altair/utils/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ def test_sanitize_dataframe():
'o': pd.Series([np.array(i) for i in range(5)])})

# add some nulls
df.ix[0, 's'] = None
df.ix[0, 'f'] = np.nan
df.ix[0, 'd'] = pd.NaT
df.ix[0, 'o'] = np.array(np.nan)
df.iloc[0, df.columns.get_loc('s')] = None
df.iloc[0, df.columns.get_loc('f')] = np.nan
df.iloc[0, df.columns.get_loc('d')] = pd.NaT
df.iloc[0, df.columns.get_loc('o')] = np.array(np.nan)

# JSON serialize. This will fail on non-sanitized dataframes
df_clean = sanitize_dataframe(df)
Expand All @@ -55,6 +55,9 @@ def test_sanitize_dataframe():
# Re-construct pandas dataframe
df2 = pd.read_json(s)

# Re-order the columns to match df
df2 = df2[df.columns]

# Re-apply original types
for col in df:
if str(df[col].dtype).startswith('datetime'):
Expand All @@ -65,5 +68,5 @@ def test_sanitize_dataframe():
df2[col] = df2[col].astype(df[col].dtype)

# pandas doesn't properly recognize np.array(np.nan), so change it here
df.ix[0, 'o'] = np.nan
df.iloc[0, df.columns.get_loc('o')] = np.nan
assert df.equals(df2)
1 change: 1 addition & 0 deletions altair/vegalite/v2/examples/select_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
timeseries = timeseries.reset_index().melt('time')

# Merge the (x, y) metadata into the long-form view
timeseries['id'] = timeseries['id'].astype(int) # make merge not complain
data = pd.merge(timeseries, locations, on='id')

# Data is prepared, now make a chart
Expand Down
4 changes: 2 additions & 2 deletions altair/vegalite/v2/schema/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# flake8: noqa
from .core import *
from .channels import *
SCHEMA_VERSION = 'v2.4.1'
SCHEMA_URL = 'https://vega.github.io/schema/vega-lite/v2.4.1.json'
SCHEMA_VERSION = 'v2.4.3'
SCHEMA_URL = 'https://vega.github.io/schema/vega-lite/v2.4.3.json'
18 changes: 18 additions & 0 deletions altair/vegalite/v2/schema/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,24 @@ def __init__(self, shorthand=Undefined, aggregate=Undefined, bin=Undefined, fiel
sort=sort, timeUnit=timeUnit, title=title, type=type, **kwds)


class OrderValue(ValueChannelMixin, core.ValueDef):
"""OrderValue schema wrapper
Mapping(required=[value])
Definition object for a constant value of an encoding channel.
Attributes
----------
value : anyOf(float, string, boolean)
A constant value in visual domain (e.g., ``"red"`` / "#0099ff" for color, values
between ``0`` to ``1`` for opacity).
"""
_class_is_valid_at_instantiation = False

def __init__(self, value, **kwds):
super(OrderValue, self).__init__(value=value, **kwds)


class Row(FieldChannelMixin, core.FacetFieldDef):
"""Row schema wrapper
Expand Down
Loading

0 comments on commit 661447d

Please sign in to comment.