Skip to content

Commit 8397ffe

Browse files
committed
SUPPO-1256: Wrap up Developer README. Clean up examples README.
1 parent 3ef949b commit 8397ffe

2 files changed

Lines changed: 86 additions & 60 deletions

File tree

DEVELOPER.md

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,42 @@
11
## Developer Information
22

3-
###
4-
Docker
5-
A Docker image for running the examples against the compiled source library is available on Docker Hub.
6-
7-
Command: docker run -e API_KEY=api-key -v "<binding root directory>:/source" rosetteapi/docker-python
8-
9-
Additional environment settings:
10-
11-
-e ALT_URL=<alternative URL>
12-
-e FILENAME=<single filename>
13-
14-
15-
### Doc README
16-
3+
### Testing
4+
To test changes you have made to the binding, you can use a pre-configured Docker environment. This environment will:
5+
- Compile the binding within the container.
6+
- Install the binding within the container.
7+
- Execute one or more example files using the installed binding.
8+
- The example files can be executed against a Cloud release or an Enterprise release.
9+
- If a test suite exists, it will also be executed.
10+
11+
```
12+
git clone git@github.com:rosette-api/python.git
13+
cd python
14+
# Modify the binding...
15+
docker run -e API_KEY=$API_KEY -v $(pwd):/source rosetteapi/docker-python
16+
```
17+
18+
Optional parameters for the `docker run` execution are:
19+
20+
- `-e ALT_URL=<alternative URL>`
21+
- For testing against an Enterprise environment or the staging environment.
22+
- `-e FILENAME=<single filename>`
23+
- For testing a single example file instead of all the example files.
24+
25+
To alter the behavior of the pre-configured Docker environment, you can see the Dockerfile source and entry-point
26+
script [here](https://git.basistech.net/raas/rapid-development-tools/tree/master/binding-dockerfiles).
27+
28+
### Documentation Generation
29+
The existing README for documentation generation is [here](docs/README.md).
30+
The next time the API documentation is touched, please refresh the README and migrate it here.
1731

1832
### Examples README
33+
There's an old [Docker README](examples/docker) in the examples directory that might be a candidate for removal.
1934

35+
### Building A Release
36+
See the [instructions](https://git.basistech.net/raas/rapid-development-tools/tree/master/publish)
2037

21-
### Build Release
22-
...
38+
### TODOs
39+
- Inconsistent references with `rosette_api` and `rosette-api`
40+
- Doc generation README cleanup?
41+
- Example Docker file still needed?
42+
- `docker-compose.yaml` still needed?

examples/README.md

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,50 @@
1-
Python Examples
2-
==================
3-
4-
These examples are scripts that can be run independently to demonstrate the Rosette API functionality.
5-
6-
Prerequisite: Either run `pip install rosette_api` or run `python setup.py install` in the python top level folder.
7-
8-
Alternatively, you can run all the examples with the command line:
9-
`find -maxdepth 1 -name "*.py" -exec tox -- {} --key api-key --url alternate_url \;`
10-
11-
You can now run your desired _endpoint_.py file to see it in action.
12-
For example, run `python/examples/categories.py` if you want to see the categories
13-
functionality demonstrated.
14-
15-
All files require you to input your Rosette API User Key after --key to run.
16-
For example: `python ping.py --key 1234567890`
17-
All also allow you to input your own service URL if desired.
18-
For example: `python ping.py --key 1234567890 --service_url http://www.myurl.com`
19-
Some (specified below) allow an additional input of either a file (.html or .txt) or a URL with `--file` or `--url`
20-
21-
Each example, when run, prints its output to the console.
22-
23-
| File Name | What it does |
24-
| ------------- |------------- |
25-
| categories.py | Gets the category of a document at a URL |
26-
| entities.py | Gets the entities from a piece of text |
27-
| info.py | Gets information about Rosette API |
28-
| language.py | Gets the language of a piece of text |
29-
| matched-name.py | Gets the similarity score of two names |
30-
| morphology_complete.py | Gets the complete morphological analysis of a piece of text|
31-
| morphology_compound-components.py | Gets the de-compounded words from a piece of text |
32-
| morphology_han-readings.py | Gets the Chinese words from a piece of text |
33-
| morphology_lemmas.py | Gets the lemmas of words from a piece of text |
34-
| morphology_parts-of-speech.py | Gets the part-of-speech tags for words in a piece of text |
35-
| name_deduplication.py | De-duplicates a list of names |
36-
| ping.py | Pings the Rosette API to check for reachability |
37-
| relationships.py | Gets the relationships between entities from a piece of text |
38-
| sentences.py | Gets the sentences from a piece of text |
39-
| sentiment.py | Gets the sentiment of a local file |
40-
| tokens.py | Gets the tokens (words) from a piece of text |
41-
| topics.py | Returns key phrases and concepts from provided content |
42-
| translated-name.py | Translates a name from one language to another |
43-
| transliteration.py | Transliterates the given text |
44-
1+
## Endpoint Examples
2+
3+
Each example file demonstrates one of the capabilities of the Rosette Platform.
4+
5+
Here are some methods for running the examples. Each example will also accept an optional `--url` parameter for
6+
overriding the default URL.
7+
8+
A note on pre-requisites. Rosette API only supports TLS 1.2 so ensure your toolchain also supports it.
9+
10+
#### Virtualenv/Latest Release
11+
```
12+
git clone git@github.com:rosette-api/python.git
13+
cd python/examples
14+
virtualenv rosette_venv
15+
source rosette_venv/bin/activate
16+
pip install rosette_api
17+
python ping.py -k $API_KEY
18+
```
19+
20+
#### Virtualenv/Local Source
21+
```
22+
git clone git@github.com:rosette-api/python.git
23+
cd python
24+
virtualenv rosette_venv
25+
source rosette_venv/bin/activate
26+
python setup.py install
27+
cd examples
28+
python ping.py -k $API_KEY
29+
```
30+
31+
#### Docker/Latest Release
32+
```
33+
git clone git@github.com:rosette-api/python.git
34+
cd python/examples
35+
docker run -it -v $(pwd):/source --entrypoint bash python:3.6-slim
36+
cd /source
37+
pip install rosette_api
38+
python ping.py -k $API_KEY
39+
```
40+
41+
#### Docker/Local Source
42+
```
43+
git clone git@github.com:rosette-api/python.git
44+
cd python
45+
docker run -it -v $(pwd):/source --entrypoint bash python:3.6-slim
46+
cd /source
47+
python setup.py install
48+
cd examples
49+
python ping.py -k $API_KEY
50+
```

0 commit comments

Comments
 (0)