Skip to content

Commit

Permalink
Merge pull request #35 from letsbuilda/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
shenanigansd authored Feb 18, 2023
2 parents c56be69 + a16b882 commit 19ad877
Show file tree
Hide file tree
Showing 12 changed files with 201 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
with:
config-file: darbiadev/.github/.github/dependency-review-config.yaml@main
config-file: darbiadev/.github/.github/dependency-review-config.yaml@1fafbd742c15d5b4daa8352b4b8a90b188ba37ea
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ permissions:

jobs:
build-push:
uses: darbiadev/.github/.github/workflows/docker-build-push.yaml@c194ec59628447c17718ee155e52060ef92dc406
uses: darbiadev/.github/.github/workflows/docker-build-push.yaml@1fafbd742c15d5b4daa8352b4b8a90b188ba37ea
2 changes: 1 addition & 1 deletion .github/workflows/github-pages-python-sphinx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ permissions:

jobs:
docs:
uses: darbiadev/.github/.github/workflows/github-pages-python-sphinx.yaml@c194ec59628447c17718ee155e52060ef92dc406
uses: darbiadev/.github/.github/workflows/github-pages-python-sphinx.yaml@1fafbd742c15d5b4daa8352b4b8a90b188ba37ea
2 changes: 1 addition & 1 deletion .github/workflows/precommit-autoupdate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ on:

jobs:
pre-commit-autoupdate:
uses: darbiadev/.github/.github/workflows/generic-precommit-autoupdate.yaml@c194ec59628447c17718ee155e52060ef92dc406
uses: darbiadev/.github/.github/workflows/generic-precommit-autoupdate.yaml@1fafbd742c15d5b4daa8352b4b8a90b188ba37ea
6 changes: 3 additions & 3 deletions .github/workflows/python-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ on:

jobs:
pre-commit:
uses: darbiadev/.github/.github/workflows/generic-precommit.yaml@c194ec59628447c17718ee155e52060ef92dc406
uses: darbiadev/.github/.github/workflows/generic-precommit.yaml@1fafbd742c15d5b4daa8352b4b8a90b188ba37ea

lint:
needs: pre-commit
uses: darbiadev/.github/.github/workflows/python-lint.yaml@c194ec59628447c17718ee155e52060ef92dc406
uses: darbiadev/.github/.github/workflows/python-lint.yaml@1fafbd742c15d5b4daa8352b4b8a90b188ba37ea

test:
needs: lint
Expand All @@ -21,7 +21,7 @@ jobs:
os: [ ubuntu-latest ]
python-version: [ "3.10", "3.11" ]

uses: darbiadev/.github/.github/workflows/python-test.yaml@c194ec59628447c17718ee155e52060ef92dc406
uses: darbiadev/.github/.github/workflows/python-test.yaml@1fafbd742c15d5b4daa8352b4b8a90b188ba37ea
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
8 changes: 8 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. See docs for details on formatting your entries
https://releases.readthedocs.io/en/latest/concepts.html
Changelog
=========

- :release:`1.0.0 <18th February 2023>`
- :feature:`34` Initialize package
99 changes: 99 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
"""Configuration file for the Sphinx documentation builder.
For the full list of built-in configuration values, see the documentation:
https://www.sphinx-doc.org/en/master/usage/configuration.html
"""

from pathlib import Path
try:
from tomllib import loads as toml_loads
except ImportError:
from toml import loads as toml_loads

project_config = toml_loads(Path("../../pyproject.toml").read_text())
project: str = project_config["project"]["name"]
release: str = project_config["project"]["version"]
REPO_LINK: str = project_config["project"]["urls"]["repository"]
copyright: str = project_config["tool"]["sphinx"]["copyright"] # noqa: A001
author: str = project_config["tool"]["sphinx"]["author"]

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.linkcode",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"autoapi.extension",
"releases",
]

autoapi_type: str = "python"
autoapi_dirs: list[str] = ["../../src"]

intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}

# Add any paths that contain templates here, relative to this directory.
templates_path: list[str] = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns: list[str] = ["_build", "Thumbs.db", ".DS_Store"]

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme: str = "furo"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path: list[str] = ["_static"]

releases_github_path = REPO_LINK.removeprefix("https://github.com/")
releases_release_uri = f"{REPO_LINK}/releases/tag/v%s"


def linkcode_resolve(domain, info):
"""linkcode_resolve"""
if domain != "py":
return None
if not info["module"]:
return None

import importlib # pylint: disable=import-outside-toplevel
import inspect # pylint: disable=import-outside-toplevel
import types # pylint: disable=import-outside-toplevel

mod = importlib.import_module(info["module"])

val = mod
for k in info["fullname"].split("."):
val = getattr(val, k, None)
if val is None:
break

filename = info["module"].replace(".", "/") + ".py"

if isinstance(
val,
(
types.ModuleType,
types.MethodType,
types.FunctionType,
types.TracebackType,
types.FrameType,
types.CodeType,
),
):
try:
lines, first = inspect.getsourcelines(val)
last = first + len(lines) - 1
filename += f"#L{first}-L{last}"
except (OSError, TypeError):
pass

return f"{REPO_LINK}/blob/main/src/{filename}"
25 changes: 25 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
anubis
=======

A Discord bot

Module Index
------------

.. toctree::
:maxdepth: 1

autoapi/index

.. toctree::
:caption: Other:
:hidden:

changelog

Extras
------

* :ref:`genindex`
* :ref:`search`
* :doc:`changelog`
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "anubis"
version = "0.1.0"
version = "1.0.0"
dependencies = [
"python-dotenv==0.21.1",
"discord.py==2.1.1",
Expand Down
6 changes: 6 additions & 0 deletions src/bot/database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from sqlalchemy import BigInteger
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column

from bot.database import engine


class Base(DeclarativeBase):
"""DeclarativeBase"""
Expand Down Expand Up @@ -35,3 +37,7 @@ class RolesPermissions(Base):
guild_id: Mapped[int] = mapped_column(BigInteger)
role_id: Mapped[int] = mapped_column(BigInteger)
permission: Mapped[str]


if __name__ == "__main__":
Base.metadata.create_all(engine)

0 comments on commit 19ad877

Please sign in to comment.