Merge pull request #27 from cooperlees/pyproject_toml
Add pyproject.toml for building / installing
commit
46dc13c86d
@ -0,0 +1,31 @@
|
|||||||
|
name: Build CI
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Running python ${{ matrix.python-version }} on ${{matrix.os}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: ["3.9"]
|
||||||
|
os: [macOS-latest, ubuntu-latest, windows-latest]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3.2.0
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Print Python Version
|
||||||
|
run: python --version --version && which python
|
||||||
|
|
||||||
|
- name: Update pip, setuptools + wheels
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip setuptools wheel
|
||||||
|
|
||||||
|
- name: Install deps via requirements + module via pyproject.toml
|
||||||
|
run: |
|
||||||
|
python -m pip install -r requirements.txt
|
||||||
|
python -m pip install .
|
@ -1,24 +1,25 @@
|
|||||||
ARG PY_VERSION=3.9
|
ARG PY_VERSION=3.9
|
||||||
|
|
||||||
|
# Build container
|
||||||
FROM python:${PY_VERSION} as base
|
FROM python:${PY_VERSION} as base
|
||||||
|
|
||||||
FROM base as builder
|
FROM base as builder
|
||||||
ARG PY_VERSION
|
ARG PY_VERSION
|
||||||
|
|
||||||
RUN mkdir /install
|
RUN mkdir /install /src
|
||||||
WORKDIR /install
|
WORKDIR /install
|
||||||
RUN pip install --target="/install" --upgrade pip setuptools wheel
|
RUN pip install --target="/install" --upgrade pip setuptools wheel
|
||||||
ADD requirements.txt /install
|
COPY requirements.txt /install
|
||||||
RUN pip install --target="/install" -r requirements.txt
|
RUN pip install --target="/install" -r requirements.txt
|
||||||
|
COPY README.md /src
|
||||||
|
COPY cogs /src
|
||||||
|
COPY models /src
|
||||||
|
COPY gpt3discord.py /src
|
||||||
|
COPY pyproject.toml /src
|
||||||
|
RUN pip install --target="/install" /src
|
||||||
|
|
||||||
|
# Copy minimal to main image (to keep as small as possible)
|
||||||
FROM python:${PY_VERSION}-slim
|
FROM python:${PY_VERSION}-slim
|
||||||
|
|
||||||
ARG PY_VERSION
|
ARG PY_VERSION
|
||||||
|
|
||||||
COPY --from=builder /install /usr/local/lib/python${PY_VERSION}/site-packages
|
COPY --from=builder /install /usr/local/lib/python${PY_VERSION}/site-packages
|
||||||
COPY cogs /usr/local/lib/python${PY_VERSION}/site-packages/cogs
|
COPY gpt3discord.py /bin/gpt3discord
|
||||||
COPY models /usr/local/lib/python${PY_VERSION}/site-packages/models
|
|
||||||
COPY main.py /bin/gpt3discord
|
|
||||||
|
|
||||||
CMD ["python3", "/bin/gpt3discord"]
|
CMD ["python3", "/bin/gpt3discord"]
|
@ -0,0 +1,54 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["hatchling"]
|
||||||
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "gpt3discord"
|
||||||
|
description = "A Chat GPT Discord bot"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.9"
|
||||||
|
license = "MIT"
|
||||||
|
keywords = []
|
||||||
|
authors = [
|
||||||
|
{ name = "Kaveen Kumarasinghe", email = "contact@kaveenk.com" },
|
||||||
|
]
|
||||||
|
classifiers = [
|
||||||
|
"Development Status :: 4 - Beta",
|
||||||
|
"Programming Language :: Python",
|
||||||
|
"Programming Language :: Python :: 3.9",
|
||||||
|
]
|
||||||
|
dependencies = [
|
||||||
|
"asgiref",
|
||||||
|
"openai",
|
||||||
|
"Pillow",
|
||||||
|
"py-cord",
|
||||||
|
"python-dotenv",
|
||||||
|
"requests",
|
||||||
|
"transformers",
|
||||||
|
]
|
||||||
|
dynamic = ["version"]
|
||||||
|
[project.scripts]
|
||||||
|
gpt3discord = "gpt3discord:init"
|
||||||
|
[project.urls]
|
||||||
|
Documentation = "https://github.com/Kav-K/GPT3Discord/#readme"
|
||||||
|
Issues = "https://github.com/Kav-K/GPT3Discord/issues"
|
||||||
|
Source = "https://github.com/Kav-K/GPT3Discord"
|
||||||
|
|
||||||
|
[tool.hatch.version]
|
||||||
|
path = "gpt3discord.py"
|
||||||
|
|
||||||
|
[tool.hatch.build]
|
||||||
|
include = [
|
||||||
|
"cogs/*.py",
|
||||||
|
"models/*.py",
|
||||||
|
"gpt3discord.py",
|
||||||
|
]
|
||||||
|
|
||||||
|
#[tool.hatch.build.targets.sdist]
|
||||||
|
#packages = ["cogs", "gpt3discord.py", "models"]
|
||||||
|
|
||||||
|
#[tool.hatch.build.targets.wheel]
|
||||||
|
#packages = ["cogs", "gpt3discord.py", "models"]
|
||||||
|
|
||||||
|
[[tool.hatch.envs.test.matrix]]
|
||||||
|
python = ["39"]
|
@ -1,5 +1,7 @@
|
|||||||
py-cord==2.3.2
|
asgiref==3.6.0
|
||||||
|
openai==0.25.0
|
||||||
Pillow==9.3.0
|
Pillow==9.3.0
|
||||||
|
py-cord==2.3.2
|
||||||
python-dotenv==0.21.0
|
python-dotenv==0.21.0
|
||||||
requests==2.28.1
|
requests==2.28.1
|
||||||
transformers==4.25.1
|
transformers==4.25.1
|
Loading…
Reference in new issue