# Tinker Shell (REPL)

Masonite Tinker is a powerful REPL (Read, Evaluate, Print and Loop) environment for the Masonite framework. It's a supercharged Python interactive shell with access to the container, models and helpers.

Tinker allows you to interact with your entire Masonite project on the command line, including models, jobs, events, and more. To enter the Tinker environment, run the tinker command:

```
python craft tinker
```

This will open a Python shell with the application container (under the `app` variable), the application models and some helpers imported for you.

Finally you can get an enhanced experience by using the Tinker IPython shell. [IPython](https://ipython.org/) is an improved Python shell offering some interesting features:

* Syntax highlighting
* Tab completion of python variables and keywords, filenames and function keywords
* Input history, persistent across sessions
* Integrated access to the pdb debugger and the Python profiler
* and much more...

You just need to use `-i` option and install IPython if not installed yet (`pip install IPython`):

```
python craft tinker -i
```

## Configuration

### Auto-loading Models

By default your app models are loaded from the location configured in your project Kernel. You can override the directory to load models from with the `-d` flag. It should be a path relative to your project root. For example you can run the following command if your models are located in a `models/` folder located at your project root:

```
python craft tinker -d models/
```

### Startup script

You can use `PYTHONSTARTUP` environment variable to add a script that you want to run at the beginning of the shell session.

With IPython you can use this variable or put some Python scripts in `~/.ipython/profile_default/startup/`. IPython will run those scripts for you at the beginning of the shell session.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.masoniteproject.com/features/tinker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
