Skip to content

Commit

Permalink
Merge branch 'develop' into edit_metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajax23 authored May 29, 2019
2 parents 593a8f1 + adf5c8b commit c846cde
Show file tree
Hide file tree
Showing 16 changed files with 365 additions and 98 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ notes*.md
stash*.*
setup.sh
.pypirc
data/

# Distribution / packaging
build/
Expand Down
1 change: 0 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ python:
version: 3.6
install:
- requirements: tools/docs-requirements.txt
- requirements: requirements.txt
- method: pip
path: .
system_packages: true
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ matrix:
env: TOXENV=py36
- python: 3.7
env: TOXENV=py37
- python: 3.6
env: TOXENV=packaging
- python: 3.6
env: TOXENV=docs
- python: 3.6
env: TOXENV=coverage
- python: 3.6
env: TOXENV=coveralls
- python: 3.6
env: TOXENV=flake8
- python: 3.6
env: TOXENV=packaging
- python: 3.6
env: TOXENV=dist

branches:
only:
Expand Down
7 changes: 6 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
.. :changelog:

0.1.1 - (2019-05-28)
------------------------------------

[Release](https://github.com/AUSSDA/pyDataverse/releases/tag/v0.1.1)

0.1.0 - Marietta Blau (2019-05-20)
------------------------------------

- First release on PyPI.
[Release](https://github.com/AUSSDA/pyDataverse/releases/tag/v0.1.0)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.com/AUSSDA/pyDataverse.svg?branch=master)](https://travis-ci.com/AUSSDA/pyDataverse) [![Coverage Status](https://coveralls.io/repos/github/AUSSDA/pyDataverse/badge.svg)](https://coveralls.io/github/AUSSDA/pyDataverse) [![Documentation Status](https://readthedocs.org/projects/pydataverse/badge/?version=latest)](https://pydataverse.readthedocs.io/en/latest) [![GitHub](https://img.shields.io/github/license/aussda/pydataverse.svg)](https://opensource.org/licenses/MIT)
[![PyPI](https://img.shields.io/pypi/v/pyDataverse.svg)](https://pypi.org/project/pyDataverse/) [![Build Status](https://travis-ci.com/AUSSDA/pyDataverse.svg?branch=master)](https://travis-ci.com/AUSSDA/pyDataverse) [![Coverage Status](https://coveralls.io/repos/github/AUSSDA/pyDataverse/badge.svg)](https://coveralls.io/github/AUSSDA/pyDataverse) [![Documentation Status](https://readthedocs.org/projects/pydataverse/badge/?version=latest)](https://pydataverse.readthedocs.io/en/latest) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pydataverse.svg) [![GitHub](https://img.shields.io/github/license/aussda/pydataverse.svg)](https://opensource.org/licenses/MIT)

# pyDataverse

Expand Down
22 changes: 0 additions & 22 deletions requirements.txt

This file was deleted.

11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ def run_tests(self):
INSTALL_REQUIREMENTS = [
# A string or list of strings specifying what other distributions need to
# be installed when this one is.
'requests>=2.12.0'
]

SETUP_REQUIREMENTS = [
]

TESTS_REQUIREMENTS = [
'tox'
]

CLASSIFIERS = [
Expand All @@ -83,7 +86,7 @@ def run_tests(self):
author_email='stefan.kasberger@univie.ac.at',
name='pyDataverse',
version=find_version('src', 'pyDataverse', '__init__.py'),
description='A Dataverse API wrapper',
description='A wrapper for the Dataverse API',
long_description=read_file('README.md'),
long_description_content_type="text/markdown",
license='MIT',
Expand All @@ -94,11 +97,11 @@ def run_tests(self):
install_requires=INSTALL_REQUIREMENTS,
packages=find_packages('src'),
package_dir={'': 'src'},
setup_requires=['pytest-runner'],
setup_requires=SETUP_REQUIREMENTS,
tests_require=TESTS_REQUIREMENTS,
cmdclass={'test': Tox},
include_package_data=True,
keywords=['pydataverse', 'dataverse', 'api'],
keywords=['pyDataverse', 'dataverse', 'api'],
zip_safe=False,
project_urls={
'Documentation': 'https://pydataverse.readthedocs.io/',
Expand Down
2 changes: 1 addition & 1 deletion src/pyDataverse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
__email__ = 'stefan.kasberger@univie.ac.at'
__copyright__ = 'Copyright (c) 2019 Stefan Kasberger'
__license__ = 'MIT License'
__version__ = '0.1.0'
__version__ = '0.1.1'
__url__ = 'https://github.com/AUSSDA/pyDataverse'
__download_url__ = 'https://pypi.python.org/pypi/pyDataverse'
__description__ = 'A Python wrapper around the Dataverse API'
5 changes: 2 additions & 3 deletions src/pyDataverse/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def get_request(self, query_str, params=None, auth=False):
)

def post_request(self, query_str, metadata=None, auth=False,
params=None):
params=None):
"""Make a POST request.
Parameters
Expand Down Expand Up @@ -283,7 +283,6 @@ def put_request(self, query_str, metadata=None, auth=False,
''.format(url)
)


def delete_request(self, query_str, auth=False, params=None):
"""Make a DELETE request.
Expand Down Expand Up @@ -968,7 +967,7 @@ def upload_file(self, identifier, filename):
self.api_token)
shell_command += ' -X POST {0} -F file=@{1}'.format(
query_str, filename)
# TODO: is shell=True necessary?
# TODO(Shell): is shell=True necessary?
result = sp.run(shell_command, shell=True, stdout=sp.PIPE)
resp = json.loads(result.stdout)
return resp
Expand Down
1 change: 0 additions & 1 deletion src/pyDataverse/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down
12 changes: 10 additions & 2 deletions src/pyDataverse/docs/source/developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,19 @@ Exceptions
Install
-----------------------------

Install from the local git repository:
Install from the local git repository, with all it's dependencies:

.. code-block:: shell
git clone git@github.com:AUSSDA/pyDataverse.git
cd pyDataverse
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -r tools/tests-requirements.txt
pip install -r tools/lint-requirements.txt
pip install -r tools/docs-requirements.txt
pip install -r tools/packaging-requirements.txt
pip install -e .
Testing
Expand Down Expand Up @@ -80,6 +86,8 @@ When you only want to run one test, e.g. the py36 test:
tox -e py36
To find out more about which tests are available, have a look inside the tox.ini file.


Documentation
-----------------------------
Expand Down
66 changes: 46 additions & 20 deletions src/pyDataverse/docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@ pyDataverse

Release v\ |version|.

.. image:: https://travis-ci.com/AUSSDA/pyDataverse.svg?branch=master
:target: https://travis-ci.com/AUSSDA/pyDataverse

.. image:: https://img.shields.io/pypi/v/pyDataverse.svg
:target: https://pypi.org/project/pyDataverse/

.. image:: https://img.shields.io/pypi/wheel/pyDataverse.svg
:target: https://pypi.org/project/pyDataverse/

.. image:: https://img.shields.io/pypi/pyversions/pyDataverse.svg
:target: https://pypi.org/project/pyDataverse/

.. image:: https://readthedocs.org/projects/pydataverse/badge/?version=latest
:target: https://pydataverse.readthedocs.io/en/latest

.. image:: https://coveralls.io/repos/github/AUSSDA/pyDataverse/badge.svg
:target: https://coveralls.io/github/AUSSDA/pyDataverse

.. image:: https://img.shields.io/github/license/aussda/pydataverse.svg
:target: https://opensource.org/licenses/MIT

Expand All @@ -19,26 +37,34 @@ to create, update and remove Dataverses, Datasets and Datafiles.
Quickstart
-----------------------------

>>> from pyDataverse.api import Api
>>> # establish connection
>>> base_url = 'http://demo.dataverse.org'
>>> api = Api(base_url)
>>> api.status
'OK'
>>> # get dataverse
>>> dv = 'ecastro' # dataverse alias or id
>>> resp = api.get_dataverse(dv)
>>> resp.json()['data']['creationDate']
'2015-04-20T09:29:39Z'
>>> # get dataset
>>> resp = api.get_dataset(identifier)
>>> resp.json()['data']['id']
24
>>> # get datafile
>>> datafile_id = '32' # file id of the datafile
>>> resp = api.get_datafile(datafile_id)
>>> resp
<Response [200]>
**Install**

.. code-block:: shell
pip install pyDataverse
**Usage**

>>> from pyDataverse.api import Api
>>> # establish connection
>>> base_url = 'http://demo.dataverse.org'
>>> api = Api(base_url)
>>> api.status
'OK'
>>> # get dataverse
>>> dv = 'ecastro' # dataverse alias or id
>>> resp = api.get_dataverse(dv)
>>> resp.json()['data']['creationDate']
'2015-04-20T09:29:39Z'
>>> # get dataset
>>> resp = api.get_dataset(identifier)
>>> resp.json()['data']['id']
24
>>> # get datafile
>>> datafile_id = '32' # file id of the datafile
>>> resp = api.get_datafile(datafile_id)
>>> resp
<Response [200]>


Requirements
Expand Down
Loading

0 comments on commit c846cde

Please sign in to comment.