Skip to content

Commit

Permalink
Update to CPython 3.12 (#130)
Browse files Browse the repository at this point in the history
* Testing with CPython 3.12

* Cache key changed

* 3.12 adjustment 1

* 3.12 Lock

* The Python 3.12 Update
Plus A minor API optimization

---------

Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com>
Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
3 people authored May 13, 2024
1 parent 973d4e8 commit 2cae197
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 158 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Poetry Basic",
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
"image": "mcr.microsoft.com/devcontainers/python:3.12-bullseye",
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'

- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local # the path depends on the OS
key: poetry-0 # increment to reset cache
key: poetry-1 # increment to reset cache
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'

- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local # the path depends on the OS
key: poetry-0 # increment to reset cache
key: poetry-1 # increment to reset cache
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -20,7 +20,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.local # the path depends on the OS
key: poetry-0 # increment to reset cache
key: poetry-1 # increment to reset cache
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
Expand Down
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,28 @@ Here are the steps to host your copy of [this bot.](https://github.com/Tech-TTGa

1. Open the directory you want the project to be placed in.
2. Use `git clone https://github.com/Tech-TTGames/Tickets-Plus.git` or download and unpack [the repo](https://github.com/Tech-TTGames/Tickets-Plus/archive/refs/heads/main.zip).
3. Ensure that python3.11 is installed and available, same for pip.
3. Ensure that python3.12 is installed and available, same for pip.
4. Run `curl -sSL https://install.python-poetry.org | python3 -`. And follow instructions provided there.
- Change some poetry settings as-needed. You can add the `--local` flag to set those settings only to the current directory
- `poetry config virtualenvs.in-project true` installs the virtual environment in the project, not in a poetry-specific location (recommended).
- `poetry config virtualenvs.in-project true` installs the virtual environment in the project, not in a poetry-specific location (recommended).
5. Run `poetry install`
- Depending on the DB used, add `-E pgsql` or `-E sqlite`
- If you want development packages, add `--with dev`
6. Install PostgreSQL. [Guide Here](https://www.postgresql.org/download/)
1. Set up automatic PostgreSQL startup on [Linux](https://www.postgresql.org/docs/current/server-start.html) and for windows just start it via `services.msc`
2. Set up user and database for the bot. `<FIELD>` are required and to be replaced with your stuff. [FIELD] are optional and can be ignored.
- Linux:
1. `sudo -u postgres -i`
2. `createuser --pwprompt <dbuser>`
The prompt will ask you for a password for new user - `<dbpass>`.
3. `createdb -E UTF8 -O <dbuser> <dbname> [comment]`
`<dbuser>` being the same as in the previous step.
1. `sudo -u postgres -i`
2. `createuser --pwprompt <dbuser>`
The prompt will ask you for a password for new user - `<dbpass>`.
3. `createdb -E UTF8 -O <dbuser> <dbname> [comment]`
`<dbuser>` being the same as in the previous step.
- Windows:
1. If the installed PostgreSQL bin isn't in PATH, use `cd` to go to the installation bin.
2. `createuser --pwprompt -U postgres <dbuser>`
The prompt will ask you for the password of the postgres user and the password for the new user - `<dbpass>`.
3. `createdb -E UTF8 -O <dbuser> -U postgres <dbname> [comment]`
`<dbuser>` being the same as in the previous step.
1. If the installed PostgreSQL bin isn't in PATH, use `cd` to go to the installation bin.
2. `createuser --pwprompt -U postgres <dbuser>`
The prompt will ask you for the password of the postgres user and the password for the new user - `<dbpass>`.
3. `createdb -E UTF8 -O <dbuser> -U postgres <dbname> [comment]`
`<dbuser>` being the same as in the previous step.
3. Fill out config.json based on the database config environment. (refer to example_config.json)
- Don't change “dbtype” unless you're using SQLite.
- Unless you are using a remote server/changed config, don't touch “dbhost” and “dbport”.
Expand All @@ -100,9 +100,10 @@ Here are the steps to host your copy of [this bot.](https://github.com/Tech-TTGa
- The path is just `/`.
9. Copy your _main_ guild ID and paste it into config.json under "dev_guild_id". This will enable the dev commands in your server. (Required)
10. Start your bot! Use `poetry run start` or after activating venv (if present) `python3 /tickets_plus/`
- Probably add a background service that will restart the bot on boot. _I use systemd for my bots._
11. Finally send `<bot ping> sync` in the bot's DMs to sync / commands.

- Probably add a background service that will restart the bot on boot. _I use systemd for my bots._

11. Finally send `<bot ping> sync` in the bot's DMs to sync / commands.

[^1]: This bot is not affiliated with the Tickets Bot team. When a feature is added to the main bot, any feature that is no longer needed will be discontinued here.
[^0]: [Tech-TTGames](https://github.com/Tech-TTGames), I'm the only one here right now. I had some help in general, but I'm the only one who has done any coding. More people are welcome to join. I had help with organization and checking my code from [kk5dire](https://github.com/kk5dire) and [Ben Foster](https://github.com/benfoster04) with hosting and some documentation changes.
Expand Down
Loading

0 comments on commit 2cae197

Please sign in to comment.