Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![PyPI version](https://img.shields.io/pypi/v/aloha)](https://pypi.python.org/pypi/aloha/)
[![PyPI Downloads](https://img.shields.io/pypi/dm/aloha)](https://pepy.tech/badge/aloha/)
[![Code Activity](https://img.shields.io/github/commit-activity/m/LabNow-ai/aloha-python)](https://github.com/LabNow-ai/aloha-python/pulse)
[![Recent Code Update](https://img.shields.io/github/last-commit/LabNow-ai/docker-images.svg)](https://github.com/LabNow-ai/aloha-python/stargazers)
[![Recent Code Update](https://img.shields.io/github/last-commit/LabNow-ai/aloha-python.svg)](https://github.com/LabNow-ai/aloha-python/stargazers)

Please generously STAR★ our project or donate to us!
[![GitHub Starts](https://img.shields.io/github/stars/LabNow-ai/aloha-python.svg?label=Stars&style=social)](https://github.com/LabNow-ai/aloha-python/stargazers)
Expand Down
7 changes: 1 addition & 6 deletions doc/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-lts-latest
tools:
python: "3"
# nodejs: "latest"
# apt_packages: []
jobs:
pre_create_environment:
- echo "Command run at 'pre_create_environment' step"
Expand All @@ -21,9 +17,8 @@ build:
mkdocs:
configuration: ./doc/mkdocs.yml

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: ./doc/requirements.txt
- method: pip
path: ./src
extra_requirements: [docs, base]
35 changes: 0 additions & 35 deletions doc/README-cli.md

This file was deleted.

80 changes: 0 additions & 80 deletions doc/README-config.md

This file was deleted.

13 changes: 0 additions & 13 deletions doc/README-get-start.md

This file was deleted.

35 changes: 35 additions & 0 deletions doc/en/README-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Common Tasks

## Test whether aloha is properly installed

```bash
aloha info
```

This displays package version information.

## Start a function from the main function entrypoint

```bash
aloha start package_name.module_name
# e.g.: aloha start app_common.debug
```

Note: this `module_name` **must** include a function named `main()`.

## Compile Python code into binary

Sometimes you need to compile Python source code into binary libraries to protect source code.

Aloha helps you build Python source code into binaries using `Cython`:

```bash
aloha compile --base=./app --dist=./build --keep='main.py'
```

Available options:

- `--base`: root folder that includes source code to build
- `--dist`: (default=`build`) target folder for binary code
- `--exclude`: files/folders to exclude (use multiple times for multiple paths)
- `--keep`: source files to keep as-is instead of converting to dynamic libraries (use multiple times)
52 changes: 52 additions & 0 deletions doc/en/README-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Configurations

## OS environment variables

### `ENV_PROFILE`

*Default value*: `None` (not defined).

Define the environment profile for the current process, such as `DEV | STG | PRD`.
This is usually used to decide which config file in `${DIR_CONFIG}` should be used as the entrypoint config.

If this environment variable is defined, `aloha` will first search for `main-${ENV_PROFILE}.conf`; otherwise it uses `main.conf`.

### `ENTRYPOINT`

*Default value*: `None` (not defined).

Define the entrypoint **Python module** when using `aloha start` to start a service/process.
It is equivalent to `aloha start ${ENTRYPOINT}`.

The specified **Python module must** contain a `main()` function.

### `APP_MODULE`

*Default value*: `default`.

Define the application module name. It is mapped to config variable `APP_MODULE` and used as the prefix for log files.

### `DIR_LOG`

*Default value*: `logs`.

Define where log files are stored.

### `DIR_RESOURCE`

*Default value*: `resource` under the current working directory.

Define the resource folder. It will be used as the root directory by `aloha.config.paths.get_resource_dir()`.

### `DIR_CONFIG`

*Default value*: `${DIR_RESOURCE}/config`.

Define where to find configuration files.

### `FILES_CONFIG`

*Default value*: `None` (not defined).

Optional. Define a comma-separated list of config files to load.
If this variable is set, `ENV_PROFILE` is ignored.
6 changes: 3 additions & 3 deletions doc/README-develop.md → doc/en/README-develop.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Development Docs

## Live debug on source code using docker
## Live debug source code with Docker

```bash
# Firstly, cd to the project root folder (which includes `src`) of the project, and then:
# First, cd to project root (which includes `src`), then run:
docker run -it \
-v $(pwd):/root/app/ \
-w /root/app/src \
Expand All @@ -14,7 +14,7 @@ docker run -it \
python -m aloha.script.start app_common.debug
```

## Build docker image
## Build Docker image

```bash
source tool/tool.sh
Expand Down
13 changes: 13 additions & 0 deletions doc/en/README-get-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Getting Started

## Step 1. Install the Python package

```title="Install aloha with all extra requirements"
pip install aloha[all]
```

## Step 2. Start your project based on the template

You can refer to the `app` folder in the GitHub repository to start using `aloha` in your project:

[:octicons-mark-github-16: Go to Template Project](https://github.com/LabNow-ai/aloha-python/tree/main/app){ .md-button }
File renamed without changes.
42 changes: 42 additions & 0 deletions doc/en/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Introduction

Aloha! Thanks for your interest in this Python package.

[![License](https://img.shields.io/github/license/LabNow-ai/aloha-python)](https://github.com/LabNow-ai/aloha-python/blob/main/LICENSE)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/LabNow-ai/aloha-python/build.yml?branch=main)](https://github.com/LabNow-ai/aloha-python/actions)
[![Join the Gitter Chat](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/LabNow-ai/)
[![PyPI version](https://img.shields.io/pypi/v/aloha)](https://pypi.python.org/pypi/aloha/)
[![PyPI Downloads](https://img.shields.io/pypi/dm/aloha)](https://pepy.tech/badge/aloha/)
[![Code Activity](https://img.shields.io/github/commit-activity/m/LabNow-ai/aloha-python)](https://github.com/LabNow-ai/aloha-python/pulse)
[![Recent Code Update](https://img.shields.io/github/last-commit/LabNow-ai/aloha-python.svg)](https://github.com/LabNow-ai/aloha-python/stargazers)

Please generously STAR our project or donate to us! [![GitHub Stars](https://img.shields.io/github/stars/LabNow-ai/aloha-python.svg?label=Stars&style=social)](https://github.com/LabNow-ai/aloha-python/stargazers)

The Python package `aloha` is a versatile toolkit for building Python microservices.
It encapsulates commonly used components and features, such as:

- Rapidly creating RESTful APIs and starting services
- Logging utilities
- Managing environments, configuration files, and resource files
- Connecting to popular databases
- Detecting and monitoring runtime environments

## Installation

```title="Install aloha with extra requirements"
pip install aloha[all]
```

Notice that `[all]` after the package name is a set of extra requirements that enable additional features.

These extras include:

- `all`: includes everything listed below
- `service`: packages used to build RESTful APIs (`aloha` uses Tornado for services)
- `build`: compile Python code into binary files, useful for source code protection
- `db`: connect to popular databases, such as MySQL / PostgreSQL / Redis
- `stream`: process stream data using `confluent_kafka`
- `data`: process data or do data science tasks using packages like `pandas`
- `report`: export data and reports to Excel files
- `test`: unit test utilities
- `docs`: documentation build utilities
Loading