Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
skasberger committed May 20, 2019
2 parents adc3374 + e5d391e commit 2b1f2b8
Show file tree
Hide file tree
Showing 27 changed files with 525 additions and 267 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ venv_home/
# Personal
notes*.md
stash*.*
setup.sh
.pypirc

# Distribution / packaging
build/
Expand All @@ -23,13 +25,12 @@ dist/
MANIFEST

# Documentation
docs/build/
/docs
src/pyDataverse/docs/build
src/pyDataverse/docs/Makefile

# Unit test / coverage reports
.tox
docs/coverage_html/
.coverage
.coverage.*
.*cache
Expand Down
23 changes: 23 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: src/pyDataverse/docs/source/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.6
install:
- requirements: tools/docs-requirements.txt
- requirements: requirements.txt
- method: pip
path: .
system_packages: true
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ matrix:
branches:
only:
- master
- develop

before_install:
- echo $TRAVIS_PYTHON_VERSION
Expand All @@ -39,10 +40,8 @@ install:
- pip --version
- tox --version


script:
- tox
- pytest tests/ --cov=pyDataverse --cov-report=term-missing --cov-report=xml --cov-report=html

after_success:
- coveralls
Expand Down
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. :changelog:

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

- First release on PyPI.
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

137 changes: 11 additions & 126 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,143 +1,28 @@
[![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?branch=master)](https://coveralls.io/github/AUSSDA/pyDataverse?branch=master)
[![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)

# pyDataverse

A Python module to work with the Dataverse API. It allows to create, update and remove Dataverses, Datasets and Datafiles via Dataverse's native API. Thanks to the developers of [dataverse-client-python](https://github.com/IQSS/dataverse-client-python), from which the project got inspired from.

pyDataverse is a Python module for [Dataverse](http://dataverse.org/). It uses the [Native API](http://guides.dataverse.org/en/latest/api/native-api.html) and [Data Access API](http://guides.dataverse.org/en/latest/api/dataaccess.html). It allows to create, update and remove Dataverses, Datasets and Datafiles via Dataverse's native API. Thanks to the developers of [dataverse-client-python](https://github.com/IQSS/dataverse-client-python), from which the project got inspired from.

**Features**

* Open Source ([MIT](https://opensource.org/licenses/MIT))
* `api.py`: Dataverse Api functionalities to create, get, publish and delete Dataverses, Datasets and Datafiles.
* `utils.py`: Functions to support the core functionalities.
* `exceptions.py`: Custom exceptions
* `tests/*`: Tests on [Travis CI](https://travis-ci.com/AUSSDA/pyDataverse) ([pytest](https://docs.pytest.org/en/latest/) + [tox](http://tox.readthedocs.io/)).
* [Documentation](https://pydataverse.readthedocs.io/en/latest/)
* Python 2 and 3 (>=2.7)
* Open Source (MIT)
* Many different Dataverse Api Requests (use GET, POST (Curl) and DELETE)
* Utils functions to support the core-functions
* Tests with [pytest](https://docs.pytest.org/en/latest/), [Travis CI](https://travis-ci.com/AUSSDA/pyDataverse) and [tox](http://tox.readthedocs.io/).
* Documentation with [sphinx](http://www.sphinx-doc.org/).
* Custom exceptions


**Copyright**

* Code: [![GitHub](https://img.shields.io/github/license/aussda/pydataverse.svg)](https://opensource.org/licenses/MIT)
* Sourcecode: [![GitHub](https://img.shields.io/github/license/aussda/pydataverse.svg)](https://opensource.org/licenses/MIT)
* Documentation: [![License: CC BY 4.0](https://licensebuttons.net/l/by/4.0/80x15.png)](https://creativecommons.org/licenses/by/4.0/)

## INSTALL

**Requirements**

* curl

**Install**

```shell
virtualenv --python=/usr/bin/python3 venv
source venv/bin/activate
pip install -r requirements.txt
```

## QUICKSTART

**Connect to API**

```python
from pyDataverse.api import Api
base_url = 'http://demo.dataverse.org'
api = Api(base_url)
```
**Get dataverse**

```python
dv = 'ecastro' # dataverse alias or id
resp = api.get_dataverse(dv)
print(resp.json())
```

**Get dataset**

```python
identifier = 'doi:10.5072/FK2/U6AEZM' # doi of the dataset
resp = api.get_dataset(identifier)
```

**Get datafile**

```python
datafile_id = '32' # file id of the datafile
resp = api.get_datafile(datafile_id)
print(resp.content)
```

## DEVELOPMENT

### Install

```bash
virtualenv --python=/usr/bin/python3 venv
source venv/bin/activate
pip install -r requirements.txt
```

### Testing

[Tox](http://tox.readthedocs.io/) together with [pytest](https://docs.pytest.org/en/latest/) is used für testing.

First, you need to set the needed ENV variables. You can create a pytest.ini file with the ENV variables in it:

Example:
```ini
[pytest]
env =
API_TOKEN=<SECRET>
DATAVERSE_VERSION=4.8.4
BASE_URL=https://data.aussda.at
```

or define it in the shell.

Example:
```shell
export API_TOKEN=<SECRET>
export DATAVERSE_VERSION=4.8.4
export BASE_URL=https://data.aussda.at
```

To run through all tests (e. g. different python versions, packaging, docs, flake8, etc.), simply call tox from the root directory:
```shell
tox
```

When you only want to run the py36 test:
```shell
tox -e py36
```

### Documentation

Use Sphinx to create class and function documentation out of the doc-strings.

```
sphinx-build -b html docs/source docs/build/html
sphinx-apidoc -f -o docs/source ..
make html
```
[See more](https://pydataverse.readthedocs.io/en/latest/index.html#quickstart).

## CONTRIBUTE

In the spirit of free software, everyone is encouraged to help improve this project.

Here are some ways you can contribute:

- by reporting bugs
- by suggesting new features
- by translating to a new language
- by writing or editing documentation
- by writing code (**no pull request is too small**: fix typos in the user interface, add code comments, clean up inconsistent whitespace)
- by refactoring code or adding new features (please get in touch with us before you do, so we can syncronize the efforts and prevent misunderstandings)
- by [closing issues](https://github.com/AUSSDA/pyDataverse/issues)
- by [reviewing pull requests](https://github.com/AUSSDA/pyDataverse/pulls)

When you are ready, submit a [pull request](https://github.com/AUSSDA/pyDataverse).

### Submitting an Issue

We use the [GitHub issue tracker](https://github.com/AUSSDA/pyDataverse/issues) to track bugs and features. Before submitting a bug report or feature request, check to make sure it hasn't already been submitted. When submitting a bug report, please try to provide a screenshot that demonstrates the problem.
[See more](https://pydataverse.readthedocs.io/en/latest/index.html#contributor-guide).
3 changes: 0 additions & 3 deletions README.rst

This file was deleted.

77 changes: 77 additions & 0 deletions code-of-conduct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project lead at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

41 changes: 9 additions & 32 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,22 @@
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.3
check-manifest==0.37
coverage==4.5.2
certifi==2019.3.9
chardet==3.0.4
docutils==0.14
entrypoints==0.3
filelock==3.0.10
flake8==3.7.6
idna==2.8
imagesize==1.1.0
Jinja2==2.10.1
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
pluggy==0.11.0
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
Pygments==2.4.0
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
tox==3.11.0
tox-pytest-summary==0.1.2
tqdm==4.32.1
twine==1.13.0
urllib3==1.24.2
virtualenv==16.4.3
urllib3==1.24.3
virtualenv==16.6.0
webencodings==0.5.1
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def run_tests(self):
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 2 - Pre-Alpha',
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'License :: OSI Approved :: MIT License',
Expand Down Expand Up @@ -101,6 +101,8 @@ def run_tests(self):
keywords=['pydataverse', 'dataverse', 'api'],
zip_safe=False,
project_urls={
'Issue Tracker': 'https://github.com/AUSSDA/pyDataverse/issues'
'Documentation': 'https://pydataverse.readthedocs.io/',
'Issue Tracker': 'https://github.com/AUSSDA/pyDataverse/issues',
'Changelog': 'https://pydataverse.readthedocs.io/en/latest/community/releases.html'
}
)
Loading

0 comments on commit 2b1f2b8

Please sign in to comment.