mudpy.git
3 years agoCorrect package metadata
Jeremy Stanley [Tue, 7 Jul 2020 10:50:19 +0000 (10:50 +0000)]
Correct package metadata

Use the more correct metadata fields recognized by
Setuptools/distutils rather in lieu of some used only by PBR.

3 years agoReport if service does not start under selftest
Jeremy Stanley [Tue, 2 Jun 2020 23:12:45 +0000 (23:12 +0000)]
Report if service does not start under selftest

Output a useful error and stop the selftest script immediately if
the service it tries to start does not actually start, to make
debugging some classes of errors slightly faster.

3 years agoPrefer importlib over pkg_resources
Jeremy Stanley [Sat, 23 May 2020 20:11:18 +0000 (20:11 +0000)]
Prefer importlib over pkg_resources

Since Setuptools pkg_resources library is effectively deprecated in
newer releases, try to use the equivalent importlib.metadata
features and exceptions when they're available.

3 years agoRecord the reported rows from NAWS negotiation
Jeremy Stanley [Wed, 22 Apr 2020 19:54:54 +0000 (19:54 +0000)]
Record the reported rows from NAWS negotiation

In preparation for future pagination support, get the rows included
in NAWS responses and record that as an integer in the User.rows
attribute, similar to the existing User.columns value used for line
wrapping.

4 years agoObtain terminal type (RFC 1091)
Jeremy Stanley [Sun, 12 Apr 2020 20:17:57 +0000 (20:17 +0000)]
Obtain terminal type (RFC 1091)

Implement rudimentary support for determining the terminal type
reported by RFC 1091 TTYPE compatible clients, and store any initial
value returned in the User.ttype attribute. This implementation does
not iterate over SEND TTYPE commands until UNKNOWN is returned, it
only takes the first value returned and assumes this is the default
terminal type for the user's current connection.

4 years agoOverhaul coder guide, add commands and misc
Jeremy Stanley [Sat, 21 Mar 2020 03:25:14 +0000 (03:25 +0000)]
Overhaul coder guide, add commands and misc

Brush up the quality of the coder guide, using relevant autodoc
references and clearer markup, as well as improving some wording.
Add a section on custom commands, and another for miscellaneous
design discussions taken from various recent E-mail threads.

4 years agoStart the install guide
Jeremy Stanley [Fri, 7 Feb 2020 08:12:17 +0000 (08:12 +0000)]
Start the install guide

Create a stub document with some installation and configuration
tips, to be expanded into something more useful over time.

4 years agoAdd the beginnings of an admin guide
Jeremy Stanley [Sun, 12 Jan 2020 08:04:54 +0000 (08:04 +0000)]
Add the beginnings of an admin guide

Some initial prose to seed the admin guide, taken from various
E-mails to users in recent months.

4 years agoCollapse redundant exceptions
Jeremy Stanley [Wed, 8 Jan 2020 23:29:54 +0000 (23:29 +0000)]
Collapse redundant exceptions

In User.enqueue_input() combine a redundant match on BlockingIOError
and OSError since the former is a subclass of the latter. This was
caught by the B014 check introduced in flake8-bugbear 20.1.1.

4 years agoIndicate support for Python 3.9
Jeremy Stanley [Tue, 7 Jan 2020 00:45:35 +0000 (00:45 +0000)]
Indicate support for Python 3.9

Python 3.9 is well into its second alpha, is a recognized trove
classifier on PyPI, and all mudpy changes are being successfully
tested against it. Add the classifier to our package metadata to
reflect this.

4 years agoLink the ChangeLog from package metadata
Jeremy Stanley [Tue, 7 Jan 2020 00:43:14 +0000 (00:43 +0000)]
Link the ChangeLog from package metadata

Users of PyPI are going to want to know where to find the ChangeLog
without going to the project homepage/docs and hunting around. Add a
flexible redirect URL for it so we can move it easily later.

4 years agoDrop section numbering from documentation builds
Jeremy Stanley [Tue, 7 Jan 2020 00:38:14 +0000 (00:38 +0000)]
Drop section numbering from documentation builds

Sphinx section numbering leads to confusing output, particularly for
the rendered ChangeLog. Remove it.

Update copyright year in the LICENSE as this is the first change of
the new year, and similarly update it in rendered documentation
footers as this is the first documentation change of the year.

4 years agoMake sure all command functions return True 0.1.1
Jeremy Stanley [Mon, 30 Dec 2019 17:52:01 +0000 (17:52 +0000)]
Make sure all command functions return True

Because recent adjustments to handler_active() rely on the
call_handler_function() return value to determine whether something
went wrong, we need command functions to return something which
evaluates boolean True if they ran to completion and didn't raise an
exception. Just return True from all of them for now, but they may
see more dynamic result handling in the future.

4 years agoIncrease timer resolution in test config 0.1.0
Jeremy Stanley [Mon, 30 Dec 2019 15:41:34 +0000 (15:41 +0000)]
Increase timer resolution in test config

Significantly speed up the timer in the test config (by a factor of
1000). On fast machines with cached tox envs, this results in an
order of magnitude improvement in test runtime. Related timer values
are lengthened to avoid test failures due to timeouts, and some
others are shortened for consistency.

This is obviously not suitable for normal operation, so the sample
configuration remains untouched and thus the tox selftest_config
testenv does not benefit from it.

4 years agoUse call_hook_function() in handler_active()
Jeremy Stanley [Mon, 30 Dec 2019 15:18:52 +0000 (15:18 +0000)]
Use call_hook_function() in handler_active()

Simplify mudpy.misc.handler_active() by making it a wrapper around
the more general mudpy.misc.call_hook_function() which was
originally derived from it.

4 years agoPreserve loglines on reload
Jeremy Stanley [Mon, 30 Dec 2019 01:49:32 +0000 (01:49 +0000)]
Preserve loglines on reload

When a reload occurs, prepend the new universe's loglines with those
from the old universe so they are not lost. This may temporarily
bloat the loglines list slightly over the limit, but it will be
adjusted downward the next time anything new gets logged. Also
adjust the `show log` selftests to handle linewraps in a new place
when the total loglines count is higher.

4 years agoSet bandit to error on risks of any severity
Jeremy Stanley [Sun, 29 Dec 2019 14:25:17 +0000 (14:25 +0000)]
Set bandit to error on risks of any severity

Now that the last of the low-level risks has been reviewed and
whitelisted, remove the severity filter from the bandit command so
that incorporation of any unexpected risks it can spot will be
blocked for future commits.

4 years agoWhitelist uses of stdlib random module for bandit
Jeremy Stanley [Sun, 29 Dec 2019 14:19:57 +0000 (14:19 +0000)]
Whitelist uses of stdlib random module for bandit

There are currently two uses of random.randrange() and one of
random.choice() for non-security/non-crypto purposes. Mark them as
whitelisted for bandit checks and add comments explaining why.

4 years agoClean up function names in menu definitions
Jeremy Stanley [Sun, 29 Dec 2019 12:31:36 +0000 (12:31 +0000)]
Clean up function names in menu definitions

Now that the functions called from menus are filtered and resolved
safely rather than being directly executed, the explicit mudpy
package name and the user parameter passing are no longer necessary.
Remove them from the function names in menu definitions and also
drop the old compatibility code which trims them.

4 years agoRatchet bandit checking down to medium severity
Jeremy Stanley [Sun, 29 Dec 2019 12:23:44 +0000 (12:23 +0000)]
Ratchet bandit checking down to medium severity

Now that the last of the medium-severity risks have been eliminated,
adjust the bandit command line so that it will prevent addition of
any new instances.

4 years agoReplace eval() and exec() use for menu functions
Jeremy Stanley [Sat, 28 Dec 2019 21:01:32 +0000 (21:01 +0000)]
Replace eval() and exec() use for menu functions

Add a new misc.call_hook_function() routine based on the existing
command execution in misc.handler_active() to eliminate all use of
eval() and exec() built-ins in menu operations.

4 years agoRelocate main_utility menu functions
Jeremy Stanley [Thu, 26 Dec 2019 02:45:25 +0000 (02:45 +0000)]
Relocate main_utility menu functions

Move the action and demand logic for the main_utility state from
their respective facets to the menu module, hiding them behind
consistently-named entry points.

4 years agoRelocate delete_avatar menu functions
Jeremy Stanley [Wed, 25 Dec 2019 22:49:48 +0000 (22:49 +0000)]
Relocate delete_avatar menu functions

Move the action and create logic for the delete_avatar state from
their respective facets to the menu module, hiding them behind
consistently-named entry points.

4 years agoRelocate delete_account menu function
Jeremy Stanley [Wed, 25 Dec 2019 22:23:08 +0000 (22:23 +0000)]
Relocate delete_account menu function

Move the action logic for the delete_account state from its
corresponding facet to the menu module, hiding it behind a
consistently-named entry point.

4 years agoRelocate choose_name menu functions
Jeremy Stanley [Wed, 25 Dec 2019 22:13:16 +0000 (22:13 +0000)]
Relocate choose_name menu functions

Move the action and create logic for the choose_name state from
their respective facets to the menu module, hiding them behind
consistently-named entry points.

4 years agoRelocate choose_gender menu function
Jeremy Stanley [Wed, 25 Dec 2019 21:52:02 +0000 (21:52 +0000)]
Relocate choose_gender menu function

Move the action logic for the choose_gender state from its
corresponding facet to the menu module, hiding it behind a
consistently-named entry point.

4 years agoRelocate checking_new_account_name menu functions
Jeremy Stanley [Wed, 25 Dec 2019 21:45:45 +0000 (21:45 +0000)]
Relocate checking_new_account_name menu functions

Move the action logic for the checking_new_account_name state from
its respective facets to the menu module, hiding them behind
consistently-named entry points.

4 years agoRelocate activate_avatar menu functions
Jeremy Stanley [Wed, 25 Dec 2019 20:02:41 +0000 (20:02 +0000)]
Relocate activate_avatar menu functions

Move the action and create logic for the activate_avatar state from
their respective facets to the menu module, hiding them behind
consistently-named entry points.

4 years agoAdd a mudpy.menu module to hold menu functions
Jeremy Stanley [Tue, 24 Dec 2019 22:55:01 +0000 (22:55 +0000)]
Add a mudpy.menu module to hold menu functions

In preparation for relocating arbitrary Python expressions out of
the standard menu elements, provide a stub mudpy.menu module which
will house equivalent convenience functions and include an autodoc
section for it in the Sphinx API documentation template.

4 years agoMove selected menu item into the User object
Jeremy Stanley [Wed, 25 Dec 2019 21:24:06 +0000 (21:24 +0000)]
Move selected menu item into the User object

In order to simplify menu handlers, move the active choice into an
attribute of the User class so that only one object needs to be
handed off, and update menus accordingly.

4 years agoRename state variable in get_menu_choices()
Jeremy Stanley [Wed, 25 Dec 2019 13:12:43 +0000 (13:12 +0000)]
Rename state variable in get_menu_choices()

Avoid shadowing the new menu module in misc.get_menu_choices() by
renaming its menu variable to state, which is also more consistent
with other menu-related functions.

4 years agoRemove exec() from handle_user_input() function
Jeremy Stanley [Tue, 24 Dec 2019 22:37:18 +0000 (22:37 +0000)]
Remove exec() from handle_user_input() function

Stop passing the constructed handler function name into an exec()
and instead reference it from the globals() dict.

4 years agoEliminate exec() in Universe.new()
Jeremy Stanley [Tue, 24 Dec 2019 22:23:32 +0000 (22:23 +0000)]
Eliminate exec() in Universe.new()

Replace questionable exec call in the new() method of the Universe
class with cleaner getattr/setattr equivalents.

4 years agoMore thoroughly test account and avatar menus
Jeremy Stanley [Thu, 26 Dec 2019 01:57:24 +0000 (01:57 +0000)]
More thoroughly test account and avatar menus

Split up the teardown "test" into separate tests for avatar and
account deletion. Avatar deletion was previously not being exercised
correctly, instead avatar deletion aborting was what was actually
being tested. Add separate tests that the avatar and account
deletion default actions are to abort. Also add a test of the avatar
creation limit.

4 years agoProperly escape punctuation in test patterns
Jeremy Stanley [Wed, 25 Dec 2019 23:04:20 +0000 (23:04 +0000)]
Properly escape punctuation in test patterns

Make sure all literal question marks (?) and periods (.) in selftest
match patterns are backslash-escaped in raw strings.

4 years agoTighten up eval() scope in show result subcommand
Jeremy Stanley [Tue, 24 Dec 2019 21:33:37 +0000 (21:33 +0000)]
Tighten up eval() scope in show result subcommand

In order to slightly reduce risk but mostly to increase convenience
with the `show result` administrative subcommand, replace its eval()
invocation's globals with just the mudpy module namespace and the
actor's universe pointer as "universe" (this way exploratory
expressions don't need to do things relative to actor.universe all
the time). Extend the selftest to confirm these are present and that
any attempts to access other globals and locals within the
command.show() function's scope raise an exception.

Whitelist this intentional use of eval() for bandit analysis.

4 years agoReplace uses of exec() in module loader
Jeremy Stanley [Sun, 22 Dec 2019 20:48:12 +0000 (20:48 +0000)]
Replace uses of exec() in module loader

Improve the module loader to avoid the more dangerous exec()
function in favor of smarter use of importlib. This allows us to
drop some flake8 whitelisting. Also switch out the hard-coded module
list (which missed addition of the daemon module) with a more
dynamic routine on Python 3.7 and later, which will use all *.py
files in the top level of the package so none are forgotten in the
future. Keep a hard-coded fallback list for support of earlier
Python versions, but compare the two so this list is guaranteed
complete for as long as it is maintained.

4 years agoUse generic authors for copyright shown in docs
Jeremy Stanley [Tue, 12 Nov 2019 15:25:59 +0000 (15:25 +0000)]
Use generic authors for copyright shown in docs

Adjust the copyright holder listed in the Sphinx-built documentation
to match the more general "mudpy authors" used in copyright headers
for files.

4 years agoUpdate copyright for files edited in 2019
Jeremy Stanley [Thu, 17 Oct 2019 07:21:36 +0000 (07:21 +0000)]
Update copyright for files edited in 2019

These files missed a copyright year bump when they were edited.

4 years agoSatisfy yamllint checking of .yamllint
Jeremy Stanley [Wed, 16 Oct 2019 11:11:43 +0000 (11:11 +0000)]
Satisfy yamllint checking of .yamllint

The 1.18.0 release of yamllint has started linting its .yamllint
config file by default. Add a document marker at the top of the file
so that it will pass document-start rule.

4 years agoLog User object ID even when account is an admin 0.0.2
Jeremy Stanley [Fri, 27 Sep 2019 16:26:54 +0000 (16:26 +0000)]
Log User object ID even when account is an admin

Adjust authentication logging to consistently record the User object
instance ID regardless of, and separately from, whether the account
which authenticated is an administrator.

4 years agoLog starting directory during initialization
Jeremy Stanley [Sun, 1 Sep 2019 21:35:00 +0000 (21:35 +0000)]
Log starting directory during initialization

Update the initialization logging to also include the starting
directory, since some of the startup routines form their file paths
relative to it.

4 years agoSeparate listening port in startup logging
Jeremy Stanley [Sat, 24 Aug 2019 19:32:33 +0000 (19:32 +0000)]
Separate listening port in startup logging

Using a port separator of ":" is vague in combination with IPv6
addresses, so separate the listening port number more clearly in the
startup log message.

4 years agoDisable usedevelop for some tox testenvs
Jeremy Stanley [Wed, 10 Jul 2019 17:18:53 +0000 (17:18 +0000)]
Disable usedevelop for some tox testenvs

Tox's usedevelop option implicitly installs the project and its
dependencies, and is enabled in the base testenv. Disable it in
testenvs which don't make use of the installed project, but add the
project dependencies to the docs testenv since it needs them to be
able to generate the API docs. This results in a fairly substantial
speedup of >10% for a full `tox` invocation.

4 years agoCorrect reference to main config in walk-through
Jeremy Stanley [Sun, 7 Jul 2019 11:36:22 +0000 (11:36 +0000)]
Correct reference to main config in walk-through

The main sample configuration is mudpy.yaml, not mudpy.conf.

4 years agoAdd info on what's missing and included 0.0.1
Jeremy Stanley [Sun, 7 Jul 2019 03:06:15 +0000 (03:06 +0000)]
Add info on what's missing and included

To properly set expectations, update the README file with
information on the current state of development, what's done so far
and what's not yet.

4 years agoAdd a demo walk-through to the coder guide
Jeremy Stanley [Sun, 7 Jul 2019 01:49:28 +0000 (01:49 +0000)]
Add a demo walk-through to the coder guide

Include an example of a simple development environment setup,
explaining how to start the server using the provided sample
configuration and then interact with it using a console-based MUD
client.

4 years agoRecommend the tox-venv plug-in
Jeremy Stanley [Sun, 7 Jul 2019 01:45:47 +0000 (01:45 +0000)]
Recommend the tox-venv plug-in

In the coder guide, include a suggestion for tox-venv (a tox plug-in
which makes tox use the venv module from the Python 3 standard
library in place of the separate virtualenv package).

4 years agoLink API documentation in the coder guide
Jeremy Stanley [Sun, 7 Jul 2019 01:42:20 +0000 (01:42 +0000)]
Link API documentation in the coder guide

In the API section of the coder guide, add a cross-link to the API
documentation for the package and modules.

4 years agoDrop Python 3.4 and add 3.8
Jeremy Stanley [Sat, 6 Jul 2019 22:13:00 +0000 (22:13 +0000)]
Drop Python 3.4 and add 3.8

Python 3.4 reached end-of-life status nearly 4 months ago with the
release of 3.4.10 on 2019-03-18, so stop asserting we test new
commits against it (truth be told, it was already hard to build on
modern distros with newer libssl anyway).

Python 3.8 has been in beta for over a month already, and 3.8.0b2
was tagged earlier this week. New commits have been tested against
3.8 alpha and beta builds for a while, so add it to the list of
trove classifiers.

Update the README file to stop mentioning minimum Python 3 versions,
so that it won't need further updates as older interpreters age out.

4 years agoUpdate minimum PBR for setup_requires
Jeremy Stanley [Mon, 10 Jun 2019 22:49:15 +0000 (22:49 +0000)]
Update minimum PBR for setup_requires

Some of the recently-added Python package metadata (particularly
project_urls and description-content-type) need newer PBR where that
support was added. PBR 5.0.0 is the oldest version with the
particular features we're using, so update the lower bound for it
accordingly.

4 years agoImprove preferences display
Jeremy Stanley [Mon, 13 May 2019 20:26:09 +0000 (20:26 +0000)]
Improve preferences display

When displaying preferences, color-code the base and admin
preferences similar to command help. Also show a placeholder when
there is no existing value set for a preference. Add a hyphen
separator between preference names and values. Update tests to
accommodate the new formatting, and while we're there add a test to
make sure non-admins can't set values for admin-only preferences.

4 years agoSupport abbreviating portal names when moving
Jeremy Stanley [Mon, 13 May 2019 19:28:30 +0000 (19:28 +0000)]
Support abbreviating portal names when moving

Allow users to abbreviate portal names provided to the move command
for convenience.

4 years agoProvide normal error if command raises exception
Jeremy Stanley [Mon, 13 May 2019 19:23:51 +0000 (19:23 +0000)]
Provide normal error if command raises exception

If a attempting to execute a user-supplied command results in a
Python exception, return the normal error message string to the user
(in addition to logging the exception and traceback). This way,
normal users won't see any difference between unknown/invalid
commands and broken ones.

4 years agoSafely log when a command error cannot be sent
Jeremy Stanley [Mon, 13 May 2019 19:22:24 +0000 (19:22 +0000)]
Safely log when a command error cannot be sent

If a command triggers an error back to the user and sending that
error raises an exception, log it and continue to avoid crashing the
engine.

4 years agoCorrect data type for see_also command facets
Jeremy Stanley [Mon, 13 May 2019 03:30:53 +0000 (03:30 +0000)]
Correct data type for see_also command facets

Make the see_also facets of the chat and say commands list items as
they were originally intended to be, and test that they get
displayed.

4 years agoShow possible abbreviations in help list
Jeremy Stanley [Mon, 13 May 2019 03:06:42 +0000 (03:06 +0000)]
Show possible abbreviations in help list

When listing available commands via the help command, show which
parts of a given command word are optional to type. Also test it.

4 years agoCorrect logged error for missing action function
Jeremy Stanley [Mon, 13 May 2019 02:24:59 +0000 (02:24 +0000)]
Correct logged error for missing action function

When logging an error for a missing command action function,
correctly include the function name. Also go ahead and add the
action name sought for improved clarity.

4 years agoMake command actions implicit
Jeremy Stanley [Sun, 12 May 2019 13:22:42 +0000 (13:22 +0000)]
Make command actions implicit

If an action is not listed for a command, assume the action function
is named the same as the command itself.

4 years agoDereference command action functions
Jeremy Stanley [Sat, 11 May 2019 13:24:02 +0000 (13:24 +0000)]
Dereference command action functions

Replace the use of Python expressions for command actions with
simple names of functions relative to the mudpy package namespace.
This removes an unsafe use of exec(). Also start catching all
exceptions raised by the execution of a command and simply logging
them rather than allowing them to crash the engine.

4 years agoTest the show result command
Jeremy Stanley [Sat, 11 May 2019 13:20:55 +0000 (13:20 +0000)]
Test the show result command

Add self test coverage for the show result administrative command,
both with a working expression and one which raises an exception.

4 years agoCorrect a TypeError in the show time command
Jeremy Stanley [Sat, 11 May 2019 13:18:04 +0000 (13:18 +0000)]
Correct a TypeError in the show time command

Add missing type conversion in the output of the show time
administrative command, and include a regression test so we assure
it continues to work.

4 years agoAlways pass parameters in commands
Jeremy Stanley [Thu, 9 May 2019 21:06:35 +0000 (21:06 +0000)]
Always pass parameters in commands

When calling a command handler, pass a parameters object regardless
of whether the command actually needs one. This normalizes the
interface between command actions and their corresponding handler
functions so they can be called through a generic interface in the
future.

4 years agoDon't allow abbreviating administrative commands
Jeremy Stanley [Thu, 9 May 2019 20:19:50 +0000 (20:19 +0000)]
Don't allow abbreviating administrative commands

If a command is flagged as administrative, don't match substring
abbreviations for it. For example, an admin entering "h" should get
the help summary, not halt the engine.

4 years agoShow full command name in help output
Jeremy Stanley [Thu, 9 May 2019 20:18:13 +0000 (20:18 +0000)]
Show full command name in help output

When help is requested on an abbreviated command, include the full
name (rather than the provided abbreviation) in the synopsis.

4 years agoImplicitly support abbreviating commands
Jeremy Stanley [Mon, 6 May 2019 19:00:13 +0000 (19:00 +0000)]
Implicitly support abbreviating commands

Match entered commands against initial substrings of a sorted list
of command keywords, effectively supporting abbreviated commands.
Also test it works.

4 years agoAllow including time in the active state prompt
Jeremy Stanley [Sun, 5 May 2019 21:07:26 +0000 (21:07 +0000)]
Allow including time in the active state prompt

Occurrences of $(time) in the user's prompt string will be replaced
by the current World clock increment when displayed. Also test this
works as intended.

4 years agoEscape replacement macros in preferences
Jeremy Stanley [Sun, 5 May 2019 20:37:43 +0000 (20:37 +0000)]
Escape replacement macros in preferences

Don't let users inject replacement macros into their preferences,
just escape them so they're harmless. Also adjust the preferences
tests to include macros so this safety measure does not regress.

4 years agoTest that macros are escaped in communication
Jeremy Stanley [Sun, 5 May 2019 20:36:17 +0000 (20:36 +0000)]
Test that macros are escaped in communication

We explicitly escape replacement macros in user input for
communication commands (say, ask, et cetera). Test to make sure this
safety measure does not regress.

4 years agoUse the active state prompt as the default prompt
Jeremy Stanley [Sun, 5 May 2019 16:44:10 +0000 (16:44 +0000)]
Use the active state prompt as the default prompt

In order to stop hard-coding the default prompt string into the
prompt method, use the prompt string associated with the active
state to provide it. This is intuitive and allows it to be more
easily overridden if desired.

4 years agoAdd a prompt generator method
Jeremy Stanley [Sun, 5 May 2019 16:20:48 +0000 (16:20 +0000)]
Add a prompt generator method

Move the retrieval and assembly of the prompt string fragment for
active state users into its own method, paving the way for more
dynamic and extensible prompts.

4 years agoFix selftest telopt callback for Python 3.4
Jeremy Stanley [Sun, 5 May 2019 15:26:10 +0000 (15:26 +0000)]
Fix selftest telopt callback for Python 3.4

Python 3.4 is unable to handle formatted bytestrings. Replace two
occurrences in the Telnet option callback handler in the selftest
script to use concatenation operators instead.

4 years agoUse ISO 8601 time in logs
Jeremy Stanley [Sat, 27 Apr 2019 19:13:58 +0000 (19:13 +0000)]
Use ISO 8601 time in logs

For ease of readability, switch log timestamps from traditional
"asctime" format to ISO 8601 date and time.

4 years agoTest for high-severity vulnerabilities with bandit
Jeremy Stanley [Sat, 27 Apr 2019 16:14:45 +0000 (16:14 +0000)]
Test for high-severity vulnerabilities with bandit

Use the bandit analyzer to check non-test-related Python source code
for potential vulnerabilities. To start, only error on matches with
severity "high" (we can ratchet it down later as lower-severity
items are addressed).

5 years agoTest with the bugbear plugin for flake8
Jeremy Stanley [Sat, 30 Mar 2019 19:09:01 +0000 (19:09 +0000)]
Test with the bugbear plugin for flake8

Add the bugbear plugin to the flake8 tox testenv, and mark as
private a couple of loop control variables it identified (B007).

5 years agoFix comparisons for pyflakes 2.1
Jeremy Stanley [Sun, 3 Feb 2019 00:28:23 +0000 (00:28 +0000)]
Fix comparisons for pyflakes 2.1

The latest release of flake8 updates to pyflakes 2.1, and with that
comes an expectation that typical variable equality comparisons
should avoid the use of "is" and "is not" for safety. Adjust a
couple places we previously ran afoul of the new F632 check.

5 years agoSafely log unknown Telnet options and commands
Jeremy Stanley [Sun, 3 Feb 2019 00:07:36 +0000 (00:07 +0000)]
Safely log unknown Telnet options and commands

During Telnet negotiation, log unknown options by numeric value if
there is no listed name for them. Do the same for unknown Telnet
commands, though in reality this should never happen as they get
filtered by the existing implementation. Add regression testing to
make certain the crash bug which this fixes doesn't recur.

5 years agoBe explicit about test requirements in tox.ini
Jeremy Stanley [Sun, 27 Jan 2019 19:25:19 +0000 (19:25 +0000)]
Be explicit about test requirements in tox.ini

Only a couple of the testenvs listed in tox.ini actually made use of
the packages claimed as general test dependencies inherited by all
testenvs. Move these to their corresponding declarations and drop
the old test-requirements.txt file.

5 years agoSwitch to passlib.PasswordHash.hash
Jeremy Stanley [Sun, 27 Jan 2019 19:14:04 +0000 (19:14 +0000)]
Switch to passlib.PasswordHash.hash

Starting with passlib 1.7 the PasswordHash.encrypt() method has been
renamed to PasswordHash.hash() for clarity, and the old name
deprecated. Use the new name and update our minimum passlib
dependency version accordingly.

5 years agoAdd support for user preferences
Jeremy Stanley [Tue, 22 Jan 2019 01:44:57 +0000 (01:44 +0000)]
Add support for user preferences

Make it possible for users to list, view and set values of any
account facets white-listed in configuration. Also add
administrator-only preferences as a convenience option. To have a
means of exercising this, make the active state prompt dynamic so
that each user can set it as a preferences. Include sample
configuration, regression tests and documentation.

5 years agoAdd 2019 to copyright for docs and license
Jeremy Stanley [Sat, 5 Jan 2019 18:24:35 +0000 (18:24 +0000)]
Add 2019 to copyright for docs and license

A new year is upon us, and changes committed in 2019 warrant
increasing the copyright range for documentation and the full
license text to indicate that.

5 years agoRename command.set to command.c_set
Jeremy Stanley [Sat, 5 Jan 2019 17:53:57 +0000 (17:53 +0000)]
Rename command.set to command.c_set

In order to avoid shadowing any built-in set() method for Python
modules, rename the set() function defined in the command module to
c_set() and adjust the corresponding caller for the "set"
administrative command accordingly.

5 years agoSupport using tox-venv for testing
Jeremy Stanley [Sat, 5 Jan 2019 17:20:58 +0000 (17:20 +0000)]
Support using tox-venv for testing

The tox-venv plugin for tox leverages the venv module from the
Python 3 standard library instead of relying on the third-party
virtualenv project. Its environments differ in minor ways, however,
so to accommodate that we adjust a couple of our tox testenvs. The
dist testenv no longer assumes the wheel package will be installed,
and expressly includes it as a dep. The docs testenv preinstalls
mudpy into the environment so that we can be sure PBR generates the
AUTHORS and ChangeLog files before Sphinx attempts to include them
in any rendered documents.

5 years agoRename debug testenv to demo and use sample config
Jeremy Stanley [Mon, 31 Dec 2018 18:41:49 +0000 (18:41 +0000)]
Rename debug testenv to demo and use sample config

Switch the tox testenv name for invoking the daemon to demo, and
also switch it to implicitly using the default sample configuration
in etc/mudpy.yaml rather than explicitly using the daemon config
from the test fixtures. This makes it a little more friendly for
developers and/or first-time users who want to try things out since
`tox -e demo` will get them the log streaming to stdout and the
process bound to the invoking terminal where they can terminate it
with a simple sigint. For those who want to use a different
configuration, it can be passed with a command-line argument, like
`tox -e demo mudpy/tests/fixtures/test_daemon.yaml` (as an example
to replicate the old "debug" behavior).

5 years agoUse yamllint --strict when called from tox
Jeremy Stanley [Mon, 31 Dec 2018 18:33:56 +0000 (18:33 +0000)]
Use yamllint --strict when called from tox

To treat YAML formatting inconsistency warnings from yamllint as
blocking errors for development, invoke it with --strict so that tox
will report a failure rather than success.

5 years agoMove commands into a separate command module
Jeremy Stanley [Fri, 9 Nov 2018 21:54:21 +0000 (21:54 +0000)]
Move commands into a separate command module

For ease of maintainability, move all the mudpy.misc.command_*()
functions into their own module accessible via mudpy.command.*()
instead. In order to accomplish this, User objects now carry a
universe attribute so that commands they call can identify the
correct universe object in which to act.

Alphabetize the command functions, update the corresponding function
calls in the command elements, add the new module to the API
documentation, and include it in the dynamic module reload list.

5 years agoUpdate admin command help for new data model
Jeremy Stanley [Sat, 3 Nov 2018 13:06:15 +0000 (13:06 +0000)]
Update admin command help for new data model

Refresh the example invocations in help entries for admin commands
which previously showed old-style element identifiers.

5 years agoAlphabetize the `help show` subcommand entries
Jeremy Stanley [Sun, 28 Oct 2018 19:46:38 +0000 (19:46 +0000)]
Alphabetize the `help show` subcommand entries

When categories were renamed to groups, help details for the
corresponding show subcommands were updated in-place rather than
getting reordered to maintain the existing alphabetization. Fix it.

5 years agoDon't LBYL when creating missing data directories
Jeremy Stanley [Sat, 27 Oct 2018 21:01:52 +0000 (21:01 +0000)]
Don't LBYL when creating missing data directories

It's better to ask forgiveness than permission. Just try to create
parent directories for any data file, and don't error if they
already exist.

5 years agoTry to make missing pidfile and logfile parent dir
Jeremy Stanley [Sat, 27 Oct 2018 20:52:04 +0000 (20:52 +0000)]
Try to make missing pidfile and logfile parent dir

Rather than assume the path to a specified pidfile or logfile
already exists, try to make it before opening the file for writing.
This solves an issue with `tox -e debug` raising FileNotFoundError
when trying to open the logfile. Remove the mkdir() call in the
selftest setup so that this gets exercised properly.

5 years agoUpdate copyright dates for files changed in 2018
Jeremy Stanley [Tue, 16 Oct 2018 15:53:45 +0000 (15:53 +0000)]
Update copyright dates for files changed in 2018

Bump the copyright date to the present for files which received
significant modification since the beginning of 2018.

5 years agoAdd navigation links to Sphinx config
Jeremy Stanley [Mon, 15 Oct 2018 12:49:49 +0000 (12:49 +0000)]
Add navigation links to Sphinx config

Similar to the project URLs in the Python package configuration,
include some useful hyperlinks in the Sphinx Alabaster sidebar for
things like code browsing/cloning, bug reporting and release files.

5 years agoReorganize Sphinx config
Jeremy Stanley [Mon, 15 Oct 2018 12:43:22 +0000 (12:43 +0000)]
Reorganize Sphinx config

For improved manageability, sort the contents of the Sphinx conf.py
file alphabetically, and switch to the same indentation style as the
rest of the codebase.

5 years agoClarify Python version support in README
Jeremy Stanley [Sun, 14 Oct 2018 20:48:14 +0000 (20:48 +0000)]
Clarify Python version support in README

Make it more apparent that testing is being performed as far back as
Python 3.4, which doesn't exclude the possibility that it may also
be made to work with Python 3.3 on platforms where that can still be
compiled/installed.

5 years agoGeneralize copyright headers in files
Jeremy Stanley [Tue, 2 Oct 2018 20:53:01 +0000 (20:53 +0000)]
Generalize copyright headers in files

Since we're distributing an AUTHORS file even in wheel packages now
replace the specific copyright strings with ones which generally
mention "mudpy authors" instead, refer to the AUTHORS file and Git
history from the LICENSE file, and embed the generated list of
authors in rendered versions of the license.

5 years agoAdd AUTHORS file to wheel
Jeremy Stanley [Sat, 29 Sep 2018 17:42:23 +0000 (17:42 +0000)]
Add AUTHORS file to wheel

Now that Wheel 0.32 supports a list of license_files we can
incorporate the AUTHORS file into .whl packages. With this, we
should also be able to make the copyright headers in various files
more generalized.

5 years agoRemove docutils dep in tox dist testenv
Jeremy Stanley [Sat, 29 Sep 2018 17:09:40 +0000 (17:09 +0000)]
Remove docutils dep in tox dist testenv

Now that we're using `twine check` to validate the package long
description, we no longer need to preinstall docutils in
testenv:dist.

5 years agoSwitch to `twine check` in tox testenv:dist
Jeremy Stanley [Tue, 25 Sep 2018 15:25:51 +0000 (15:25 +0000)]
Switch to `twine check` in tox testenv:dist

As of twine 1.12.0 we can now replace `setup.py check ...` with
`twine check` as a more standard approach to validating the markup
of description text in packages (and potentially other aspects of
package metadata in the future).

5 years agoAdd debug logging for Telnet protocol negotiation
Jeremy Stanley [Sun, 2 Sep 2018 00:54:59 +0000 (00:54 +0000)]
Add debug logging for Telnet protocol negotiation

For improved debugging of Telnet protocol negotiations, add a log
function wrapper to the telnet module and apply it any time Telnet
commands are received or sent.

5 years agoExpand logging for User class methods
Jeremy Stanley [Sun, 2 Sep 2018 00:36:22 +0000 (00:36 +0000)]
Expand logging for User class methods

Increase logging detail so that client connection/disconnection,
account login/logout, avatar activation/deactivation and
creation/deletion can be clearly associated and followed for ease of
troubleshooting.