Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
da-ekchajzer committed Dec 13, 2024
2 parents 62abb24 + 7f03117 commit 35f1161
Show file tree
Hide file tree
Showing 12 changed files with 290 additions and 410 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/build_client.yml

This file was deleted.

84 changes: 0 additions & 84 deletions .github/workflows/build_client_sdk_with_poetry.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/generate_requirements_for_clever_cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9' # Choose your Python version
python-version: '3.12' # Choose your Python version

- name: Install Poetry
run: |
Expand All @@ -33,14 +33,14 @@ jobs:
- name: Install dependencies
run: poetry install


- name: Export requirements.txt
run: |
poetry export --without-hashes --format=requirements.txt > requirements.txt
- run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git config --local user.name "github-actions[bot]"
- run: git add requirements.txt
- run: git commit --m 'generate requirements.txt from poetry' || exit 0
- run: git push
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.12'

- name: Install pipenv
run: |
Expand All @@ -42,7 +42,7 @@ jobs:
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
make install
- name: Run test suite
run: make test

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
test:
strategy:
matrix:
version: ["3.9", "3.10", "3.11"]
version: ["3.10", "3.11", "3.12"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
CURRENT_VERSION := $(shell poetry version -s || sed -n '3s/.*version = "\(.*\)"/\1/p' pyproject.toml)
TIMESTAMP := $(shell date "+%H.%M-%m-%d-%y")
TIMESTAMP := $(shell date "+%m-%d-%y")
DOCKER_NAME := boavizta/boaviztapi:${CURRENT_VERSION}
SEMVERS := major minor patch

MINIMUM_PY_VERSION=3.9
MAXIMUM_PY_VERSION=3.11
MINIMUM_PY_VERSION=3.10
MAXIMUM_PY_VERSION=3.12

clean:
find . -name "*.pyc" -exec rm -rf {} \;
Expand Down Expand Up @@ -64,3 +64,6 @@ docker-build:

docker-build-development:
docker build -t boavizta/boaviztapi:${TIMESTAMP} . --build-arg VERSION=${TIMESTAMP}

docker-run-development:
docker run -p 5000:5000 boavizta/boaviztapi:${TIMESTAMP}
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Boavizta integrates various data and methodologies, which are combined and made

Transparency and the popularization of scientific knowledge are of utmost importance in this project, and key aspects include open-sourcing the code, versioning the impact factors, and thoroughly documenting the project.

In the interest of transparency and scientific popularization, the opening of the code, the versioning of the impact factors and the documentation of the project are critical points.
In the interest of transparency and scientific popularization, the opening of the code, the versioning of the impact factors and the documentation of the project are critical points.

The system follows a bottom-up approach in its development, organized into layers. The initial layer focuses on equipment. The second layer focues on the impacts of digital services (e.g. cloud instances) or systems. However, assessing the overall global impact of ICT is currently beyond the project's scope.

## :fast_forward: Test it yourself (no installation)

* See our pedagogical front-end app (using the API) : <https://datavizta.boavizta.org/serversimpact>
* See our pedagogical front-end app (using the API): <https://datavizta.boavizta.org/serversimpact>

* See the OpenAPI specification: <https://api.boavizta.org/docs>

Expand All @@ -44,15 +44,15 @@ The system follows a bottom-up approach in its development, organized into layer
$ docker run -p 5000:5000 ghcr.io/boavizta/boaviztapi:latest
```

Access API at http://localhost:5000
Access the API at http://localhost:5000.

### Install using pip package

```bash
$ pip3 install boaviztapi
```

Then you can run the server locally with :
Run the server locally with:

```bash
$ uvicorn boaviztapi.main:app --host=localhost --port 5000
Expand All @@ -62,17 +62,17 @@ $ uvicorn boaviztapi.main:app --host=localhost --port 5000

### Prerequisite

Python 3 mandatory, python >=3.9 recommended, poetry recommended
Python 3 mandatory, Python >=3.10 and [Poetry](https://python-poetry.org/) strongly recommended.

### Setup poetry

Install poetry.
Install poetry (see the [install instructions](https://python-poetry.org/docs/) for more details):

```bash
$ pip3 install poetry
```

Install dependencies and create a python virtual environment.
Install dependencies and create a Python virtual environment:

```bash
$ make install
Expand All @@ -83,23 +83,23 @@ $ poetry shell

**Once in the poetry environment**

Development server uses [uvicorn](https://www.uvicorn.org/) and [fastapi](https://fastapi.tiangolo.com/), you can launch development server with the `uvicorn` CLI.
The development server uses [uvicorn](https://www.uvicorn.org/) and [FastAPI](https://fastapi.tiangolo.com/). You can launch the development server with the `uvicorn` CLI.

```bash
$ uvicorn boaviztapi.main:app --host=localhost --port 5000
```

You can run the tests with `pytest`.
You can run the tests with `pytest` via `make test`.

### Create your own docker image and run it

Build application package
Build application package:

```sh
make install
```

Build docker image
Build Docker image:

```sh
# using the makefile (recommended)
Expand All @@ -109,16 +109,18 @@ make docker-build
docker build --build-arg VERSION=`poetry version -s` .
```

Run docker image
Run Docker image:

```sh
docker run -p 5000:5000/tcp boavizta/boaviztapi:latest
docker run -p 5000:5000/tcp boavizta/boaviztapi:`poetry version -s`
```

#### Alternative (if you don't have Python or Poetry)

```sh
make docker-build-development

make docker-run-development
```

### Deploy to AWS as serverless application
Expand Down Expand Up @@ -146,7 +148,7 @@ Once API server is launched API swagger is available at [httsp://localhost:5000/

## :woman: Contributing

See [contributing.md](./CONTRIBUTING.md)
See [contributing.md](./CONTRIBUTING.md).

You can build a source distribution (installable with pip) with `make build`.

Expand All @@ -162,10 +164,10 @@ We use [Semantic Versioning 2.0.0](https://semver.org/)

## :two: Publishing

You can run :
You can run:

```shell
API_TOKEN=<your_token> make distribute
API_TOKEN=<your_token> make distribute
```

## :scroll: License
Expand Down
Loading

0 comments on commit 35f1161

Please sign in to comment.