From 26b2eb56a02443b0e05fd38d7dc3d32c5ab5fc6c Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 14 Nov 2020 19:15:24 +0100 Subject: [PATCH 1/7] Customize index set --- docs/deploy.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/deploy.sh b/docs/deploy.sh index 0815e06885..d2f11022ba 100644 --- a/docs/deploy.sh +++ b/docs/deploy.sh @@ -21,6 +21,7 @@ ls -Q | grep -v build | xargs rm -Rf cp -Rf build/html/* . # TODO automate this? ln -s 0.9.5 latest +ln -s 0.9.5/index.html . # docs/build is in .gitignore so will not be included git add . From b555fd10bb59ed7c800f31cacbfdde142092e35f Mon Sep 17 00:00:00 2001 From: "Kevin C. Coram" Date: Tue, 17 Nov 2020 15:06:19 +0000 Subject: [PATCH 2/7] Add null checking when getting puppet from session When account.execute_cmd() is called without an explicit session argument for a server using MULTISESSION_MODE 2 or 3, it does not know which session to use and may leave it None. Downstream, code attempting to get the puppet from the session can fail with an error because of the None session. This change adds in checking for the None session, and sets the puppet to None if there is no session defined. --- evennia/accounts/accounts.py | 2 +- evennia/commands/default/account.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/evennia/accounts/accounts.py b/evennia/accounts/accounts.py index 8bf324c898..79631881db 100644 --- a/evennia/accounts/accounts.py +++ b/evennia/accounts/accounts.py @@ -373,7 +373,7 @@ class DefaultAccount(AccountDB, metaclass=TypeclassBase): puppet (Object): The matching puppeted object, if any. """ - return session.puppet + return session.puppet if session else None def get_all_puppets(self): """ diff --git a/evennia/commands/default/account.py b/evennia/commands/default/account.py index ae284a6c85..b54f99f8a5 100644 --- a/evennia/commands/default/account.py +++ b/evennia/commands/default/account.py @@ -999,7 +999,7 @@ class CmdQuell(COMMAND_DEFAULT_CLASS): self.msg("Already quelling Account %s permissions." % permstr) return account.attributes.add("_quell", True) - puppet = self.session.puppet + puppet = self.session.puppet if self.session else None if puppet: cpermstr = "(%s)" % ", ".join(puppet.permissions.all()) cpermstr = "Quelling to current puppet's permissions %s." % cpermstr From bbfae81e22da140ca8d7142ae754522bd9ee227b Mon Sep 17 00:00:00 2001 From: Griatch Date: Wed, 9 Dec 2020 16:45:39 +0100 Subject: [PATCH 3/7] Fix django-extensions add --- evennia/settings_default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evennia/settings_default.py b/evennia/settings_default.py index ac00b18b29..f44778face 100644 --- a/evennia/settings_default.py +++ b/evennia/settings_default.py @@ -980,7 +980,7 @@ MESSAGE_TAGS = {messages.ERROR: "danger"} try: import django_extensions # noqa - INSTALLED_APPS = INSTALLED_APPS.append("django_extensions") + INSTALLED_APPS += ["django_extensions"] except ImportError: # Django extensions are not installed in all distros. pass From 198a192595d609d83b8f2d84a514e0ad8650aff2 Mon Sep 17 00:00:00 2001 From: duysqubix Date: Wed, 9 Dec 2020 10:12:55 -0600 Subject: [PATCH 4/7] Adds jupyter notebook support Forces the installation of django_extensions. Simply adds the `shell_plus` command to be seen in main evennia binary when parsing arguments. A notebook can be started with the following `evennia shell_plus --notebook` --- evennia/server/evennia_launcher.py | 2 +- requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/evennia/server/evennia_launcher.py b/evennia/server/evennia_launcher.py index 9fed573caf..dcfbbb8a7c 100644 --- a/evennia/server/evennia_launcher.py +++ b/evennia/server/evennia_launcher.py @@ -2259,7 +2259,7 @@ def main(): if option in ("makemessages", "compilemessages"): # some commands don't require the presence of a game directory to work need_gamedir = False - if option in ("shell", "check", "makemigrations", "createsuperuser"): + if option in ("shell", "check", "makemigrations", "createsuperuser", "shell_plus"): # some django commands requires the database to exist, # or evennia._init to have run before they work right. check_db = True diff --git a/requirements.txt b/requirements.txt index 10485f708b..e09b5bf7e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,7 @@ pytz djangorestframework >= 3.10.3, < 3.12 django-filter >= 2.2.0, < 2.3 django-sekizai +django-extensions >= 3.1.0 inflect autobahn >= 17.9.3 lunr == 0.5.6 From 93bbacfe599c718ed146390b33e5ad85ea7725e9 Mon Sep 17 00:00:00 2001 From: duysqubix Date: Wed, 9 Dec 2020 10:30:04 -0600 Subject: [PATCH 5/7] needs ipython for jupyter support --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index e09b5bf7e9..74c0c4e3c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,6 +12,7 @@ django-extensions >= 3.1.0 inflect autobahn >= 17.9.3 lunr == 0.5.6 +ipython >= 7.19.0 # try to resolve dependency issue in py3.7 attrs >= 19.2.0 From e70a731e7f9173b208bed8dbccfc6ff7075434c8 Mon Sep 17 00:00:00 2001 From: duysqubix Date: Wed, 9 Dec 2020 10:57:24 -0600 Subject: [PATCH 6/7] also needs jupyter dependency..duh --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 74c0c4e3c4..1ca9ab97e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,6 +13,7 @@ inflect autobahn >= 17.9.3 lunr == 0.5.6 ipython >= 7.19.0 +jupyter == 1.0.0 # try to resolve dependency issue in py3.7 attrs >= 19.2.0 From 9605e3e64d568c68dd2c32b1c84761717f33a333 Mon Sep 17 00:00:00 2001 From: duysqubix Date: Thu, 17 Dec 2020 15:34:39 +0000 Subject: [PATCH 7/7] - Moved optional pip packages to requirements_extra.txt - Added documentation in Coding-Introduction.md for how to enable Jupyter notebook support --- docs/source/Coding/Coding-Introduction.md | 30 ++++++++++++++++++++++- requirements.txt | 3 --- requirements_extra.txt | 5 ++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/docs/source/Coding/Coding-Introduction.md b/docs/source/Coding/Coding-Introduction.md index 8157b03005..15696c9457 100644 --- a/docs/source/Coding/Coding-Introduction.md +++ b/docs/source/Coding/Coding-Introduction.md @@ -38,10 +38,38 @@ That is, enter `evennia.` and press the `` key. This will show you all the available at the top level of Evennia's "flat API". See the [flat API](../Evennia-API) page for more info on how to explore it efficiently. +#### Jupyter Notebook Support + +You can now explore evennia interactively with jupyter notebooks. There are a few extra steps that must be taken in order for this to work: + + # [open a new console/terminal] + # [activate your evennia virtualenv in this console/terminal] + cd evennia + pip install -r requirements_extra.txt # this installs optional, but necessary modules for this to work. + cd mygame # make sure you are in root of your grame + evennia shell_plus --notebook& # this will start the notebook in the background + +Open an existing, or create, a notebook and in the first cell you must run: + +```python +import evennia +evennia._init() +``` + +This will initialize all module level variables located in `evennia.__init__`. +Now you have the same support as `evennia shell`, but in a more visual and persistent form. + +*It is important to remember, everytime the kernel restarts within a notebook you must first run +`evennia._init()`* + + You can complement your exploration by peeking at the sections of the much more detailed [Evennia Component overview](../Components/Components-Overview). The [Tutorials](../Howto/Howto-Overview) section also contains a growing collection of system- or implementation-specific help. + + + ### Use a python syntax checker Evennia works by importing your own modules and running them as part of the server. Whereas Evennia @@ -103,4 +131,4 @@ chat](http://webchat.freenode.net/?channels=evennia) are also there for you. And finally, of course, have fun! [feature-request]: (https://github.com/evennia/evennia/issues/new?title=Feature+Request%3a+%3Cdescriptive+title+here%3E&body=%23%23%23%23+Description+of+the+suggested+feature+and+how+it+is+supposed+to+work+for+the+admin%2fend+user%3a%0D%0A%0D%0A%0D%0A%23%23%23%23+A+list+of+arguments+for+why+you+think+this+new+feature+should+be+included+in+Evennia%3a%0D%0A%0D%0A1.%0D%0A2.%0D%0A%0D%0A%23%23%23%23+Extra+information%2c+such+as+requirements+or+ideas+on+implementation%3a%0D%0A%0D%0A -[bug](https://github.com/evennia/evennia/issues/new?title=Bug%3a+%3Cdescriptive+title+here%3E&body=%23%23%23%23+Steps+to+reproduce+the+issue%3a%0D%0A%0D%0A1.+%0D%0A2.+%0D%0A3.+%0D%0A%0D%0A%23%23%23%23+What+I+expect+to+see+and+what+I+actually+see+%28tracebacks%2c+error+messages+etc%29%3a%0D%0A%0D%0A%0D%0A%0D%0A%23%23%23%23+Extra+information%2c+such+as+Evennia+revision%2frepo%2fbranch%2c+operating+system+and+ideas+for+how+to+solve%3a%0D%0A%0D%0A) \ No newline at end of file +[bug](https://github.com/evennia/evennia/issues/new?title=Bug%3a+%3Cdescriptive+title+here%3E&body=%23%23%23%23+Steps+to+reproduce+the+issue%3a%0D%0A%0D%0A1.+%0D%0A2.+%0D%0A3.+%0D%0A%0D%0A%23%23%23%23+What+I+expect+to+see+and+what+I+actually+see+%28tracebacks%2c+error+messages+etc%29%3a%0D%0A%0D%0A%0D%0A%0D%0A%23%23%23%23+Extra+information%2c+such+as+Evennia+revision%2frepo%2fbranch%2c+operating+system+and+ideas+for+how+to+solve%3a%0D%0A%0D%0A) diff --git a/requirements.txt b/requirements.txt index 1ca9ab97e7..10485f708b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,12 +8,9 @@ pytz djangorestframework >= 3.10.3, < 3.12 django-filter >= 2.2.0, < 2.3 django-sekizai -django-extensions >= 3.1.0 inflect autobahn >= 17.9.3 lunr == 0.5.6 -ipython >= 7.19.0 -jupyter == 1.0.0 # try to resolve dependency issue in py3.7 attrs >= 19.2.0 diff --git a/requirements_extra.txt b/requirements_extra.txt index ff69a03ee6..c7a911f4e1 100644 --- a/requirements_extra.txt +++ b/requirements_extra.txt @@ -14,3 +14,8 @@ service_identity >= 18.1.0 # AWS-storage contrib boto3 >= 1.4.4 botocore >= 1.15 + +# Jupyter Notebook support +jupyter >= 1.0.0 +ipython >= 7.19.0 +django-extensions >= 3.1.0