Metadata-Version: 2.1
Name: service-markets
Version: 0.3.1
Summary: Software-as-a-Service (SaaS) Marketplace with cryptocurrency payments
License: AGPL-3.0
Author: Mike Hukiewitz
Author-email: mike.hukiewitz@robotter.ai
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: PyNaCl (>=1.5.0,<2.0.0)
Requires-Dist: aars (>=0.7.2,<0.8.0)
Requires-Dist: aiohttp (>=3.8.4,<4.0.0)
Requires-Dist: aleph-sdk-python (>=0.6.0,<0.7.0)
Requires-Dist: base58 (>=2.1.1,<3.0.0)
Requires-Dist: fastapi (>=0.95.1,<0.96.0)
Requires-Dist: fastapi-walletauth (>=0.1.7,<0.2.0)
Requires-Dist: pydantic (>=1.10.8,<2.0.0)
Requires-Dist: python-multipart (>=0.0.6,<0.0.7)
Requires-Dist: requests (>=2.30.0,<3.0.0)
Requires-Dist: semver (>=3.0.0,<4.0.0)
Description-Content-Type: text/markdown

# service.markets
Software-as-a-Service (SaaS) Marketplace with cryptocurrency payments

Service.markets runs on [FastAPI](https://fastapi.tiangolo.com/) and uses [Aleph.im](https://aleph.im/) for decentralized hosting. 
## Initial setup
Install the FastAPI library and Uvicorn:
```shell
poetry install
```
Activate the virtual environment, if not already done:
```shell
poetry shell
```

## Run on local

### Running the API
Uvicorn is used to run ASGI compatible web applications, such as the `app`
web application from the example above. You need to specify it the name of the
Python module to use and the name of the app:
```shell
python -m uvicorn src.service_markets.api.main:app --reload
```

Then open the app in a web browser on http://localhost:8000

> Tip: With `--reload`, Uvicorn will automatically reload your code upon changes  

## Testing
To run the tests, you need to [install the dev dependencies](#installing-dev-dependencies).

In order to avoid indexing all the messages and starting out with an empty database, you need to set the `TEST_CHANNEL` environment variable to `true`:
```shell
export TEST_CHANNEL=true
```

Then, you can run the API tests with:
```shell
poetry run pytest src/service_markets/api/test.py
```

**Note**: The tests run sequentially and if one fails, the following ones will also fail due to the event loop being closed.

## Environment variables

| Name            | Description                                               | Type     | Default |
|-----------------|-----------------------------------------------------------|----------|---------|
| `TEST_CACHE`    | Whether to use the test cache                             | `bool`   | `true`  |
| `TEST_CHANNEL`  | Whether to use a fresh test channel                       | `bool`   | `false` |
| `ALEPH_CHANNEL` | The Aleph channel to use, is superseded by `TEST_CHANNEL` | `string` | `None`  |
