Skip to content

Commit

Permalink
Merge pull request #216 from CartoDB/release-bump-beta3
Browse files Browse the repository at this point in the history
Release bump beta3
  • Loading branch information
andy-esch authored Sep 18, 2017
2 parents 9339230 + 6b07ca8 commit acd20cc
Show file tree
Hide file tree
Showing 39 changed files with 816 additions and 622 deletions.
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ test:
nosetests -v test/

dist:
python setup.py sdist
python setup.py bdist_wheel
python setup.py sdist bdist_wheel --universal

publish:
python setup.py sdist bdist_wheel
python setup.py sdist bdist_wheel --universal
twine upload dist/*
rm -fr build dist .egg cartoframes.egg-info
rm -fr build/* dist/* .egg cartoframes.egg-info

.PHONY: init docs test dist release
19 changes: 19 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,22 @@ Interact with CARTO's `Data Observatory <https://carto.com/docs/carto-engine/dat
'normalization': 'predenominated'},]
df = cc.data_augment('transactions', data_obs_measures)
df.head()
CARTO Credential Management
---------------------------
Save and update your CARTO credentials for later use.
.. code:: python
from cartoframes import Credentials, CartoContext
creds = Credentials(username='eschbacher', key='abcdefg')
creds.save() # save credentials for later use (not dependent on Python session)
Once you save your credentials, you can get started in future sessions more quickly:
.. code:: python
from cartoframes import CartoContext
cc = CartoContext() # automatically loads credentials if previously saved
1 change: 1 addition & 0 deletions cartoframes/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.2.3b3'
4 changes: 2 additions & 2 deletions cartoframes/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class CartoContext(object):
session (requests.Session, optional): requests session. See `requests
documentation
<http://docs.python-requests.org/en/master/user/advanced/>`__
for more information:
for more information.
verbose (bool, optional): Output underlying process states (True), or
suppress (False, default)
Expand Down Expand Up @@ -197,7 +197,7 @@ def write(self, df, table_name, temp_dir='/tmp', overwrite=False,
table_name=final_table_name))

def delete(self, table_name):
"""Delete table
"""Delete a table in user's CARTO account.
Args:
table_name (str): Table name to delete
Expand Down
54 changes: 35 additions & 19 deletions cartoframes/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
_DEFAULT_PATH = os.path.join(_USER_CONFIG_DIR,
'cartocreds.json')


class Credentials(object):
"""Credentials class for managing and storing user CARTO credentials. The
arguments are listed in order of precedence: :obj:`Credentials` instances
are first, `key` and `base_url`/`username` are taken next, and `config_file`
(if given) is taken last. If no arguments are passed, then there will be an
attempt to retrieve credentials from a previously saved session. One of the
above scenarios needs to be met to successfully instantiate a
:obj:`Credentials` object.
are first, `key` and `base_url`/`username` are taken next, and
`config_file` (if given) is taken last. If no arguments are passed, then
there will be an attempt to retrieve credentials from a previously saved
session. One of the above scenarios needs to be met to successfully
instantiate a :obj:`Credentials` object.
Args:
creds (:obj:`cartoframes.Credentials`, optional): Credentials instance
Expand Down Expand Up @@ -77,7 +78,9 @@ def save(self, config_loc=None):
"""Saves current user credentials to user directory.
Args:
config_loc (str, optional):
config_loc (str, optional): Location where credentials are to be
stored. If no argument is provided, it will be send to the
default location.
Example:
Expand Down Expand Up @@ -119,7 +122,8 @@ def delete(self, config_file=None):
>>> creds = Credentials()
>>> print(creds)
Credentials(username=eschbacher, key=abcdefg, base_url=https://eschbacher.carto.com/)
Credentials(username=eschbacher, key=abcdefg,
base_url=https://eschbacher.carto.com/)
"""
path_to_remove = config_file or _DEFAULT_PATH
Expand Down Expand Up @@ -152,9 +156,12 @@ def set(self, key=None, username=None, base_url=None):
.. code::
from cartoframes import Credentials
creds = Credentials() # load credentials saved in previous session
creds.set(key='new_api_key') # set new API key
creds.save() # save new creds to default user config directory
# load credentials saved in previous session
creds = Credentials()
# set new API key
creds.set(key='new_api_key')
# save new creds to default user config directory
creds.save()
Note:
If the `username` is specified but the `base_url` is not, the
Expand All @@ -176,10 +183,13 @@ def key(self, key=None):
.. code::
>>> from cartoframes import Credentials
>>> creds = Credentials() # load credentials saved in previous session
>>> creds.key() # returns current API key
# load credentials saved in previous session
>>> creds = Credentials()
# returns current API key
>>> creds.key()
'abcdefg'
>>> creds.key('new_api_key') # updates API key with new value
# updates API key with new value
>>> creds.key('new_api_key')
"""
if key:
self._key = key
Expand All @@ -202,10 +212,13 @@ def username(self, username=None):
.. code::
>>> from cartoframes import Credentials
>>> creds = Credentials() # load credentials saved in previous session
>>> creds.username() # returns current username
# load credentials saved in previous session
>>> creds = Credentials()
# returns current username
>>> creds.username()
'eschbacher'
>>> creds.username('new_username') # updates username with new value
# updates username with new value
>>> creds.username('new_username')
"""
if username:
self._username = username
Expand All @@ -229,10 +242,13 @@ def base_url(self, base_url=None):
.. code::
>>> from cartoframes import Credentials
>>> creds = Credentials() # load credentials saved in previous session
>>> creds.base_url() # returns current base_url
# load credentials saved in previous session
>>> creds = Credentials()
# returns current base_url
>>> creds.base_url()
'https://eschbacher.carto.com/'
>>> creds.base_url('new_base_url') # updates base_url with new value
# updates base_url with new value
>>> creds.base_url('new_base_url')
"""
if base_url:
self._base_url = base_url
Expand Down
3 changes: 2 additions & 1 deletion cartoframes/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ class QueryLayer(AbstractLayer):
in SQL instead of in pandas)
Used in the `layers` keyword in `CartoContext.map()
<#context.CartoContext.map>`__.
<#context.CartoContext.map>`__.
Example:
Underlay a QueryLayer with a complex query below a layer from a table.
The QueryLayer is colored by the calculated column ``abs_diff``, and
points are sized by the column ``i_measure``.
.. code:: python
import cartoframes
Expand Down
1 change: 0 additions & 1 deletion docs/_sources/cartoframes.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Submodules
cartoframes.layer
cartoframes.maps
cartoframes.styling
cartoframes.updates
cartoframes.utils

Module contents
Expand Down
Loading

0 comments on commit acd20cc

Please sign in to comment.