diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..30ef101a02 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: griatch +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: https://www.paypal.me/GriatchEvennia diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 580225a96a..e7d0990a31 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -1,14 +1,14 @@ --- name: Bug report about: Create a report to help us improve -title: "[BUG] Enter a brief description here" +title: "[BUG] (Enter a brief description here)" labels: bug assignees: '' --- #### Describe the bug -A clear and concise description of what the bug is. +(Replace with a clear and concise description of what the bug is.) #### To Reproduce Steps to reproduce the behavior: @@ -18,10 +18,10 @@ Steps to reproduce the behavior: 4. See error #### Expected behavior -A clear and concise description of what you expected to happen. +(Replace with a clear and concise description of what you expected to happen.) #### Environment, Evennia version, OS etc -If unsure, run `evennia -v` or get the first few lines of the `about` command in-game. +(Replace with info. If unsure, run `evennia -v` or get the first few lines of the `about` command in-game.) #### Additional context -Any other context about the problem, or ideas on how to solve. +(Replace with any other context about the problem, or ideas on how to solve.) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000000..d5a5b85723 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Questions + url: https://github.com/evennia/evennia/discussions?discussions_q=category%3A%22Evennia+Questions%22 + about: Ask usage questions here (Github Discussions) + - name: Feature discussions + url: https://github.com/evennia/evennia/discussions?discussions_q=category%3A%22Evennia+Engine+Development%22 + about: If you want to discuss before making a formal feature request (Github Discussions) diff --git a/.github/ISSUE_TEMPLATE/documentation-issue.md b/.github/ISSUE_TEMPLATE/documentation-issue.md index bffee8dfb5..f72656ca20 100644 --- a/.github/ISSUE_TEMPLATE/documentation-issue.md +++ b/.github/ISSUE_TEMPLATE/documentation-issue.md @@ -1,14 +1,17 @@ --- name: Documentation issue about: Documentation problems and suggestions -title: '[Documentation] Enter a brief description here' +title: '[Documentation] (Enter a brief description here)' labels: documentation assignees: '' --- +#### Existing page / new +(Link to existing documentation page or proposed name of new page) + #### Documentation issue -Describe what the issue is and where it can/should be found. +(Replace with the description of what the issue is or motivate a changes/additions) #### Suggested change -The suggested change. +(Enter the suggested change here) diff --git a/.github/workflows/github_action_build_docs.yml b/.github/workflows/github_action_build_docs.yml new file mode 100644 index 0000000000..5b085b9f3b --- /dev/null +++ b/.github/workflows/github_action_build_docs.yml @@ -0,0 +1,59 @@ +# This github-Evennia workflow will build the docs. + +name: documentation + +on: + push: + branches: [ master, develop ] + paths: + - 'docs/**' + pull_request: + branches: [ master, develop ] + paths: + - 'docs/**' + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [3.7] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install doc-building dependencies + run: | + python -m pip install --upgrade pip + cd docs/ + make install + + # fail early here, run quickstrict with aborts also on warnings + - name: Quick-test docs (no autodocs) + run: | + cd docs/ + make quickstrict + + # full game dir needed for mv-local + - name: Set up evennia game dir + run: | + pip install -e . + cd .. + evennia --init gamedir + cd gamedir + evennia migrate + + - name: Deploy docs (only from master/develop branch) + if: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master'}} + run: | + git config --global user.email "docbuilder@evennia.com" + git config --global user.name "Doc builder mechanism" + cd docs + make mv-local + echo "Would deploy here!" diff --git a/.github/workflows/github_action_test_suite.yml b/.github/workflows/github_action_test_suite.yml new file mode 100644 index 0000000000..bcc65fb47d --- /dev/null +++ b/.github/workflows/github_action_test_suite.yml @@ -0,0 +1,109 @@ +# This Evennia workflow will install Python dependencies, run tests with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: test-suite + +on: + push: + branches: [ master, develop ] + paths-ignore: + - 'docs/**' + pull_request: + branches: [ master, develop ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + python-version: [3.7, 3.8] + TESTING_DB: ['sqlite3', 'postgresql', 'mysql'] + + steps: + + - uses: actions/checkout@v2 + + - name: Set up PostgreSQL server + uses: harmon758/postgresql-action@v1 + if: ${{ matrix.TESTING_DB == 'postgresql' }} + with: + postgresql version: '10.7' + postgresql db: 'evennia' + postgresql user: 'evennia' + postgresql password: 'password' + - name: Set up MySQL server + uses: mirromutth/mysql-action@v1.1 + if: ${{ matrix.TESTING_DB == 'mysql'}} + with: + host port: 3306 + character set server: 'utf8mb4' + collation server: 'utf8mb4_unicode_ci' + mysql database: 'evennia' + mysql user: 'evennia' + mysql password: 'password' + + # wait for db to activage, get logs from their start + - name: Wait / sleep + uses: jakejarvis/wait-action@v0.1.0 + if: ${{ matrix.TESTING_DB == 'postgresql' || matrix.TESTING_DB == 'mysql' }} + with: + time: '10s' + - name: Database container logs + uses: jwalton/gh-docker-logs@v1.0.0 + - name: Check running containers + run: docker ps -a + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install package dependencies + run: | + python -m pip install --upgrade pip + pip install wheel + pip install psycopg2-binary + pip install mysqlclient + pip install coveralls + pip install codacy-coverage + pip install -e . + + - name: Install extra dependencies # Only develop branch right now + if: ${{ github.ref == 'refs/heads/develop' }} + run: pip install -r requirements_extra.txt + + - name: Initialize evennia + run: | + evennia --init testing_mygame + cp .github/workflows/${{ matrix.TESTING_DB }}_settings.py testing_mygame/server/conf/settings.py + cd testing_mygame + evennia migrate + evennia collectstatic --noinput + + - name: Run test suite + run: | + cd testing_mygame + coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test --settings=settings --keepdb evennia + coverage xml + + # we only want to run coverall/codacy once, so we only do it for one of the matrix combinations + # it's also not critical if pushing to either service fails (happens for PRs since env is not + # available outside of the evennia org) + - name: Send data to Coveralls + if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }} + continue-on-error: true + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + run: | + cd testing_mygame + coveralls + + - name: Send data to Codacy + if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }} + continue-on-error: true + uses: codacy/codacy-coverage-reporter-action@master + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: ./testing_mygame/coverage.xml diff --git a/.travis/mysql_settings.py b/.github/workflows/mysql_settings.py similarity index 72% rename from .travis/mysql_settings.py rename to .github/workflows/mysql_settings.py index b0abfb8519..b5525dcd74 100644 --- a/.travis/mysql_settings.py +++ b/.github/workflows/mysql_settings.py @@ -39,25 +39,24 @@ SERVERNAME = "testing_mygame" # Testing database types DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.mysql', - 'NAME': 'evennia', - 'USER': 'evennia', - 'PASSWORD': 'password', - 'HOST': 'localhost', - 'PORT': '', # use default port - 'OPTIONS': { - 'charset': 'utf8mb4', - 'init_command': 'set collation_connection=utf8mb4_unicode_ci' + "default": { + "ENGINE": "django.db.backends.mysql", + "NAME": "evennia", + "USER": "evennia", + "PASSWORD": "password", + "HOST": "127.0.0.1", + "PORT": "", # use default port + "OPTIONS": { + "charset": "utf8mb4", + "init_command": "set collation_connection=utf8mb4_unicode_ci", + }, + "TEST": { + "NAME": "evennia", + "OPTIONS": { + "charset": "utf8mb4", + "init_command": "set collation_connection=utf8mb4_unicode_ci", + }, }, - 'TEST': { - 'NAME': 'default', - 'OPTIONS': { - 'charset': 'utf8mb4', - # 'init_command': 'set collation_connection=utf8mb4_unicode_ci' - 'init_command': "SET NAMES 'utf8mb4'" - } - } } } diff --git a/.travis/postgresql_settings.py b/.github/workflows/postgresql_settings.py similarity index 84% rename from .travis/postgresql_settings.py rename to .github/workflows/postgresql_settings.py index e65737699e..c12927af3a 100644 --- a/.travis/postgresql_settings.py +++ b/.github/workflows/postgresql_settings.py @@ -39,16 +39,14 @@ SERVERNAME = "testing_mygame" # Testing database types DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'evennia', - 'USER': 'evennia', - 'PASSWORD': 'password', - 'HOST': 'localhost', - 'PORT': '', # use default - 'TEST': { - 'NAME': 'default' - } + "default": { + "ENGINE": "django.db.backends.postgresql", + "NAME": "evennia", + "USER": "evennia", + "PASSWORD": "password", + "HOST": "localhost", + "PORT": "", # use default + "TEST": {"NAME": "default"}, } } diff --git a/.travis/sqlite3_settings.py b/.github/workflows/sqlite3_settings.py similarity index 100% rename from .travis/sqlite3_settings.py rename to .github/workflows/sqlite3_settings.py diff --git a/.gitignore b/.gitignore index 94c928843c..6641f347d9 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,6 @@ nosetests.xml # Windows files generated during setup evennia.bat twistd.bat + +# never commit docs/build +docs/build diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 34288574ae..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,50 +0,0 @@ -dist: xenial -language: python -cache: pip - -services: - - postgresql - - mysql - -python: - - "3.7" - -env: - - TESTING_DB=sqlite3 - - TESTING_DB=postgresql - - TESTING_DB=mysql - -before_install: - - # - psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE evennia TO evennia;" - - psql --version - - psql -U postgres -c "CREATE DATABASE evennia;" - - psql -U postgres -c "CREATE USER evennia WITH PASSWORD 'password';" - - psql -U postgres -c "ALTER USER evennia CREATEDB;" - - mysql --version - - mysql -u root -e "CREATE DATABASE evennia CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" - - mysql -u root -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password';" - - mysql -u root -e "GRANT ALL ON *.* TO 'evennia'@'localhost' IDENTIFIED BY 'password';" - -install: - - pip install psycopg2-binary - - pip install mysqlclient - - pip install coveralls - - pip install codacy-coverage - - pip install -e . - -before_script: - - make format - - evennia --init testing_mygame - - cp .travis/${TESTING_DB}_settings.py testing_mygame/server/conf/settings.py - - cd testing_mygame - - evennia migrate - - evennia collectstatic --noinput - -script: - - coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test --settings=settings --keepdb evennia - -after_success: - - coveralls - - coverage xml - - python-codacy-coverage -r coverage.xml diff --git a/.travis/my.conf b/.travis/my.conf deleted file mode 100644 index 51b810ecc7..0000000000 --- a/.travis/my.conf +++ /dev/null @@ -1 +0,0 @@ -init_connect='SET collation_connection = utf8_general_ci; SET NAMES utf8;' diff --git a/CHANGELOG.md b/CHANGELOG.md index a865a4569b..d17b5c6d9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,16 @@ # Changelog -## Evennia 1.0 (2019-) (WIP) +## Evennia 1.0-dev (2019-) (WIP) -- new `drop:holds()` lock default to limit dropping nonsensical things. Access check +- New `drop:holds()` lock default to limit dropping nonsensical things. Access check defaults to True for backwards-compatibility in 0.9, will be False in 1.0 +- Add `tags.has()` method for checking if an object has a tag or tags (PR by ChrisLR) -### Already in master +### Evennia 0.9.5 (Nov 2020) +A transitional release, including new doc system. + +- `is_typeclass(obj (Object), exact (bool))` now defaults to exact=False - `py` command now reroutes stdout to output results in-game client. `py` without arguments starts a full interactive Python console. - Webclient default to a single input pane instead of two. Now defaults to no help-popup. @@ -27,13 +31,63 @@ without arguments starts a full interactive Python console. - `AttributeHandler.get(return_list=True)` will return `[]` if there are no Attributes instead of `[None]`. - Remove `pillow` requirement (install especially if using imagefield) -- Add Simplified Korean translation (user aceamro) +- Add Simplified Korean translation (aceamro) - Show warning on `start -l` if settings contains values unsafe for production. - Make code auto-formatted with Black. - Make default `set` command able to edit nested structures (PR by Aaron McMillan) - Allow running Evennia test suite from core repo with `make test`. -- Return `store_key` from `TickerHandler.add` and add `store_key` as a kwarg to - the `TickerHandler.remove` method. This makes it easier to manage tickers. +- Return `store_key` from `TickerHandler.add` and add `store_key` as a kwarg to + the `TickerHandler.remove` method. This makes it easier to manage tickers. +- EvMore auto-justify now defaults to False since this works better with all types + of texts (such as tables). New `justify` bool. Old `justify_kwargs` remains + but is now only used to pass extra kwargs into the justify function. +- EvMore `text` argument can now also be a list or a queryset. Querysets will be + sliced to only return the required data per page. +- Improve performance of `find` and `objects` commands on large data sets (strikaco) +- New `CHANNEL_HANDLER_CLASS` setting allows for replacing the ChannelHandler entirely. +- Made `py` interactive mode support regular quit() and more verbose. +- Made `Account.options.get` accept `default=None` kwarg to mimic other uses of get. Set + the new `raise_exception` boolean if ranting to raise KeyError on a missing key. +- Moved behavior of unmodified `Command` and `MuxCommand` `.func()` to new + `.get_command_info()` method for easier overloading and access. (Volund) +- Removed unused `CYCLE_LOGFILES` setting. Added `SERVER_LOG_DAY_ROTATION` + and `SERVER_LOG_MAX_SIZE` (and equivalent for PORTAL) to control log rotation. +- Addded `inside_rec` lockfunc - if room is locked, the normal `inside()` lockfunc will + fail e.g. for your inventory objs (since their loc is you), whereas this will pass. +- RPSystem contrib's CmdRecog will now list all recogs if no arg is given. Also multiple + bugfixes. +- Remove `dummy@example.com` as a default account email when unset, a string is no longer + required by Django. +- Fixes to `spawn`, make updating an existing prototype/object work better. Add `/raw` switch + to `spawn` command to extract the raw prototype dict for manual editing. +- `list_to_string` is now `iter_to_string` (but old name still works as legacy alias). It will + now accept any input, including generators and single values. +- EvTable should now correctly handle columns with wider asian-characters in them. +- Update Twisted requirement to >=2.3.0 to close security vulnerability +- Add `$random` inlinefunc, supports minval,maxval arguments that can be ints and floats. +- Add `evennia.utils.inlinefuncs.raw()` as a helper to escape inlinefuncs in a string. +- Make CmdGet/Drop/Give give proper error if `obj.move_to` returns `False`. +- Make `Object/Room/Exit.create`'s `account` argument optional. If not given, will set perms + to that of the object itself (along with normal Admin/Dev permission). +- Make `INLINEFUNC_STACK_MAXSIZE` default visible in `settings_default.py`. +- Change how `ic` finds puppets; non-priveleged users will use `_playable_characters` list as + candidates, Builders+ will use list, local search and only global search if no match found. +- Make `cmd.at_post_cmd()` always run after `cmd.func()`, even when the latter uses delays + with yield. +- `EvMore` support for db queries and django paginators as well as easier to override for custom + pagination (e.g. to create EvTables for every page instead of splitting one table). +- New `EvMore` methods `.init_pages`, `paginator` and `page_formatter` for easily customize pagination. +- Using `EvMore pagination`, dramatically improves performance of `spawn/list` and `scripts` listings + (100x speed increase for displaying 1000+ prototypes/scripts). +- `EvMenu` now uses the more logically named `.ndb._evmenu` instead of `.ndb._menutree` to store itself. + Both still work for backward compatibility, but `_menutree` is deprecated. +- `EvMenu.msg(txt)` added as a central place to send text to the user, makes it easier to override. + Default `EvMenu.msg` sends with OOB type="menu" for use with OOB and webclient pane-redirects. +- New EvMenu templating system for quickly building simpler EvMenus without as much code. +- Add `Command.client_height()` method to match existing `.client_width` (stricako) +- Include more Web-client info in `session.protocol_flags`. +- Fixes in multi-match situations - don't allow finding/listing multimatches for 3-box when + only two boxes in location. ## Evennia 0.9 (2018-2019) diff --git a/CODING_STYLE.md b/CODING_STYLE.md index 460dfc15d5..31d5ac06da 100644 --- a/CODING_STYLE.md +++ b/CODING_STYLE.md @@ -101,7 +101,7 @@ def funcname(a, b, c, d=False, **kwargs): c (list): A list argument. d (bool, optional): An optional keyword argument. - Kwargs: + Keyword Args: test (list): A test keyword. Returns: @@ -165,13 +165,13 @@ Args: and ``` -Kwargs: +Keyword Args: argname (type): text ``` mean the same thing! Which one is used depends on the function or method documented, but there are no hard rules; If there is a large -`**kwargs` block in the function, using the `Kwargs:` block may be a +`**kwargs` block in the function, using the `Keyword Args:` block may be a good idea, for a small number of arguments though, just using `Args:` and marking keywords as `optional` will shorten the docstring and make it easier to read. diff --git a/INSTALL.md b/INSTALL.md index 8c45cb357e..926785ee5f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,137 +1,5 @@ # Evennia installation -The latest and more detailed installation instructions can be found -[here](https://github.com/evennia/evennia/wiki/Getting-Started). - -## Installing Python - -First install [Python](https://www.python.org/). Linux users should -have it in their repositories, Windows/Mac users can get it from the -Python homepage. You need the 2.7.x version (Python 3 is not yet -supported). Windows users, make sure to select the option to make -Python available in your path - this is so you can call it everywhere -as `python`. Python 2.7.9 and later also includes the -[pip](https://pypi.python.org/pypi/pip/) installer out of the box, -otherwise install this separately (in linux it's usually found as the -`python-pip` package). - -### installing virtualenv - -This step is optional, but *highly* recommended. For installing -up-to-date Python packages we recommend using -[virtualenv](https://pypi.python.org/pypi/virtualenv), this makes it -easy to keep your Python packages up-to-date without interfering with -the defaults for your system. - -``` -pip install virtualenv -``` - -Go to the place where you want to make your virtual python library -storage. This does not need to be near where you plan to install -Evennia. Then do - -``` -virtualenv vienv -``` - -A new folder `vienv` will be created (you could also name it something -else if you prefer). Activate the virtual environment like this: - -``` -# for Linux/Unix/Mac: -source vienv/bin/activate -# for Windows: -vienv\Scripts\activate.bat -``` - -You should see `(vienv)` next to your prompt to show you the -environment is active. You need to activate it whenever you open a new -terminal, but you *don't* have to be inside the `vienv` folder henceforth. - - -## Get the developer's version of Evennia - -This is currently the only Evennia version available. First download -and install [Git](http://git-scm.com/) from the homepage or via the -package manager in Linux. Next, go to the place where you want the -`evennia` folder to be created and run - -``` -git clone https://github.com/evennia/evennia.git -``` - -If you have a github account and have [set up SSH -keys](https://help.github.com/articles/generating-ssh-keys/), you want -to use this instead: - -``` -git clone git@github.com:evennia/evennia.git -``` - -In the future you just enter the new `evennia` folder and do - -``` -git pull -``` - -to get the latest Evennia updates. - -## Evennia package install - -Stand at the root of your new `evennia` directory and run - -``` -pip install -e . -``` - -(note the period "." at the end, this tells pip to install from the -current directory). This will install Evennia and all its dependencies -(into your virtualenv if you are using that) and make the `evennia` -command available on the command line. You can find Evennia's -dependencies in `evennia/requirements.txt`. - -## Creating your game project - -To create your new game you need to initialize a new game project. -This should be done somewhere *outside* of your `evennia` folder. - - -``` -evennia --init mygame -``` - -This will create a new game project named "mygame" in a folder of the -same name. If you want to change the settings for your project, you -will need to edit `mygame/server/conf/settings.py`. - - -## Starting Evennia - -Enter your new game directory and run - -``` -evennia migrate -evennia start -``` - -Follow the instructions to create your superuser account. A lot of -information will scroll past as the database is created and the server -initializes. After this Evennia will be running. Use - -``` -evennia -h -``` - -for help with starting, stopping and other operations. - -Start up your MUD client of choice and point it to your server and -port *4000*. If you are just running locally the server name is -*localhost*. - -Alternatively, you can find the web interface and webclient by -pointing your web browser to *http://localhost:4001*. - -Finally, login with the superuser account and password you provided -earlier. Welcome to Evennia! +You can find the latest updated installation instructions and +requirements [here](https://github.com/evennia/evennia/wiki/Getting-Started). diff --git a/Makefile b/Makefile index 23a578c27e..b8b4857155 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ # This is used with `make