<commit_before># CartoDB dataservices API python module

This directory contains the python library used by the server side of CartoDB LDS (Location Data Services).

It is used from pl/python functions contained in the `cdb_dataservices_server` extension. It goes hand in hand with the extension so please consider running the integration tests.

On the other hand, it is pretty independent from the client, as long as the signatures of the public pl/python functions match.

## Dependencies
See the [[`requirements.txt`]] or better the Basically:
- pip
- redis and hiredis
- dateutil
- googlemaps
- request

## Installation
Install the requirements:
```shell
sudo pip install -r requirements.txt
```

Install the library:
```shell
sudo pip install .
```

NOTE: a system installation is required at present because the library is meant to be used from postgres pl/python, which runs an embedded python interpreter.


## Running the unit tests
Just run `nosetests`
```shell
$ nosetests
.................................................
----------------------------------------------------------------------
Ran 49 tests in 0.131s

OK
```

## Running the integration tests
TBD

## TODO
- Move dependencies expressed in `requirements.txt` to `setup.py`<commit_msg>Instructions on how to run integration tests #204<commit_after># CartoDB dataservices API python module

This directory contains the python library used by the server side of CartoDB LDS (Location Data Services).

It is used from pl/python functions contained in the `cdb_dataservices_server` extension. It goes hand in hand with the extension so please consider running the integration tests.

On the other hand, it is pretty independent from the client, as long as the signatures of the public pl/python functions match.

## Dependencies
See the [[`requirements.txt`]] or better the Basically:
- pip
- redis and hiredis
- dateutil
- googlemaps
- request

## Installation
Install the requirements:
```shell
sudo pip install -r requirements.txt
```

Install the library:
```shell
sudo pip install .
```

NOTE: a system installation is required at present because the library is meant to be used from postgres pl/python, which runs an embedded python interpreter.


## Running the unit tests
Just run `nosetests`
```shell
$ nosetests
.................................................
----------------------------------------------------------------------
Ran 49 tests in 0.131s

OK
```

## Running the integration tests
See the [[../../../../test/README.md]]. Basically, move to the `/test` directory at the top level of this repo and execute the `run_tests.py` script:
```sh
cd $(git rev-parse --show-toplevel)/test
python run_tests.py --host=$YOUR_HOST $YOUR_USERNAME $YOUR_API_KEY
```

## TODO
- Move dependencies expressed in `requirements.txt` to `setup.py`
{'fraction_non_alphanumeric': 0.15627214741318213, 'fraction_numerical': 0.005315379163713678, 'mean_word_length': 2.953781512605042, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6015197', 'n_tokens_mistral': 745, 'n_tokens_neox': 698, 'n_words': 348}