Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace pipenv with pdm #1

Merged
merged 5 commits into from
Nov 11, 2023
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
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.10-bullseye",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers-contrib/features/pdm:2": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pdm install --dev && pdm install --plugins"

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,6 @@ LICENSE
PRIVACY.md

# Docs
docs/
docs/

.pdm-python
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,5 @@ config.json
temp/
test.py
stack.yml
.github/workflows/build_docker.yml

.pdm-python
15 changes: 13 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
repos:
- repo: https://github.com/psf/black
rev: "22.12.0"
rev: "23.10.1"
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.261'
rev: 'v0.1.4'
hooks:
- id: ruff
- repo: https://github.com/pdm-project/pdm
rev: 2.10.0 # a PDM release exposing the hook
hooks:
- id: pdm-export
# command arguments, e.g.:
args: [ '-o', 'requirements.txt', '--without-hashes' ]
files: ^pdm.lock$
- repo: https://github.com/pdm-project/pdm
rev: 2.10.0 # a PDM release exposing the hook
hooks:
- id: pdm-lock-check
35 changes: 0 additions & 35 deletions Pipfile

This file was deleted.

998 changes: 0 additions & 998 deletions Pipfile.lock

This file was deleted.

26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
<img src="https://img.shields.io/badge/kofi-donate-gold.svg?style=shield&logo=Ko-fi" alt="Ko-fi">
</a>
<a href="https://www.python.org/downloads/">
<img src="https://img.shields.io/badge/Compatible%20With-Python%203.8%20|%203.9%20|%203.10%20|%203.11-blue.svg?style=shield&logo=Python" alt="Made with Python 3.8">
<img src="https://img.shields.io/badge/Compatible%20With-Python%203.10%20|%203.11-blue.svg?style=shield&logo=Python" alt="Made with Python 3.8">
</a>
<a href="https://github.com/ambv/black">
<img src="https://img.shields.io/badge/Code%20Style-Black-black?style=shield">
</a>
<a href="https://github.com/modmail-dev/modmail/blob/master/LICENSE">
<img src="https://img.shields.io/badge/license-agpl-e74c3c.svg?style=shield" alt="MIT License">
<img src="https://img.shields.io/badge/license-agpl-e74c3c.svg?style=shield" alt="AGPL-3.0-or-later">
</a>

<img src='https://github.com/raidensakura/modmail/assets/38610216/106e8fa3-6f8e-4b00-9968-f5c2f3108da0' align='center' width=500>
Expand Down Expand Up @@ -67,17 +67,20 @@ This guide assumes you have git, and a supported Python version installed and ad
2. Create a Discord bot account, grant the necessary intents, and invite the bot.
3. Create a free MongoDB database.
4. Rename the file `.env.example` to `.env` and fill it with appropriate values
5. Update pip, install pipenv, and install dependencies using pipenv
5. Update pip
```console
$ pip install -U pip
$ pip install pipenv
$ pipenv install
```
6. [Install PDM](https://pdm.fming.dev/latest/#recommended-installation-method)
7. Install dependencies using PDM
```console
$ pdm sync
```
6. Start the bot
8. Start the bot
```console
$ pipenv run bot
$ pdm run bot
```
7. Load the logviewer plugin included with Modmail with `?plugin load @local/logviewer`
9. Load the logviewer plugin included with Modmail with `?plugin load @local/logviewer`

### Running the Docker Image

Expand Down Expand Up @@ -118,14 +121,15 @@ The [develop](https://github.com/raidensakura/modmail/tree/develop) branch is wh

This project has included pre-commit script that automatically runs black and ruff linter on every commit.

1. Install development dependencies inside pipenv
1. Install development dependencies inside pdm
```console
$ pipenv install --dev
$ pdm sync -d
```
2. Install the pre-commit hook
```console
$ pre-commit install
$ pdm install --plugins
```
The pre-commit hook should be automatically installed

Alternatively, you can also lint the codebase manually

Expand Down
Loading
Loading