Skip to content

Commit a81cb4c

Browse files
authored
Merge pull request #31 from osmlab/dev
Merging dev -> master
2 parents 3795b83 + e1473d6 commit a81cb4c

56 files changed

Lines changed: 1994 additions & 243 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
* **Do you want to request a *feature* or report a *bug*?**
2+
- [ ] bug report
3+
- [ ] feature request
4+
5+
* **What is the current behavior?**
6+
7+
* **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the
8+
problem**
9+
10+
* **What is the expected behavior?**
11+
12+
* **What is the motivation / use case for changing the behavior?**
13+
14+
* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to
15+
have context, eg. stackoverflow, gitter, etc)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[BUG]"
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots & Stack Traces**
24+
If applicable, add screenshots and/or stack traces to help explain your problem.
25+
26+
**Environment (please complete the following information):**
27+
- OS: [e.g. macOS, Windows, Linux]
28+
- Version [e.g. 22]
29+
30+
**Additional context**
31+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: "[Feature Request]"
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### Description:
2+
3+
Add description here.
4+
5+
### Potential Impact:
6+
7+
List potential impact to downstream libraries here
8+
9+
### Unit Test Approach:
10+
11+
Describe unit tests being added with that PR.
12+
13+
### Test Results:
14+
15+
Describe other (non-unit) test results here.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish Python 🐍 distributions 📦 to PyPI
2+
3+
on:
4+
release:
5+
types: [created]
6+
branches:
7+
- master
8+
9+
jobs:
10+
build-n-publish:
11+
name: Build and publish Python distributions to PyPI
12+
runs-on: ubuntu-18.04
13+
steps:
14+
- uses: actions/checkout@master
15+
- name: Set up Python 3.6
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: 3.6
19+
- name: Install pep517
20+
run: >-
21+
python -m
22+
pip install
23+
pep517
24+
--user
25+
- name: Build a binary wheel and a source tarball
26+
run: >-
27+
python -m
28+
pep517.build
29+
--source
30+
--binary
31+
--out-dir dist/
32+
.
33+
- name: Publish distribution to PyPI
34+
uses: pypa/gh-action-pypi-publish@master
35+
with:
36+
user: __token__
37+
password: ${{ secrets.pypi_password }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
tox.ini
21
venv
32
.eggs
43
.idea
54
.tox
65
*.pyc
76
__pycache__
87
maproulette.egg-info
8+
docs/_build
9+
docs/_static
10+
docs/_templates

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ install:
77
# command to run unit tests
88
script:
99
- tox
10+
- cd docs; make html

README.md

Lines changed: 132 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,132 @@
1-
# maproulette-python-client
1+
# MapRoulette - A Python Client for the MapRoulette API
2+
3+
https://maproulette-python-client.readthedocs.io/
4+
5+
This client makes it easy for users to communicate with the MapRoulette API from within
6+
their Python environment. In the example below, we are able to access a MapRoulette project in just four lines of code:
7+
8+
```
9+
>>> import maproulette
10+
>>> config = maproulette.Configuration()
11+
>>> api = maproulette.Project(config)
12+
>>> api.get_project_by_id(4719)
13+
{'data': {'id': 4719, 'owner': 4785024, 'name': 'health_facilities_in_india',...}
14+
```
15+
16+
The full documentation for this package can be found [here](https://maproulette-python-client.readthedocs.io/).
17+
18+
19+
## Getting Started
20+
21+
Install the package (or add it to your requirements.txt file):
22+
23+
```bash
24+
pip install maproulette
25+
```
26+
27+
Import the package:
28+
29+
```
30+
import maproulette
31+
```
32+
33+
From there, create a configuration object. Depending on your use case, you may need to pass your API key. Specify
34+
that when you create your configuration. For example:
35+
36+
```
37+
config = maproulette.Configuration(api_key='{YOUR_API_KEY}')
38+
```
39+
40+
Once you have your configuration object we can create an API object using one of several modules depending on the
41+
functionality that the user is looking for. For example, creating a Project object allows the user to interact with all
42+
of the project-related functionality in the MapRoulette package.
43+
44+
```
45+
api = maproulette.Project(config)
46+
```
47+
48+
Now we have access to the MapRoulette Project API methods. In the example below, I want to find a project by name using
49+
a search string:
50+
51+
```
52+
# We want to fetch a project with name 'Health Facilities in India'
53+
my_project_name = 'Health Facilities in India'
54+
55+
# Pretty-print the API response
56+
print(json.dumps(api.find_project(my_project_name), indent=4, sort_keys=True))
57+
```
58+
59+
This returns a nicely printed JSON object representing the project named 'Health Facilities in India':
60+
61+
```
62+
{
63+
"data": [
64+
{
65+
"created": "2019-08-26T06:34:28.655Z",
66+
"deleted": false,
67+
"description": "Adding the Hospitals ",
68+
"displayName": "Health Facilities in India",
69+
"enabled": true,
70+
"featured": false,
71+
"groups": [
72+
{
73+
"created": "2020-03-25T16:23:04.360Z",
74+
"groupType": 1,
75+
"id": 9273,
76+
"modified": "2020-03-25T16:23:04.360Z",
77+
"name": "4719_Admin",
78+
"projectId": 4719
79+
},
80+
{
81+
"created": "2020-03-25T16:23:04.360Z",
82+
"groupType": 2,
83+
"id": 9274,
84+
"modified": "2020-03-25T16:23:04.360Z",
85+
"name": "4719_Write",
86+
"projectId": 4719
87+
},
88+
{
89+
"created": "2020-03-25T16:23:04.360Z",
90+
"groupType": 3,
91+
"id": 9275,
92+
"modified": "2020-03-25T16:23:04.360Z",
93+
"name": "4719_Read",
94+
"projectId": 4719
95+
}
96+
],
97+
"id": 4719,
98+
"isVirtual": false,
99+
"modified": "2020-01-30T11:05:44.466Z",
100+
"name": "health_facilities_in_india",
101+
"owner": 4785024
102+
}
103+
],
104+
"status": 200
105+
}
106+
```
107+
## Development
108+
109+
### Contributing
110+
111+
Open an issue! Thanks for contributing!
112+
113+
### Testing
114+
115+
This package uses [Tox](https://tox.readthedocs.io/en/latest/) to perform testing. In order to run Tox, execute the
116+
`tox` command from the root directory.
117+
118+
119+
### Building the Documentation
120+
121+
The documentation for this package is built with [Sphinx](https://www.sphinx-doc.org/en/master/index.html). In order to
122+
build the documentation for this package:
123+
124+
```
125+
$ cd docs
126+
```
127+
and then:
128+
```
129+
$ make html
130+
```
131+
That command will generate the HTML documentation files for the project. We've hosted these docs at
132+
[Read the Docs](https://readthedocs.org/).

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/conf.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
15+
import sys
16+
sys.path.insert(0, os.path.abspath('..'))
17+
from maproulette import __version__
18+
19+
20+
# -- Project information -----------------------------------------------------
21+
22+
project = 'maproulette-python-client'
23+
copyright = ''
24+
author = ''
25+
26+
# The full version, including alpha/beta/rc tags
27+
release = __version__
28+
29+
30+
# -- General configuration ---------------------------------------------------
31+
32+
# Add any Sphinx extension module names here, as strings. They can be
33+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
34+
# ones.
35+
extensions = ['sphinx.ext.autodoc',
36+
'sphinx_rtd_theme']
37+
38+
# Add any paths that contain templates here, relative to this directory.
39+
templates_path = ['_templates']
40+
41+
# List of patterns, relative to source directory, that match files and
42+
# directories to ignore when looking for source files.
43+
# This pattern also affects html_static_path and html_extra_path.
44+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
45+
46+
47+
# -- Options for HTML output -------------------------------------------------
48+
49+
# The theme to use for HTML and HTML Help pages. See the documentation for
50+
# a list of builtin themes.
51+
#
52+
html_theme = 'sphinx_rtd_theme'
53+
54+
# Add any paths that contain custom static files (such as style sheets) here,
55+
# relative to this directory. They are copied after the builtin static files,
56+
# so a file named "default.css" will overwrite the builtin "default.css".
57+
html_static_path = []
58+
59+
master_doc = 'index'

0 commit comments

Comments
 (0)