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
23 changes: 23 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: ruff check

on:
push:
pull_request:

jobs:
ruff_check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"

- run: python -m venv .venv && source .venv/bin/activate
- run: python -m pip install --group dev

- name: Run ruff check
run: |
source .venv/bin/activate
ruff check --output-format=github .
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
env
__pycache__
env
.env
.venv
build
aghpb_api.egg-info
*.egg-info
.vscode
git_repo
.ruff_cache
Expand Down
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
FROM python:3.12.10-slim-bookworm
FROM python:3.12.13-slim-bookworm

USER root
COPY --from=ghcr.io/astral-sh/uv:0.11.2 /uv /uvx /bin/

USER root
WORKDIR /app

COPY /api ./api
COPY /app ./app
COPY pyproject.toml .
COPY Makefile .

RUN apt-get update && apt-get install -y git make
RUN apt-get update && apt-get install -y git

RUN mkdir assets
RUN make pull-repo
RUN git clone https://github.com/cat-milk/Anime-Girls-Holding-Programming-Books ./assets/git_repo
RUN cd ./assets/git_repo && git config features.manyFiles 1

RUN pip install .
ENV UV_NO_DEV=1

COPY uv.lock .
RUN uv sync --locked

EXPOSE 8000
ENV LISTEN_PORT=8000

CMD ["fastapi", "run", "api/main.py"]
CMD ["uv", "run", "uvicorn", "app.main:app", "--host=0.0.0.0", "--proxy-headers"]
17 changes: 1 addition & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,6 @@
build:
echo "Nothing to build here."

test:
ruff check .

pull-repo:
git clone https://github.com/cat-milk/Anime-Girls-Holding-Programming-Books ./assets/git_repo

update-repo:
cd ./assets/git_repo && git pull

bench-test:
python scripts/bench_book_load.py
snakeviz results.prof

docker-build:
python scripts/docker_build.py

docker-compose:
docker compose up
snakeviz results.prof
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ These are the languages I've written so far:
- **🦀 Rust - [``aghpb.rs``](https://github.com/THEGOLDENPRO/aghpb.rs)** (async)
- **🟦 TypeScript - [``aghpb.ts``](https://github.com/THEGOLDENPRO/aghpb.ts)** (async)
- **⚫ C - [``aghpb.c``](https://github.com/THEGOLDENPRO/aghpb.c)** ~~(might blow up)~~
- **🔥 Mojo - ``Soon™``**
- **🔵 Go - ``Soon™``**
- **🌕 Lua - [``aghpb.lua``](https://github.com/THEGOLDENPRO/aghpb.lua)**

Then here are some community-made api wrappers **( thanks 💛 )**:
Expand Down Expand Up @@ -69,7 +67,7 @@ To build your own docker image it is necessary you follow the [native method's](

Once that is done run the command below:
```sh
make docker-build
python scripts/docker_build.py
```
> ``docker images`` should display the "devgoldy/aghpb_api" image.

Expand All @@ -79,28 +77,27 @@ Now you may jump to **step 2** of the [docker method](#-docker-method-recommende

#### Prerequisites:
- [Git](https://git-scm.com/downloads)
- [Python](https://www.python.org/downloads/) (3.10 - 3.13)
- [Make](https://www.gnu.org/software/make/#download) ***(otherwise you'll have to copy the commands from the [Makefile](https://github.com/THEGOLDENPRO/aghpb_api/blob/main/Makefile))***
- [Python](https://www.python.org/downloads/) (3.12+)

1. Clone the repo.
```sh
git clone https://github.com/THEGOLDENPRO/aghpb_api && cd aghpb_api
```
2. Create env.
```sh
python -m venv env
source env/bin/activate # For windows it's --> cd env/Scripts && activate && cd ../../
python -m venv .venv
source .venv/bin/activate # For windows it's --> cd .venv/Scripts && activate && cd ../../
```
3. Install the API's dependencies.
```sh
pip install . -U
```
4. Pull the ~~anime girls~~ programming books.
```sh
make pull-repo
git clone https://github.com/cat-milk/Anime-Girls-Holding-Programming-Books ./assets/git_repo
```
5. Run that mf.
```sh
fastapi dev api/main.py
fastapi dev
```
6. Visit ``localhost:8000`` in your browser, then all should be good! 🌈
6. Visit ``localhost:8000`` in your browser, then all should be good! 🌈
1 change: 0 additions & 1 deletion api/__init__.py

This file was deleted.

101 changes: 0 additions & 101 deletions api/book.py

This file was deleted.

13 changes: 0 additions & 13 deletions api/constants.py

This file was deleted.

13 changes: 0 additions & 13 deletions api/info.py

This file was deleted.

Loading