-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 876e05e
Showing
16 changed files
with
843 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*.so | ||
|
||
# Misc | ||
*~ | ||
.*.sw? | ||
.env/ | ||
|
||
# Personal | ||
docs/ | ||
data/ | ||
notes.md | ||
snippets.md | ||
|
||
# Distribution / packaging | ||
build/ | ||
dist/ | ||
.eggs/ | ||
*.egg-info/ | ||
*.egg | ||
MANIFEST | ||
|
||
# Documentation | ||
docs/build/ | ||
|
||
# Unit test / coverage reports | ||
.tox | ||
htmlcov/ | ||
.coverage | ||
.coverage.* | ||
.*cache | ||
coverage.xml | ||
*.cover | ||
pip-wheel-metadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
language: python | ||
cache: pip | ||
dist: xenial | ||
python: | ||
- '3.5' | ||
- '3.6' | ||
|
||
before_install: | ||
- python --version | ||
|
||
install: | ||
- pip install tox-travis | ||
- virtualenv --version | ||
- easy_install --version | ||
- pip --version | ||
- tox --version | ||
|
||
script: | ||
- tox | ||
|
||
after_success: | ||
- pip install codecov | ||
- coveralls | ||
|
||
notifications: | ||
email: | ||
recipients: | ||
- [email protected] | ||
on_success: never | ||
on_failure: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
The MIT License (MIT) | ||
===================== | ||
|
||
Copyright © 2019 Stefan Kasberger | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the “Software”), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Include the README | ||
include README.rst | ||
|
||
# Include the license file | ||
include LICENSE.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# pyDataverse | ||
|
||
A Python wrapper for the Dataverse API. Developed by [Stefan Kasberger](http://stefankasberger.at) for [AUSSDA - The Austrian Social Science Data Archive](http://aussda.at/). | ||
|
||
|
||
**Features** | ||
|
||
* Tests written in [pytest](https://docs.pytest.org/en/latest/) and tested via [Travis CI](URL). Test coverage by [pytest-cov](https://pypi.org/project/pytest-cov/) and [python-coveralls](https://github.com/z4r/python-coveralls), viewable on [coveralls.io](URL). | ||
* auto-generated documentation through functions and class documentation with [sphinx](http://www.sphinx-doc.org/). | ||
|
||
|
||
**Copyright** | ||
|
||
* Code: [](https://opensource.org/licenses/MIT) | ||
* Documentation: [](https://creativecommons.org/licenses/by/4.0/) | ||
|
||
## INSTALL | ||
|
||
```bash | ||
virtualenv --python=/usr/bin/python3 venv | ||
source venv/bin/activate | ||
pip install -r requirements.txt | ||
``` | ||
|
||
## USE | ||
|
||
**Connect to API** | ||
|
||
```python | ||
from pyDataverse.api import Api | ||
host = 'www.dataverse.org' | ||
auth_token = '' # your Dataverse API authentication token | ||
api = Api(host, auth_token) | ||
``` | ||
**Get dataverse** | ||
|
||
```python | ||
dv = '' # dataverse alias or id | ||
resp = api.get_dataverse(dv) | ||
``` | ||
|
||
**Get dataset** | ||
|
||
```python | ||
doi = '' # doi of the dataset | ||
resp = api.get_dataset(doi) | ||
``` | ||
|
||
**Get datafile** | ||
|
||
```python | ||
file_id = '' # file id of the datafile | ||
resp = api.get_datafile(file_id, 'content') | ||
``` | ||
|
||
## DEVELOPMENT | ||
|
||
### Testing | ||
|
||
``` | ||
pytest | ||
``` | ||
|
||
|
||
### Documentation | ||
|
||
Use Sphinx to create class and function documentation out of the doc-strings. | ||
|
||
``` | ||
cd src/pyDataverse/docs/ | ||
sphinx-build -b html source build | ||
sphinx-apidoc -f -o source .. | ||
make html | ||
``` | ||
|
||
|
||
## CONTRIBUTE | ||
|
||
|
||
## COPYRIGHT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
===== | ||
pyDataverse | ||
===== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
alabaster==0.7.12 | ||
atomicwrites==1.3.0 | ||
attrs==18.2.0 | ||
Babel==2.6.0 | ||
bleach==3.1.0 | ||
certifi==2018.11.29 | ||
chardet==3.0.4 | ||
check-manifest==0.37 | ||
coverage==4.5.2 | ||
docutils==0.14 | ||
entrypoints==0.3 | ||
filelock==3.0.10 | ||
flake8==3.7.6 | ||
idna==2.8 | ||
imagesize==1.1.0 | ||
Jinja2==2.10 | ||
MarkupSafe==1.1.0 | ||
mccabe==0.6.1 | ||
more-itertools==6.0.0 | ||
packaging==19.0 | ||
pathlib2==2.3.3 | ||
pkginfo==1.5.0.1 | ||
pluggy==0.8.1 | ||
py==1.8.0 | ||
pycodestyle==2.5.0 | ||
pyflakes==2.1.0 | ||
Pygments==2.3.1 | ||
pyparsing==2.3.1 | ||
pytest==4.3.0 | ||
pytest-cov==2.6.1 | ||
pytz==2018.9 | ||
readme-renderer==24.0 | ||
requests==2.21.0 | ||
requests-toolbelt==0.9.1 | ||
six==1.12.0 | ||
snowballstemmer==1.2.1 | ||
Sphinx==1.8.4 | ||
sphinxcontrib-websupport==1.1.0 | ||
toml==0.10.0 | ||
tox==3.7.0 | ||
tqdm==4.31.1 | ||
twine==1.13.0 | ||
urllib3==1.24.1 | ||
virtualenv==16.4.3 | ||
webencodings==0.5.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[metadata] | ||
license_file = LICENSE.txt | ||
|
||
[tool:pytest] | ||
testpaths = tests | ||
|
||
[coverage:run] | ||
source = wheel | ||
omit = .tox/* | ||
|
||
[coverage:report] | ||
show_missing = true | ||
|
||
[bdist_wheel] | ||
universal = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
from setuptools import setup | ||
from setuptools import find_packages | ||
import codecs | ||
import os | ||
import re | ||
|
||
ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) | ||
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) | ||
|
||
|
||
def read_file(*file_paths): | ||
"""Read text file.""" | ||
with codecs.open(os.path.join(ROOT_DIR, *file_paths), 'r') as fp: | ||
return fp.read() | ||
|
||
|
||
def find_version(*file_paths): | ||
"""Find package version from file.""" | ||
version_file = read_file(*file_paths) | ||
version_match = re.search( | ||
r"^__version__ = ['\"]([^'\"]*)['\"]", | ||
version_file, | ||
re.M, | ||
) | ||
if version_match: | ||
return version_match.group(1) | ||
|
||
raise RuntimeError("Unable to find version string.") | ||
|
||
|
||
INSTALL_REQUIREMENTS = [ | ||
# A string or list of strings specifying what other distributions need to | ||
# be installed when this one is. | ||
] | ||
|
||
TESTS_REQUIREMENTS = [ | ||
] | ||
|
||
CLASSIFIERS = [ | ||
# How mature is this project? Common values are | ||
# 2 - Pre-Alpha | ||
# 3 - Alpha | ||
# 4 - Beta | ||
# 5 - Production/Stable | ||
'Development Status :: 2 - Pre-Alpha', | ||
'Intended Audience :: Developers', | ||
'Operating System :: OS Independent', | ||
'License :: OSI Approved :: MIT License', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Natural Language :: English', | ||
] | ||
|
||
setup( | ||
author='Stefan Kasberger', | ||
author_email='[email protected]', | ||
name='pyDataverse', | ||
version=find_version("src", "pyDataverse", "__init__.py"), | ||
description='A Dataverse API wrapper', | ||
long_description=read_file('README.md'), | ||
long_description_content_type="text/markdown", | ||
license='MIT', | ||
url='https://github.com/AUSSDA/pyDataverse', | ||
python_requires='>=3.5', | ||
platforms=['OS Independent'], | ||
classifiers=CLASSIFIERS, | ||
install_requires=INSTALL_REQUIREMENTS, | ||
packages=find_packages('src'), | ||
package_dir={'': 'src'}, | ||
setup_requires=['pytest-runner'], | ||
tests_require=TESTS_REQUIREMENTS, | ||
include_package_data=True, | ||
keywords=['pydataverse', 'dataverse', 'api'], | ||
zip_safe=False, | ||
project_urls={ | ||
'Issue Tracker': 'https://github.com/AUSSDA/pyDataverse/issues' | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# !/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import | ||
|
||
from requests.packages import urllib3 | ||
urllib3.disable_warnings() # noqa | ||
|
||
"""pyDataverse | ||
Copyright 2019 Stefan Kasberger | ||
Licensed under the MIT License. | ||
""" | ||
|
||
__author__ = 'Stefan Kasberger' | ||
__email__ = '[email protected]' | ||
__copyright__ = 'Copyright (c) 2019 Stefan Kasberger' | ||
__license__ = 'MIT License' | ||
__version__ = '0.0.1' | ||
__url__ = 'https://github.com/AUSSDA/pyDataverse' | ||
__download_url__ = 'https://pypi.python.org/pypi/python-twitter' | ||
__description__ = 'A Python wrapper around the Dataverse API' |
Oops, something went wrong.