mirror of
https://github.com/evennia/evennia.git
synced 2026-04-03 14:37:17 +02:00
Fixed all links
This commit is contained in:
parent
d4f1733bc7
commit
26f8ba3f71
175 changed files with 11972 additions and 4443 deletions
|
|
@ -1,11 +1,18 @@
|
|||
# Evennia API
|
||||
|
||||
|
||||
Evennia makes much of its programming tools available directly from the top-level `evennia` package. This is often referred to as Evennia's "flat" [Application Programming Interface](https://en.wikipedia.org/wiki/Application_programming_interface) (API). The flat API tries to collect and bring the most commonly used resources to the front in a way where everything is available at a glance (in a flat display), making it a good place to start to learn Evennia.
|
||||
Evennia makes much of its programming tools available directly from the top-level `evennia` package.
|
||||
This is often referred to as Evennia's "flat" [Application Programming
|
||||
Interface](https://en.wikipedia.org/wiki/Application_programming_interface) (API). The flat API
|
||||
tries to collect and bring the most commonly used resources to the front in a way where everything
|
||||
is available at a glance (in a flat display), making it a good place to start to learn Evennia.
|
||||
|
||||
> Evennia's flat (and full) API can be perused through the auto-generated [API Library refence](github:evennia).
|
||||
> Evennia's flat (and full) API can be perused through the auto-generated [API Library
|
||||
refence](github:evennia).
|
||||
|
||||
A good, interactive way to explore the flat API is to use [IPython](http://ipython.org/), a more flexible version of the default Python shell. Inside your virtual environment you can install IPython simply by
|
||||
A good, interactive way to explore the flat API is to use [IPython](http://ipython.org/), a more
|
||||
flexible version of the default Python shell. Inside your virtual environment you can install
|
||||
IPython simply by
|
||||
|
||||
pip install ipython
|
||||
|
||||
|
|
@ -26,16 +33,22 @@ Followed by
|
|||
|
||||
evennia.<TAB>
|
||||
|
||||
That is, write `evennia.` and press the TAB key. What pops up is the contents of the `evennia` top-level package - in other words [the "flat" API](github:evennia#the-flat-api).
|
||||
That is, write `evennia.` and press the TAB key. What pops up is the contents of the `evennia` top-
|
||||
level package - in other words [the "flat" API](github:evennia#the-flat-api).
|
||||
|
||||
evennia.DefaultObject?
|
||||
|
||||
Starting to write the name of an API entity and pressing `<TAB>` will auto-complete the name. Adding a question mark (`?`) to its name will show you its documentation. Append `??` to get the actual source code. This way you can quickly explore Evennia and see what is available.
|
||||
Starting to write the name of an API entity and pressing `<TAB>` will auto-complete the name. Adding
|
||||
a question mark (`?`) to its name will show you its documentation. Append `??` to get the actual
|
||||
source code. This way you can quickly explore Evennia and see what is available.
|
||||
|
||||
|
||||
## To remember when importing from `evennia`
|
||||
|
||||
Properties on the root of the `evennia` package are *not* modules in their own right. They are just shortcut properties stored in the `evennia/__init__.py` module. That means that you cannot use dot-notation to `import` nested module-names over `evennia`. The rule of thumb is that you cannot use `import` for more than one level down. Hence you can do
|
||||
Properties on the root of the `evennia` package are *not* modules in their own right. They are just
|
||||
shortcut properties stored in the `evennia/__init__.py` module. That means that you cannot use dot-
|
||||
notation to `import` nested module-names over `evennia`. The rule of thumb is that you cannot use
|
||||
`import` for more than one level down. Hence you can do
|
||||
|
||||
```python
|
||||
import evennia
|
||||
|
|
@ -55,4 +68,10 @@ but you *cannot* import two levels down
|
|||
from evennia.default_cmds import CmdLook # error!
|
||||
```
|
||||
|
||||
This will give you an `ImportError` telling you that the module `default_cmds` cannot be found - this is becasue `default_cmds` is just a *variable* stored in `evennia.__init__.py`; this cannot be imported from. If you really want full control over which level of package you import you can always bypass the root package and import directly from from the real location. For example `evennia.DefaultObject` is a shortcut to `evennia.objects.objects.DefaultObject`. Using this full path will have the import mechanism work normally. See `evennia/__init__.py` to see where the package imports from.
|
||||
This will give you an `ImportError` telling you that the module `default_cmds` cannot be found -
|
||||
this is becasue `default_cmds` is just a *variable* stored in `evennia.__init__.py`; this cannot be
|
||||
imported from. If you really want full control over which level of package you import you can always
|
||||
bypass the root package and import directly from from the real location. For example
|
||||
`evennia.DefaultObject` is a shortcut to `evennia.objects.objects.DefaultObject`. Using this full
|
||||
path will have the import mechanism work normally. See `evennia/__init__.py` to see where the
|
||||
package imports from.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue