{ "info": { "author": "Monospaced Magic", "author_email": "lucina@monospacedmagic.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Environment :: Console", "Environment :: Other Environment", "Environment :: Web Environment", "Framework :: AsyncIO", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: Apache Software License", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: JavaScript", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Communications :: Chat", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "discord-hero\n============\n\ndiscord-hero (or d-hero for short) is an **asynchronous, fully modular\nweb application framework for humans** allowing you to write\napplications that connect to `Discord `_. It\nis intended for:\n\n- developers interested in an **easy way to develop a powerful public\n Discord bot** with a clean, readable, pythonic, persistent storage\n solution, easy-to-use caching, an API and a web frontend\n- managers of Discord communities who want to **automate tasks on\n Discord** in a highly customizable way and/or without relying on\n external solutions, and/or want to have an interactive, possibly\n public **web representation of their community**\n- beginner and intermediate level developers who are interested in\n asynchronous concurrency with Python using asyncio, and/or writing\n highly modular, modern web interfaces with Vue\n\nAlthough discord-hero is **easy to get started with**, it comes with all\nthe tools experienced developers enjoy using to build production-ready\napplications for communities, games or companies on Discord:\n\n- a **Discord bot** built on top of the rewrite version of\n `discord.py `_\n- a **GraphQL API** powered by\n `Graphene `_ via\n `Responder `_\n- a **web frontend** written with `Vue `_\n and `Vuetify `_\n via `Nuxt `_\n- a **familiar asynchronous ORM** heavily based on\n `tortoise-orm `_\n- an **easy-to-use cache system**, optionally powered by Redis, via\n `aiocache `_ and\n `aioredis `_\n\nGetting started\n---------------\n\n**Note:** In this section, the content of every code block is intended\nto be entered in a terminal / command prompt.\n\nRequirements\n~~~~~~~~~~~~\n\nYou need `Python 3.6 or above `_,\n`Git `_, ``cookiecutter`` and ``pipenv``.\nOn Windows you may also need the\n`Visual C++ Build Tools `_.\nInstall ``cookiecutter`` and ``pipenv`` if you haven\u2019t yet:\n\nLinux / Mac: ::\n\n python3 install --user -U cookiecutter pipenv\n\nWindows: ::\n\n py -3 -m pip install -U cookiecutter pipenv\n\nIf you\u2019re just testing things out, it\u2019s probably fine to just use the\ndefault database and cache solutions (SQLite3 and simple memory cache).\nHowever, if you want to use discord-hero for a production application,\nit is recommended to run it with Python 3.7 on a Linux VPS, dedicated\nserver or something equally powerful, and use PostgreSQL for storing\ndata and Redis for caching.\n\nInstallation\n~~~~~~~~~~~~\n\nReplace ```` with the project name you will have\nentered by then. ::\n\n cookiecutter https://github.com/monospacedmagic/discord-hero-cookiecutter.git\n cd \n pipenv install --three --skip-lock\n pipenv lock --pre\n pipenv run hero --test\n\nFor production applications: ::\n\n pipenv install discord-hero[postgresql,redis] --skip-lock\n pipenv lock --pre\n\nRun discord-hero in production mode: ::\n\n cd \n pipenv run hero\n\nDevelopment\n-----------\n\nThis project follows a new development approach for libraries that I\nwanted to try out for some time which is called FDTI, short for\n**F**\\ eature-driven **D**\\ ocumentation, **D**\\ ocumentation-driven\n**T**\\ ests, **T**\\ est-driven **I**\\ mplementation. This results in\nfollowing development process:\n\n1. Line out **features** (use case diagrams, activity diagrams etc. can\n be used for this)\n2. **Document** how those features (will) look like (and write\n accompanying guides if it makes sense)\n3. Add examples to the documentation where you didn\u2019t already add ones\n and set up a way to automatically test them if possible (easier to\n maintain), or write tests outside of the documentation\n4. Make those examples and tests work by implementing all the features\n according to the documentation\n\nAfter each of these steps, check with users, stakeholders,\ncoworkers/contributors and whoever else is interested in your project.\nIf there are design flaws, they are likely to surface much earlier this\nway, which can save you and those who use your software a tremendous\namount of headache and wasted time and effort.\n\nFeatures\n--------\n\nCore\n~~~~\n\nThe central control unit that exposes all extensions and connects all\nthe moving parts of the application.\n\nExtensions\n~~~~~~~~~~\n\nExtensions are discord-hero\u2019s plug-ins. They can be disabled, enabled,\ninstalled and uninstalled at runtime.\n\nCogs\n~~~~\n\nCogs are the main building blocks of an extension. They are essentially\nsimply classes that inherit from ``hero.Cog``. By inheriting from\n``hero.Cog``, the class is automatically added to the ``Core``\\ \u2019s cogs\nunless the extension it belongs to is disabled. A cog that is added to\nthe core can be accessed via the core\u2019s attributes. The name of the cog\nattribute of the core is the ``snake_case``\\ \u2019d version of the cog\u2019s\nclass name. ::\n\n import hero\n\n class RoleManagement(hero.Cog):\n @property\n def is_enabled(self):\n return getattr(self.core, \"role_management\", None) is self\n\nCommands\n~~~~~~~~\n\nDecorate a ``Cog``\\ \u2019s coroutine method with ``hero.command(**options)``\nto create a ``Command``. ::\n\n @hero.command()\n @hero.guild_only() # A check ensuring that the command can only be invoked on a Discord server (Guild)\n async def set_channel_name(self, ctx: hero.Context, name: str, channel: hero.Channel=None):\n # !set channel name [channel]\n # TODO actually set the channel name\n pass\n\nEvent listeners\n~~~~~~~~~~~~~~~\n\nStart a coroutine method\u2019s name with ``on_`` to turn it into an event\nlistener. Valid listener names and parameters can be looked up\n`here `__. ::\n\n async def on_message(self, message: hero.Message):\n # essentially be a stereotypical parrot\n if message.author != self.bot.user:\n await message.channel.send(message.content)\n\nBackground tasks\n~~~~~~~~~~~~~~~~\n\nDecorate a coroutine method with ``@hero.background_task(**options)`` to\nturn it into a background task. It will be ran in the background as soon\nas discord-hero launches. If you want to keep it running, just use\ne.g.\u00a0\\ ``while True:``. Don\u2019t use too many of these though, as they can\nslow down discord-hero. ::\n\n @hero.background_task()\n async def say_hello_every_minute(self):\n while True:\n print(\"Hello World!\")\n await asyncio.sleep(60)\n\nModels\n~~~~~~\n\nStructure your data by writing subclasses of ``hero.Model``. This will\nautomatically set up your database schema when discord-hero launches or\nwhen the extension the cog belongs to is installed. If you\u2019re coming\nfrom Django, you might already be familiar with the basic API. ::\n\n # Every Guild can have their own currency\n class Currency(hero.Model):\n guild = fields.GuildField(pk=True, on_delete=fields.CASCADE)\n name = fields.CharField(max_length=64)\n\n # Every Member can have bank account with an amount of the Guild's currency\n class BankAccount(hero.Model):\n member = fields.MemberField(pk=True, on_delete=fields.CASCADE)\n balance = fields.IntField(db_index=True)\n\ndiscord-hero comes with a few built-in models: User, Guild, TextChannel,\nVoiceChannel, Role, Emoji, Member and Message. Each of them have a\ncorresponding field, e.g. UserField, GuildField, etc., that allows you\nto reference the model in your own models.\n\nGraphQL schemas\n~~~~~~~~~~~~~~~\n\nThe GraphQL schemas generated automatically, you just need to configure\nyour models accordingly. If you want to overwrite the default\npermissions, you can use the web interface. You can still add custom\n\nLegal stuff\n-----------\n\nDiscord is a registered trademark of Discord Inc.\n\nExcept as otherwise noted, discord-hero is licensed under the Apache\nLicense, Version 2.0 (``__ or\n``__) or\nthe MIT license ``__ or\n``__, at your option.\n\nSPDX-License-Identifier: Apache-2.0 OR MIT\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/monospacedmagic/discord-hero", "keywords": "discord bot framework", "license": "Apache-2.0 OR MIT", "maintainer": "", "maintainer_email": "", "name": "discord-hero", "package_url": "https://pypi.org/project/discord-hero/", "platform": "", "project_url": "https://pypi.org/project/discord-hero/", "project_urls": { "Homepage": "https://github.com/monospacedmagic/discord-hero" }, "release_url": "https://pypi.org/project/discord-hero/0.0.1/", "requires_dist": [ "responder", "tortoise-orm", "aiocache", "graphene", "click", "aiologger", "aiofiles", "toml", "cookiecutter", "uvloop ; sys_platform != \"win32\"", "aiomcache (>=0.5.2) ; extra == 'memcached'", "aiomysql ; extra == 'mysql'", "asyncpg ; extra == 'postgresql'", "aioredis (>=0.3.3) ; (python_version<\"3.7\") and extra == 'redis'", "aioredis (>=1.0.0) ; (python_version>=\"3.7\") and extra == 'redis'", "pynacl ; extra == 'voice'" ], "requires_python": ">=3.6.0", "summary": "discord-hero is an asynchronous, fully modular application framework for humans allowing you to write applications that connect to Discord.", "version": "0.0.1" }, "last_serial": 4789028, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "6e9ed88de6a12f8bc705e32b49aec61d", "sha256": "93914136937eacfb48533430acc43570a123ea820833f5402d83bddbc04ec6c6" }, "downloads": -1, "filename": "discord_hero-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6e9ed88de6a12f8bc705e32b49aec61d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 12456, "upload_time": "2019-02-06T23:38:12", "url": "https://files.pythonhosted.org/packages/f5/58/cfe9e862ffd78f495e47093ee394205742c2059dc42f203a7320a47a422a/discord_hero-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fd3c086985582669b0914564f1bf6fe5", "sha256": "e14e22184c561ef8489ee9441f871f42b614a14bae67e41360dacce2e0916cbe" }, "downloads": -1, "filename": "discord-hero-0.0.1.tar.gz", "has_sig": false, "md5_digest": "fd3c086985582669b0914564f1bf6fe5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 16811, "upload_time": "2019-02-06T23:38:15", "url": "https://files.pythonhosted.org/packages/a9/0d/26d25b543e97601e42b17daada5314db4a5a1f058f31f8fc5611631c45f1/discord-hero-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6e9ed88de6a12f8bc705e32b49aec61d", "sha256": "93914136937eacfb48533430acc43570a123ea820833f5402d83bddbc04ec6c6" }, "downloads": -1, "filename": "discord_hero-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6e9ed88de6a12f8bc705e32b49aec61d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 12456, "upload_time": "2019-02-06T23:38:12", "url": "https://files.pythonhosted.org/packages/f5/58/cfe9e862ffd78f495e47093ee394205742c2059dc42f203a7320a47a422a/discord_hero-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fd3c086985582669b0914564f1bf6fe5", "sha256": "e14e22184c561ef8489ee9441f871f42b614a14bae67e41360dacce2e0916cbe" }, "downloads": -1, "filename": "discord-hero-0.0.1.tar.gz", "has_sig": false, "md5_digest": "fd3c086985582669b0914564f1bf6fe5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 16811, "upload_time": "2019-02-06T23:38:15", "url": "https://files.pythonhosted.org/packages/a9/0d/26d25b543e97601e42b17daada5314db4a5a1f058f31f8fc5611631c45f1/discord-hero-0.0.1.tar.gz" } ] }