semvec/pypi-packages huggingface dataset:
pytest-data-from-files 0.2.0
pytest plugin to provide data from files loaded automatically
License: MIT

Overview
==========

.. .. image:: https://img.shields.io/pypi/v/pytest_data_from_files.svg
   :target: https://pypi.python.org/pypi/pytest_data_from_files/
   :alt: [Latest Version]

.. .. image:: https://img.shields.io/pypi/pyversions/pytest_data_from_files.svg
   :target: https://pypi.python.org/pypi/pytest_data_from_files/
   :alt: [Python versions]

.. .. image:: https://img.shields.io/pypi/l/pytest_data_from_files.svg
   :target: https://pypi.python.org/pypi/pytest_data_from_files/
   :alt: MIT License

.. image:: https://github.com/ssato/pytest-data-from-files/workflows/Tests/badge.svg
   :target: https://github.com/ssato/pytest-data-from-files/actions?query=workflow%3ATests
   :alt: [Github Actions: Test status]

A pytest plugin to provide fixtures to load test data from files automatically.

Usage
======

Fixtures
----------

This plugin provides following fixtures for each test modules.

test_data_info
^^^^^^^^^^^^^^^^

*test_data_info* provides a namedtuple object, `data_from_files.ModuleInfo`,
has the following values for each test modules.

- root: test root dir, <package_dir>/tests/ by default and is configurable with --test-root (test_root) option.
- datadir: test data dir using the fixture will be searched under <root>/<test_data_dirname>/,  where test_data_dirname is configurable with --test-data-dirname option.

  - if the test code using the fixture is tests/test_foo.py, then datadir becomes tests/data/foo/
  - if the test code using the fixture is tests/foo/bar/test_baz.py, then datadir becomes tests/data/foo/bar/baz

- subdirs: names of sub dirs relative to datadir if such dirs exist.

test_data
^^^^^^^^^^

*test_data* provides a list of or a list of lists of namedtuple objects,
`data_from_files.DataInfo`, has the following values.

- data: data loaded from a file <path> under <datadir>
- path: a file path contains the data
- datadir: dir contains the test data file

Options
---------------

- --test-root: test root dir where test data are seached [<package_dir>/tests]
- --test-data-dirname: test data dir name [data]
- --test-data-pattern: test data file path pattern relative to datadir [\*\*/\*.\*]

Examples
-----------

- tests/test_plugin.py and test data under tests/data/plugin/
- tests/test_plugin_no_data.py and test data under tests/data/plugin_no_data
- tests/foo/test_bar.py and test data under tests/data/foo/bar

Installation
==============

Requirements
---------------

- pytest obviously
- PyYAML [#]_ is optionally required to load data from YAML files
- anyconfig [#]_ is optionally required to load data in formats anyconfig and/or its plugins support.

.. [#] PyYAML: https://pyyaml.org
.. [#] anyconfig: https://github.com/ssato/python-anyconfig

How to install
----------------

- PyPI::

    pip install pytest_data_from_files

- From git repo::

    pip install git+https://github.com/ssato/pytest-data-from-files

- Build wheel and install it::

    tox -e dists && pip install dist/pytest_data_from_files-*.whl

.. vim:sw=2:ts=2:et:
mendeley-cli 0.3.0
Mendeley CLI
License: MIT

# mendeley-cli
CLI for Mendeley

# Install

```
pip install mendeley-cli
```

Docker image is also available.

```
docker image pull makisyu/mendeley
```

# How to get Mendeley API token

To create, update, and delete resources in your Mendeley library via Mendeley API, OAUTH2 flow is required.
We have to register and mark this mendeley-cli as a trusted application in your Mendeley (Elsevier) account by yourself.

## 1. Register mendeley-cli as a trusted app

https://dev.mendeley.com/myapps.html

Register a new app (if not exists)

### Example

All fields are required.

* **Application name**: MendeleyCLI
* **Description**: MendeleyCLI
* **RegirectURL**: http://localhost:8888
  * Port number is a variable; >1024 is recommended.
* Generate secret, and save it securely.
* Submit

You got Client ID, Client Secret and Redirect URL.

## 2. Generate OAUTH2 token

In a terminal, with setting the parameters by environment variables, get token by `mendeley get token`:

```
MENDELEY_CLIENT_ID=<...> MENDELEY_CLIENT_SECRET=<...> MENDELEY_REDIRECT_URI=<...> mendeley get token
```

Automatically web browser opens and shows the login page, and please login.

Then, the following messages show:

```
Login succeeded. You can close this window or tab.
Please follow messages in the terminal to save your token.
```

Also, the following messages show in the terminal:

```
Login succeeded.
Please set an environment variable MENDELEY_OAUTH2_TOKEN_BASE64, or add it to a config file:

MENDELEY_OAUTH2_TOKEN_BASE64=<...>
```

Now, all parameters to run mendeley_cli is retrieved.

## 3. Configure mendeley_cli

Save them to configuration file:

```
MENDELEY_CLIENT_ID=<...>
MENDELEY_REDIRECT_URI=<...>
MENDELEY_CLIENT_SECRET=<...>
MENDELEY_OAUTH2_TOKEN_BASE64=<...>
```

The configuration file must be `~/.mendeley_cli/config` or `<pwd>/.mendeley_cli/config`.
Alternatively, they can be specified by environment variables directly.

## 4. All set!

Run

```
mendeley get documents
```