An ASGI framework to build HTTP API's from a Python module structure.
Go to file
maxime 60ff99d0fb [domain] you can specify Schema components under the "schema_components" key of the domain dictionary 2023-08-02 12:55:04 +02:00
conf [release][0.1.0] First HalfAPI release 2020-07-23 17:54:47 +02:00
halfapi [domain] you can specify Schema components under the "schema_components" key of the domain dictionary 2023-08-02 12:55:04 +02:00
scripts [0.5.11] 2021-10-04 22:16:27 +02:00
tests [cli-conf] halfapi domain : the file provided as argument is a toml file of the format of .halfapi/config, + better config handling 2023-08-02 10:38:36 +02:00
.gitignore [0.5.3] 2021-06-17 18:53:23 +02:00
.gitlab-ci.yml [ci-cd] add python 3.11 to testing releases 2023-08-02 10:57:33 +02:00
CHANGELOG.md [rc] 0.6.28-rc0-1 2023-08-02 06:32:26 +02:00
Dockerfile [release] 0.6.21 2022-08-08 20:21:05 +02:00
LICENSE.txt [doc] update README and add joel to license 2021-11-16 17:45:40 +01:00
MANIFEST.in [package] fixed some paths 2020-08-27 09:54:48 +02:00
Pipfile [dev-deps] ajout de la dépendance a coverage 2023-08-02 10:43:50 +02:00
Pipfile.lock [dev-deps] ajout de la dépendance a coverage 2023-08-02 10:43:50 +02:00
README.md [doc][release] 0.7.0 2023-02-03 12:43:30 +01:00
optional-requirements.txt [lib/responses] ajout format XLSX, car ODS bug avec les dates 2022-05-17 10:30:15 +02:00
pyproject.toml [deps] Updated dependencies and added files for standard packaging. 2020-07-29 22:07:16 +02:00
pytest.ini [pytest] do not avoid to run doctest modules in halfapi sources! 2023-08-02 10:39:06 +02:00
requirements.txt [release] 0.6.13 2022-03-21 09:51:04 +01:00
setup.cfg [deps] Updated dependencies and added files for standard packaging. 2020-07-29 22:07:16 +02:00
setup.py [dev-deps] ajout de la dépendance a coverage 2023-08-02 10:43:50 +02:00

README.md

HalfAPI

Base tools to develop complex API with rights management.

This project was developped by Maxime Alves and Joël Maïzi. The name was chosen to reference HalfORM, a project written by Joël Maïzi.

Dependencies

  • python3
  • python3-pip
  • libgit2-dev
  • starlette
  • PyJWT
  • click
  • uvicorn
  • orjson
  • pyyaml

Configuration

Configure HalfAPI in the file : .halfapi/config .

It's a toml file that contains at least two sections, project and domains.

https://toml.io/en/

### Project

The main configuration options without which HalfAPI cannot be run.

secret : The file containing the secret to decode the user's tokens.

port : The port for the test server.

loglevel : The log level (info, debug, critical, ...)

Domains

Specify the domains configurations in the following form :

[domains.DOMAIN_NAME]
name = "DOMAIN_NAME"
enabled = true
prefix = "/prefix"
module = "domain_name.path.to.api.root"
port = 1002

Specific configuration can be done under the "config" section :

[domains.DOMAIN_NAME.config]
boolean_option = false
string_value = "String"
answer = 42
listylist = ["hello", "world"]

And can be accessed through the app's "config" dictionnary.

Usage

Develop an HalfAPI domain by following the examples located in tests/dummy_domain . An HalfAPI domain should be an importable python module that is available in the python path.

Run the project by using the halfapi run command.

You can try the dummy_domain with the following command.

PYTHONPATH=$PWD/tests python -m halfapi domain dummy_domain

CLI documentation

Use the CLI help.

python -m halfapi --help
python -m halfapi domain --help

API Testing

@TODO

Example

Check out the sample project that helps you to build your own domain.

Development

@TODO