Skip to content

Commit

Permalink
Migration to PDM
Browse files Browse the repository at this point in the history
Appeased the formatter
  • Loading branch information
Xithrius committed Mar 23, 2024
1 parent 49996ac commit d24a1f3
Show file tree
Hide file tree
Showing 21 changed files with 1,531 additions and 546 deletions.
56 changes: 28 additions & 28 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: "monthly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
groups:
ci-dependencies:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
groups:
ci-dependencies:
patterns:
- "*"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"
groups:
python-dependencies:
patterns:
- "*"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"
groups:
python-dependencies:
patterns:
- "*"

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
groups:
docker-dependencies:
patterns:
- "*"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
groups:
docker-dependencies:
patterns:
- "*"
4 changes: 2 additions & 2 deletions .github/workflows/container-build-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: "Container Build and Push"
on:
push:
branches:
- main
- main
tags:
- v*
- v*
pull_request:

permissions:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/dependency-review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: "Checkout Repository"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: "Checkout Repository"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: "Dependency Review"
uses: actions/dependency-review-action@9129d7d40b8c12c1ed0f60400d00c92d437adcce # v4.1.3
with:
config-file: darbiadev/.github/.github/dependency-review-config.yaml@f185cc076161b47921c6fb6da4c1fd5e40b50bff # v3.0.0
- name: "Dependency Review"
uses: actions/dependency-review-action@9129d7d40b8c12c1ed0f60400d00c92d437adcce # v4.1.3
with:
config-file: darbiadev/.github/.github/dependency-review-config.yaml@f185cc076161b47921c6fb6da4c1fd5e40b50bff # v3.0.0
6 changes: 3 additions & 3 deletions .github/workflows/python-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "Python CI"
on:
push:
branches:
- main
- main
pull_request:

jobs:
Expand All @@ -22,8 +22,8 @@ jobs:
needs: lint
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.11" ]
os: [ubuntu-latest]
python-version: ["3.11"]

uses: darbiadev/.github/.github/workflows/python-test.yaml@ea97d99e1520c46080c4c9032a69552e491474ac # v13.0.0
with:
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/sentry-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ name: "Sentry release"
on:
push:
branches:
- main
- main

jobs:
sentry-release:
runs-on: ubuntu-latest

steps:
- name: "Checkout repository"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: "Checkout repository"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: "Create Sentry release"
uses: getsentry/action-release@e769183448303de84c5a06aaaddf9da7be26d6c7 # v1.7.0
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
with:
version_prefix: "${{ vars.SENTRY_PROJECT }}@"
- name: "Create Sentry release"
uses: getsentry/action-release@e769183448303de84c5a06aaaddf9da7be26d6c7 # v1.7.0
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
with:
version_prefix: "${{ vars.SENTRY_PROJECT }}@"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,5 @@ dmypy.json

# JetBrains IDEs
/.idea

.pdm-python
65 changes: 47 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,48 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: check-json
- id: trailing-whitespace
args: [ --markdown-linebreak-ext=md ]
- id: mixed-line-ending
args: [ --fix=lf ]
- id: end-of-file-fixer
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.2.0"
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: check-json
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: mixed-line-ending
args: [--fix=lf]
- id: end-of-file-fixer

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-ast
- id: trailing-whitespace
- id: check-toml
- id: end-of-file-fixer

- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
hooks:
- id: add-trailing-comma

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
- id: pretty-format-yaml
args:
- --autofix
- --preserve-quotes
- --indent=2
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["ms-python.python", "charliermarsh.ruff"]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"python.testing.pytestArgs": ["."],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.languageServer": "Pylance",
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
},
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
26 changes: 14 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
FROM python:3.11-slim@sha256:edaf703dce209d774af3ff768fc92b1e3b60261e7602126276f9ceb0e3a96874
FROM --platform=amd64 python:3.11-slim as builder

# Define Git SHA build argument for Sentry
ARG git_sha="development"
ENV GIT_SHA=$git_sha
RUN pip install -U pip setuptools wheel
RUN pip install pdm

COPY requirements/requirements.txt .
RUN python -m pip install --requirement requirements.txt
COPY pyproject.toml pdm.lock /project/
COPY bot/ /project/bot

COPY pyproject.toml pyproject.toml
COPY src/ src/
RUN python -m pip install .
WORKDIR /project
RUN mkdir __pypackages__ && pdm sync --prod --no-editable

RUN adduser --disabled-password bot
USER bot
FROM python:3.11-slim

CMD [ "python", "-m", "bot" ]
ENV PYTHONPATH=/project/pkgs
COPY --from=builder /project/__pypackages__/3.11/lib /project/pkgs
COPY --from=builder /project/__pypackages__/3.11/bin/* /bin/

ENTRYPOINT ["python3", "-m"]
CMD ["bot"]
127 changes: 0 additions & 127 deletions make.ps1

This file was deleted.

Loading

0 comments on commit d24a1f3

Please sign in to comment.