Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(python): upgrade to Python 3.12 #347

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build_client_sdk_with_poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,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 Down Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Build the pip package and push it
run: |
sudo chown -R $(whoami) boaviztapi_sdk
SDK_VERSION=$(poetry version -s)
SDK_VERSION=$(poetry version -s)
echo "SDK_VERSION == ${SDK_VERSION}"
cd boaviztapi_sdk
sed -i "s/^VERSION.*/VERSION = \"${SDK_VERSION}\"/" setup.py
Expand Down
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PY_VERSION=3.9
ARG PY_VERSION=3.12
FROM python:$PY_VERSION-slim AS build-env

ARG VERSION
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ TIMESTAMP := $(shell date "+%H.%M-%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
30 changes: 15 additions & 15 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,7 +109,7 @@ 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
Expand Down Expand Up @@ -146,7 +146,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 +162,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
Loading