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

Prune down the documentation #403

Merged
merged 2 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
65 changes: 11 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# datawrapper

<div align="center">
A lightweight Python wrapper for the Datawrapper API

[![PyPI Version](https://img.shields.io/pypi/v/datawrapper.svg)](https://pypi.python.org/pypi/datawrapper)
[![Monthly downloads](https://img.shields.io/pypi/dm/datawrapper)](https://img.shields.io/pypi/dm/datawrappe)
[![Build status](https://github.com/chekos/datawrapper/workflows/build/badge.svg?branch=master&event=push)](https://github.com/chekos/datawrapper/actions?query=workflow%3Abuild)
[![Python Version](https://img.shields.io/pypi/pyversions/datawrapper.svg)](https://pypi.org/project/datawrapper/)
[![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/chekos/datawrapper/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)

Expand All @@ -13,72 +12,34 @@
[![Semantic Versions](https://img.shields.io/badge/%F0%9F%9A%80-semantic%20versions-informational.svg)](https://github.com/chekos/datawrapper/releases)
[![License](https://img.shields.io/github/license/chekos/datawrapper)](https://github.com/chekos/datawrapper/blob/master/LICENSE)

A lightweight Python wrapper for the Datawrapper API

</div>
## Features

## 🚀 Features

* Retrieve your account information (including folders).
* Add data to charts, tables or maps.
* Create charts, tables or maps - and add data from a `pandas.DataFrame` in one call!
* Update chart descriptions.
* Publish charts, tables or maps.
* Retrieve chart properties, update its metadata, and other information.
* Display a chart (as output of notebook cell - it gets weird because interactivity ¯\\_(ツ)_/¯ )
* Retrieve a chart, table or map's iframe code to embed.
* Export chart as png (still working on the svg and pdf parts).
* Move charts across folders and organizations.
* Delete charts.
* Get a list of all your charts.
* Create, get, update, export and delete charts, tables and maps
* Add data from a `pandas.DataFrame` or a GeoJSON file with one simple call
* Get, update and delete folders, users and teams.
* Retrieve lists of recently edited and updated charts
* Access metadata about your account
* Get a list of all available themes

## Installation

```bash
pip install -U datawrapper
```

or `pipenv`

```bash
pipenv install datawrapper
```

or install with `Poetry`

```bash
poetry add datawrapper
```

### Contributing

Clone the repository. Move into the directory on your terminal.

Install dependencies for development.

```sh
pipenv install --dev
```

Install pre-commit to run a battery of automatic quick fixes against your work.

```sh
pipenv run pre-commit install
```

## 📈 Releases
## Releases

You can see the list of available releases on the [GitHub Releases](https://github.com/chekos/datawrapper/releases) page.

We follow [Semantic Versions](https://semver.org/) specification. When you're ready to make a new release, visit the releases page and create a new entry. Set the tags and press publish. That will trigger a GitHub Action that automatically deploys the code to the Python Package Index.

## 🛡 License
## License

[![License](https://img.shields.io/github/license/chekos/datawrapper)](https://github.com/chekos/datawrapper/blob/master/LICENSE)

This project is licensed under the terms of the `MIT` license. See [LICENSE](https://github.com/chekos/datawrapper/blob/master/LICENSE) for more details.

## 📃 Citation
## Citation

```
@misc{datawrapper,
Expand All @@ -90,7 +51,3 @@ This project is licensed under the terms of the `MIT` license. See [LICENSE](htt
howpublished = {\url{https://github.com/chekos/datawrapper}}
}
```

## Credits

This project was generated with [`python-package-template`](https://github.com/TezRomacH/python-package-template).
15 changes: 15 additions & 0 deletions datawrapper/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,21 @@ def export_chart(
logger.debug(f"File exported at {_filepath}")
return _filepath

def get_chart_display_urls(self, chart_id: str) -> list[dict]:
"""Get the URLs for the published chart, table or map.

Parameters
----------
chart_id : str
ID of chart, table, or map.

Returns
-------
list[dict]
A list of dictionaries containing the URLs for the published chart, table, or map.
"""
return self.get(f"{self._CHARTS_URL}/{chart_id}/display-urls")

def get_iframe_code(self, chart_id: str, responsive: bool = False) -> str:
"""Returns a chart, table, or map's iframe embed code.

Expand Down
16 changes: 0 additions & 16 deletions docs/about/authors.md

This file was deleted.

9 changes: 0 additions & 9 deletions docs/about/history.md

This file was deleted.

19 changes: 2 additions & 17 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Welcome to `datawrapper`'s documentation!

```{include} ../README.md
```

Expand All @@ -9,20 +7,7 @@
maxdepth: 2
caption: User guide
---
user-guide/installation.md
user-guide/usage.md
user-guide/api.md
user-guide/contributing.md
```

```{toctree}
---
maxdepth: 2
caption: About the project
---
about/API.md
about/contributing.md
about/authors.md
about/history.md
```
# Indices and tables

* {ref}`genindex`
File renamed without changes.
File renamed without changes.
40 changes: 0 additions & 40 deletions docs/user-guide/installation.md

This file was deleted.

14 changes: 14 additions & 0 deletions tests/test_display_urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Test oembed functions."""
from datawrapper import Datawrapper


def test_get_chart_display_urls():
"""Test get_oembed function."""
dw = Datawrapper()

# Get display urls for a chart
data = dw.get_chart_display_urls("WpAbK")

# Verify it contains a list of dictionarys
assert isinstance(data, list)
assert isinstance(data[0], dict)
Loading