-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,31 @@ | ||
# Installation | ||
|
||
The api is hosted as its own package in a dedicated git repository, https://github.itap.purdue.edu/ECN/webqueue2-api, and is easily installable via `pip`. | ||
|
||
### Install via command line | ||
This is the syntax for installing the api: | ||
``` | ||
pip install git+https://github.itap.purdue.edu/ECN/webqueue2-api@<version>#egg=webqueue2-api | ||
``` | ||
For example, to install version `0.9.1`, replace `<version>` in the above command like this: | ||
``` | ||
pip install git+https://github.itap.purdue.edu/ECN/webqueue2-api@0.9.1#egg=webqueue2-api | ||
``` | ||
|
||
### Install via requirements.txt | ||
Append this line in the requirements file: | ||
``` | ||
git+https://github.itap.purdue.edu/ECN/webqueue2-api@<VERSION>#egg=webqueue2-api | ||
``` | ||
For example, to install version `0.9.1`, replace `<version>` in the above line above like this: | ||
``` | ||
git+https://github.itap.purdue.edu/ECN/webqueue2-api@0.9.1#egg=webqueue2-api | ||
``` | ||
### Package Structure | ||
The name of the package itself is `webqueue2-api` and follows this structure: | ||
``` | ||
─webqueue2-api (git repo) | ||
│ | ||
├───__init__.py | ||
├───api.py | ||
├───ECNQueue.py | ||
└───setup.py | ||
``` | ||
**ECNQueue.py:** | ||
The parser that iterates through items and resturns a json formatted string. | ||
|
||
**api.py:** | ||
The bridge between the fronted and the parser: the frontend sends requests to `api.py` which are translated into functions present in the `ECNQueue.py`, and the json returned by `ECNQueue.py` is thus returned to the frontend. | ||
|
||
**setup.py:** | ||
Stores important information about the `webqueue2-api` package including: | ||
|
||
* The version | ||
* Dependencies that are installed with `webqueue2-api` | ||
* The name of the package (`webqueue2-api`) | ||
* The python version requirement, which is anything including and beyond python version 3.6 | ||
|
||
**\_\_init\_\_.py** | ||
Specifies to `pip` that the current directory is a package, doesn't contain any code, but any code contained within `__init__.py` is executed when ever the `webqueue2-api` package is imported. | ||
|
||
### Importing the package | ||
|
||
The package cannot be referenced directly (need to check on this), however, both the `api` and `ECNQueue` modules can be directly imported after successfully installing the webqueue2-api package: | ||
```python | ||
import ECNQueue | ||
import api | ||
``` | ||
The webqueue2 API is publicly available at [{{ production_url }}/api]({{ production_url }}/api) but you can install it on your own machine if you'd like. | ||
|
||
The code is available on [GitHub]({{ config.repo_url }}). Available package versions can be seen on the [releases page]({{ config.repo_url }}/releases) and can be installed via pip, a requirements file, or downloaded and installed manually. | ||
|
||
!!! warning "pip available on ECN machines needs updated." | ||
Installation via pip is possible through pip's [VCS support](https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support) which was introduced in pip 19. The version of pip available on ECN supported machines is too old and needs updated. To update pip, run: | ||
|
||
```bash | ||
pip install -U pop | ||
``` | ||
|
||
=== "Install via pip" | ||
To install webqueue2-api 0.9.1, you can run: | ||
|
||
``` | ||
pip install git+{{ config.repo_url }}@0.9.1#egg=webqueue2-api | ||
``` | ||
|
||
If you'd like a version other than 0.9.1 simply replace the that version number with a different version listed on the [releases page]({{ config.repo_url }}/releases). | ||
|
||
=== "Install via requirements file" | ||
To install webqueue2-api 0.9.1, place the following line your requirements file: | ||
|
||
```bash | ||
echo "git+{{ config.repo_url }}@0.9.1#egg=webqueue2-api" >> requirements.txt | ||
pip install -r requirements.txt | ||
``` | ||
|
||
If you'd like a version other than 0.9.1 simply replace the that version number with a different version listed on the [releases page]({{ config.repo_url }}/releases). |