2024-07-04 22:08:17 +02:00
|
|
|
|
# Develop
|
|
|
|
|
|
|
|
|
|
For now Docker is a primary way of working on the repo.
|
2024-11-26 00:11:49 +01:00
|
|
|
|
However dependencies are still needed to installed locally for
|
|
|
|
|
the IDE setup.
|
|
|
|
|
|
|
|
|
|
## Requirements:
|
|
|
|
|
|
|
|
|
|
Python: 3.12+
|
|
|
|
|
NodeJS: 18+
|
2024-07-04 22:08:17 +02:00
|
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
2024-11-26 00:11:49 +01:00
|
|
|
|
1. Check if python 3.12 is installed in the system:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
which python 3.12
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
If no path returned, follow [installation instructions](./FAQ.md#how-do-i-install-python-312-on-ubuntu-22)
|
|
|
|
|
|
|
|
|
|
2. Install `virtualenv` package if it's not installed.
|
2024-07-04 22:08:17 +02:00
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
pip install --user virtualenv
|
|
|
|
|
```
|
|
|
|
|
|
2024-11-26 00:11:49 +01:00
|
|
|
|
3. Create a virtual environment:
|
2024-07-04 22:08:17 +02:00
|
|
|
|
|
|
|
|
|
```sh
|
2024-11-26 00:11:49 +01:00
|
|
|
|
virtualenv python=3.12 venv
|
2024-07-04 22:08:17 +02:00
|
|
|
|
```
|
|
|
|
|
|
2024-11-26 00:11:49 +01:00
|
|
|
|
4. Activate the virtual environment.
|
2024-07-04 22:08:17 +02:00
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
# Windows ➞ venv\Scripts\activate
|
|
|
|
|
source venv/bin/activate
|
|
|
|
|
```
|
|
|
|
|
|
2024-11-26 00:11:49 +01:00
|
|
|
|
5. Install python packages.
|
2024-07-04 22:08:17 +02:00
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
pip install --requirement requirements.txt
|
|
|
|
|
```
|
|
|
|
|
|
2024-11-26 00:11:49 +01:00
|
|
|
|
6. Install `pre-commit` hooks.
|
2024-07-04 22:08:17 +02:00
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
pre-commit install --install-hooks
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Build
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
docker-compose build
|
|
|
|
|
docker-compose up --detach
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
In a browser, visit [`http://localhost:8000/`]
|
|
|
|
|
|
|
|
|
|
## Manual
|
|
|
|
|
|
2024-11-26 00:11:49 +01:00
|
|
|
|
1. Run the API dev server:
|
2024-07-04 22:08:17 +02:00
|
|
|
|
|
2024-11-26 00:11:49 +01:00
|
|
|
|
```sh
|
|
|
|
|
pytnon -m src web
|
|
|
|
|
```
|
|
|
|
|
2. Run frontend dev server:
|
2024-07-04 22:08:17 +02:00
|
|
|
|
|
2024-11-26 00:11:49 +01:00
|
|
|
|
```sh
|
|
|
|
|
python -m src webpack
|
|
|
|
|
```
|
2024-07-04 22:08:17 +02:00
|
|
|
|
|
|
|
|
|
## Git
|
|
|
|
|
|
|
|
|
|
Configure `git` to store credentials:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
git config credential.helper store
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
After the next time creds are accepted, they will be saved on hard drive
|
|
|
|
|
as per rules listed in `man git-credential-store`and won't be asked again.
|
|
|
|
|
|
|
|
|
|
Alternatively they can be stored temporarily in memory:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
git config credential.helper cache
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The creds are stored as per rules in `man git-credential-cache`.
|
|
|
|
|
|
|
|
|
|
## IDE
|
|
|
|
|
|
|
|
|
|
_IDE specific instructions._
|
|
|
|
|
|
|
|
|
|
### VSCode
|
|
|
|
|
|
|
|
|
|
1. Copy `.code-workspace` file.
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
cp \
|
|
|
|
|
configs/workspace.code-workspace.example \
|
|
|
|
|
kemono-2.code-workspace
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
2. Install the recommended extensions.
|
|
|
|
|
|
|
|
|
|
[`http://localhost:5000/development`]: http://localhost:5000/development
|
|
|
|
|
[`http://localhost:5000/`]: http://localhost:5000/
|
|
|
|
|
[`http://localhost:8000/`]: http://localhost:8000/
|