-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
106 changed files
with
3,133 additions
and
1,784 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: check | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
pull_request: | ||
branches: | ||
- "**" | ||
|
||
jobs: | ||
check: | ||
name: Check | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Poetry | ||
run: pipx install poetry | ||
|
||
- name: Configure Poetry | ||
run: poetry config virtualenvs.in-project true | ||
|
||
- name: Specify the version | ||
run: poetry env use python | ||
|
||
- name: Install dependencies | ||
run: poetry install | ||
|
||
- name: Run type checks | ||
run: poetry run mypy . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: docs | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
docs: | ||
name: Docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Install Poetry | ||
run: pipx install poetry | ||
|
||
- name: Configure Poetry | ||
run: poetry config virtualenvs.in-project true | ||
|
||
- name: Specify the version | ||
run: poetry env use python | ||
|
||
- name: Install dependencies | ||
run: poetry install --with docs | ||
|
||
- name: Pull | ||
run: git pull | ||
|
||
- name: Deploy the documentation | ||
run: poetry run mkdocs gh-deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Install Poetry | ||
run: pipx install poetry | ||
|
||
- name: Configure Poetry | ||
run: poetry config virtualenvs.in-project true | ||
|
||
- name: Specify the version | ||
run: poetry env use python | ||
|
||
- name: Build | ||
run: poetry build | ||
|
||
- name: Publish to PyPI | ||
run: poetry publish | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
pull_request: | ||
branches: | ||
- "**" | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Poetry | ||
run: pipx install poetry | ||
|
||
- name: Configure Poetry | ||
run: poetry config virtualenvs.in-project true | ||
|
||
- name: Specify the version | ||
run: poetry env use python | ||
|
||
- name: Install dependencies | ||
run: poetry install | ||
|
||
- name: Run tests | ||
run: poetry run pytest --cov-report xml | ||
|
||
- name: Upload coverage | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: "./coverage.xml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.2.1 | ||
hooks: | ||
- id: ruff | ||
name: Run the Ruff linter | ||
types_or: [python, pyi] | ||
args: [--fix] | ||
- id: ruff-format | ||
name: Run the Ruff formatter | ||
types_or: [python, pyi] | ||
|
||
- repo: https://github.com/python-poetry/poetry | ||
rev: 1.7.1 | ||
hooks: | ||
- id: poetry-lock | ||
stages: [push] | ||
name: Run Poetry lock hook | ||
args: [--no-update] | ||
- id: poetry-check | ||
stages: [push] | ||
name: Run Poetry check hook |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--8<-- "CHANGELOG.md" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--8<-- "CODE_OF_CONDUCT.md" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--8<-- "CONTRIBUTING.md" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--8<-- "README.md" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
::: melody.kit.core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--8<-- "SECURITY.md" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# This is the default configuration file for MelodyKit. | ||
# Configuration file is located at `~/.config/melody/kit.toml`. | ||
# You can read more about it here: `https://docs.melodykit.app/dev/config`. | ||
# You can read more about it here: `https://docs.melodykit.app/config`. | ||
# There are some sensitive fields that need to be manually defined: | ||
# - `melody.session_key` | ||
# - `melody.email.name` | ||
|
@@ -16,13 +16,32 @@ name = "MelodyKit" | |
domain = "melodykit.app" | ||
open = "open" | ||
|
||
images = "~/.melody/kit/images" | ||
|
||
[melody.email] | ||
host = "smtp.gmail.com" | ||
port = 587 | ||
support = "[email protected]" | ||
|
||
[melody.email.verification] | ||
# allowed formatting: `name` | ||
subject = "{name} verification code" | ||
|
||
# allowed formatting: `verification_code` | ||
content = """ | ||
Here is your verification code: | ||
{verification_code} | ||
""" | ||
|
||
[melody.email.temporary] | ||
# allowed formatting: `name` | ||
subject = "{name} temporary token" | ||
# allowed formatting: `temporary_token` | ||
content = """ | ||
Here is your temporary token: | ||
{temporary_token} | ||
""" | ||
|
||
[melody.hash] | ||
time_cost = 4 | ||
memory_cost = 65536 | ||
|
@@ -38,6 +57,11 @@ error_correction = "high" | |
box_size = 10 | ||
border = 4 | ||
|
||
[melody.image] | ||
path = "~/.melody/kit/images" | ||
size_limit = 4096 | ||
data_size_limit = 16777216 | ||
|
||
[melody.log] | ||
level = "info" | ||
|
||
|
@@ -48,6 +72,11 @@ port = 6379 | |
[melody.secret] | ||
size = 32 | ||
|
||
[melody.totp] | ||
digits = 6 | ||
interval = 30 | ||
valid_window = 1 | ||
|
||
[melody.token] | ||
type = "Bearer" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,3 @@ | ||
from melody.kit import endpoints, models | ||
from melody.kit.config import Config, ConfigData, get_config, get_default_config | ||
from melody.kit.core import app, config, database, hasher, redis, v1 | ||
from melody.kit.database import Database | ||
from melody.kit.enums import AlbumType, EntityType, LogLevel, PrivacyType, Repeat | ||
from melody.kit.errors import ( | ||
AuthError, | ||
BadRequest, | ||
Conflict, | ||
Error, | ||
ErrorCode, | ||
ErrorData, | ||
Forbidden, | ||
Gone, | ||
InternalError, | ||
MethodNotAllowed, | ||
NotFound, | ||
PayloadTooLarge, | ||
RateLimited, | ||
Unauthorized, | ||
ValidationError, | ||
) | ||
from melody.kit.uri import URI | ||
|
||
__all__ = ( | ||
# endpoints | ||
"endpoints", | ||
# models | ||
"models", | ||
# core | ||
"config", | ||
"database", | ||
"redis", | ||
"hasher", | ||
"app", | ||
"v1", | ||
# config | ||
"Config", | ||
"ConfigData", | ||
"get_config", | ||
"get_default_config", | ||
# database | ||
"Database", | ||
# enums | ||
"AlbumType", | ||
"PrivacyType", | ||
"Repeat", | ||
"EntityType", | ||
"LogLevel", | ||
# errors | ||
"Error", | ||
"ErrorCode", | ||
"ErrorData", | ||
"AuthError", | ||
"ValidationError", | ||
"BadRequest", | ||
"Unauthorized", | ||
"Forbidden", | ||
"NotFound", | ||
"MethodNotAllowed", | ||
"Conflict", | ||
"Gone", | ||
"PayloadTooLarge", | ||
"RateLimited", | ||
"InternalError", | ||
# URI | ||
"URI", | ||
) | ||
__all__ = ("endpoints", "models") |
Oops, something went wrong.