An API to access Boavizta's methodologies and data
See the documentation for API usage and methodology.
🎯 Objective
Boavizta aims to enhance the assessment of environmental impacts induced by ICTs in organisations by providing widespread access to our work in an automated and efficient manner.
Boavizta integrates various data and methodologies, which are combined and made accessible through this API.
Transparency and the popularisation 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.
The system follows a bottom-up approach in its development, organised into layers. The initial layer focuses on equipment. The second layer focuses 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.
⚙️ What it does
BoaviztAPI estimates the environmental impacts of digital equipment or services. You describe a piece of hardware (a server, a cloud instance, a laptop, a single component such as a CPU or an SSD) and the API returns its impacts for two phases of its life:
- embedded: manufacturing, transport and end of life, spread over the equipment's lifetime
- use: the electricity it consumes, multiplied by the impact factors of the electricity mix where it runs
By default the results cover global warming potential (gwp, in kgCO2eq), abiotic resource depletion (adp, in kgSbeq) and primary energy (pe, in MJ). Other criteria can be requested.
For example, the impacts of an AWS m5.xlarge over 8,760 hours (one year) of use:
curl "https://api.boavizta.org/v1/cloud/instance?provider=aws&instance_type=m5.xlarge&duration=8760"
⏩ Test it yourself (no installation)
-
See our pedagogical front-end app (using the API): https://datavizta.boavizta.org/serversimpact
-
See the OpenAPI specification: https://api.boavizta.org/docs
-
Access the demo API: https://api.boavizta.org
Run a local instance
🐳 Run API using docker
$ docker run -p 5000:5000 ghcr.io/boavizta/boaviztapi:latest
Access the API at http://localhost:5000.
Install using pip package
$ pip3 install boaviztapi
Run the server locally with:
$ uvicorn boaviztapi.main:app --host=localhost --port 5000
💻 Development
Prerequisite
- Python >=3.12
- Poetry (see the install instructions)
make
Setup poetry
Install dependencies and check the environment is set up correctly:
$ make install
$ make test
$ make lint
Launch a development server
The development server uses uvicorn and FastAPI. You can launch the development server with the uvicorn CLI.
# Using uvicorn
$ make run
# Using Python directly (adds watcher)
$ make run-py
Tests
You can run the tests with pytest via:
make testto run all unit tests (using test data)make test-e2eto run end-to-end tests (using "real" data)
Work on docs
API documentation is build with mkdocs and maintained under the docs directory.
See how to work on documentation
Create your own docker image and run it
Build Docker image:
# Using the makefile (recommended)
make docker-build-development
make docker-run-development
# Manual build
docker build . -t boavizta-test
docker run -p 5000:5000 boavizta-test
Deploy to AWS as serverless application
You can self-host BoaviztAPI as an AWS Lambda function using Serverless Framework.
You must first configure:
Once done, you can deploy the API with:
serverless deploy
When the deploy succeeds, it will show you the URLs for the deployed function, and you can call the API as normal, e.g.
# Replace the base URL with your own
curl -s "https://k9wllbzcc2.execute-api.eu-west-1.amazonaws.com/v1/server/?archetype=dellR740"
You can check your Lambda URL at any time with:
serverless info
OpenAPI specification (Swagger)
Once API server is launched API swagger is available at httsp://localhost:5000/docs.
🤝 Adopters
BoaviztAPI is used by several open-source projects and tools. See ADOPTERS.md for the full list.
📦 SDKs
Community client libraries exist for other languages (PHP…). See SDKs.md for the list.
👩 Contributing
See contributing.md.
You can build a source distribution (installable with pip) with make build.
1️⃣ Versioning
We use Semantic Versioning 2.0.0
| Type | Description | Command |
|---|---|---|
| MAJOR | version when you make incompatible API changes | make major |
| MINOR | version when you add functionality in a backwards compatible manner | make minor |
| PATCH | version when you make backwards compatible bug fixes | make patch |
2️⃣ Releasing
See the Release Process wiki.
📜 Licence
GNU Affero General Public License v3.0
Metadata
Release files for boaviztapi 2.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| boaviztapi-2.6.0.tar.gz | 426.6 kB | Without provenance | Details for boaviztapi-2.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| boaviztapi-2.6.0-py3-none-any.whl | Python 3 | none | any | Details for boaviztapi-2.6.0-py3-none-any.whl |
Total release size: 900.6 kB
Release files / boaviztapi-2.6.0.tar.gz
| Download URL | boaviztapi-2.6.0.tar.gz |
|---|---|
| Size | 426.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aae3f0a962d566da5217e511bf81c48f2a878336d56904773afd3b3c11849816
|
|
BLAKE2b-256 checksum How to use checksums |
aed5d70bb8483458d637fad73bf36367f35cfe26b84f9fea9a32d2720586439c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.15 Linux/7.0.0-1017-azure
|
Release files / boaviztapi-2.6.0-py3-none-any.whl
| Download URL | boaviztapi-2.6.0-py3-none-any.whl |
|---|---|
| Size | 474.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ddedcc931b0e150a7c16b224a368dd1aecc95eba12f4da4c431bfd6eb706537
|
|
BLAKE2b-256 checksum How to use checksums |
30a3a672cc64700f1a80ae7b4a61e7e255720d2fb2e77d8d9166c3ce6baa7726
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.15 Linux/7.0.0-1017-azure
|
Security for boaviztapi 2.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.