Skip to main content

A common data model for the eflips family of electric vehicle simulation & optimization tools.

Project description

Unit Tests Code style: black

eflips-model

This repository contains both the reference specification and an SQLALchemy implementation of the eFLIPS database.

Reference Specification

The reference specification is located (for now) in the huge PDF file schema.pdf. It is a UML diagram of the database schema. The diagram was created using OmniGraffle (proprietary).

SQLAlchemy Implementation

The SQLAlchemy implementation is located in the eflips/model directory. It is a Python package that contains the SQLAlchemy models and the database migration scripts. The package is structured as follows:

Installation

Releases of the package will be made available on https://pypi.org/. As such, it is installable with pip install eflips-model. However, it should be used by including it in other packages as a dependency. The versioning scheme is semantic versioning. This means that:

  • patch releases (e.g. 1.0.0 to 1.0.1) are backwards compatible bug fixes, without schama changes
  • minor releases (e.g. 1.0.0 to 1.1.0) are backwards compatible feature additions, with the schema changes being optional
  • major releases (e.g. 1.0.0 to 2.0.0) are backwards incompatible changes, with the schema changes being mandatory

Supported database backends are

  • PostgreSQL with the PostGIS extension and btree_gist (CREATE EXTENSION btree_gist;)

Usage

This package is not expected to be used directly. It is a dependency of the eflips-* packages.

This package utilizes GIS extensions through GeoAlchemy. However, we are not handling geometry on the python side in any special way. You will probably additionally need Shapely and pyProj, which are not pure python packages and require additional dependencies to be installed on the system.

Documentation

The documentation is generated using sphinx. To generate the documentation, execute the following command in the root directory of the repository:

sphinx-build doc/ doc/_build -W

Development

We utilize the GitHub Flow branching structure. This means that the main branch is always deployable and that all development happens in feature branches. The feature branches are merged into main via pull requests. We utilize the semantic versioning scheme for versioning.

Dependencies are managed using poetry. To install the dependencies, execute the following command in the root directory of the repository:

poetry install

We use black for code formatting. You can use black . to format the code.

We use MyPy for static type checking. You can use mypy --strict --explicit-package-bases eflips/ to run MyPy on the code.

Please make sure that your poetry.lock and pyproject.toml files are consistent before committing. You can use poetry check to check this. This is also checked by pre-commit.

You can use pre-commit to ensure that MyPy, Black, and Poetry are run before committing. To install pre-commit, execute the following command in the root directory of the repository:

We recommend utilizing linters such as PyLint for static code analysis (but not doing everything it says blindly).

Testing

We use pytest for testing. The tests are located in the tests directory. To run the tests, execute the following command in the root directory of the repository (after installing the dev dependencies):


NOTE: Be aware that the tests will clear the database specified in the DATABASE_URL environment variable. Make sure that you are not using a database that you want to keep.


# Change to your database URL
export DATABASE_URL=postgresql://user:pass@hostname:port/dbname 
pytest

License

This project is licensed under the AGPLv3 license - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eflips_model-1.1.5.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

eflips_model-1.1.5-py3-none-any.whl (43.3 kB view details)

Uploaded Python 3

File details

Details for the file eflips_model-1.1.5.tar.gz.

File metadata

  • Download URL: eflips_model-1.1.5.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Darwin/23.3.0

File hashes

Hashes for eflips_model-1.1.5.tar.gz
Algorithm Hash digest
SHA256 a973f9ed076bb0188351803b42b754f6b655a18e248a751c29f41a5db1fc01b7
MD5 4ac509fd40d331bc9fc237ea1f407261
BLAKE2b-256 bf49b2072e0a733aa24591afd831a7012471b1b52b76bf73e689e8e37353af13

See more details on using hashes here.

File details

Details for the file eflips_model-1.1.5-py3-none-any.whl.

File metadata

  • Download URL: eflips_model-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 43.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Darwin/23.3.0

File hashes

Hashes for eflips_model-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c914a043a3546bf65c369a246d0abe9322c731345db6fc08c954ca3d25f3cbc4
MD5 aa43481526ed90630940abc36ee79f29
BLAKE2b-256 ab177205f6a9f91f690cd68e3840b3c3806e9eb97cd091698236e01b58158b1a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page