<commit_before>First, create the stream you’d like to use for Trac notifications, and
subscribe all interested parties to this stream. The integration will
use the default stream `trac` if no stream is supplied in the hook;
you still need to create the stream even if you are using this
default.

{! download-python-bindings.md !}

Next, open `integrations/trac/zulip_trac_config.py` in your favorite
editor, and change the following lines to specify your bot’s email
address, API key, and where you’d like your notification messages to
go (by default, stream `trac`):

```
ZULIP_USER = "<EMAIL>"
ZULIP_API_KEY = "<KEY>"
STREAM_FOR_NOTIFICATIONS = "trac"
TRAC_BASE_TICKET_URL = "https://trac.example.com/ticket"
{% if api_site_required %}ZULIP_SITE ="{{ external_api_uri_subdomain }}"{% endif %}
```

Copy `integrations/trac/zulip_trac.py` and
`integrations/trac/zulip_trac_config.py` into your Trac installation’s
`plugins/` subdirectory. Once you’ve done that, edit your Trac
installation’s `conf/trac.ini` to add `zulip_trac` to the
`[components]` section, as follows:

```bash
[components]
zulip_trac = enabled
```

You may then need to restart Trac (or Apache) so that Trac will load
our plugin.

When people open new tickets (or edit existing tickets), you’ll see a
message like the following, to the stream `trac` (or whatever you
configured above) with a topic that matches the ticket name

{! congrats.md !}

![](/static/images/integrations/trac/001.png)

**Additional trac configuration**

After using the plugin for a while, you may want to customize which
changes to tickets result in a Zulip notification using the
`TRAC_NOTIFY_FIELDS` setting in `zulip_trac_config.py`.
<commit_msg>integrations/trac: Use Markdown macros.<commit_after>{!create-stream.md!}

{!download-python-bindings.md!}

{!change-zulip-config-file.md!}

Also, change the following lines:

```
STREAM_FOR_NOTIFICATIONS = "trac"
TRAC_BASE_TICKET_URL = "https://trac.example.com/ticket"
```

Set `STREAM_FOR_NOTIFICATIONS` to the name of the stream
you'd like the notifications to be sent to.

Copy `integrations/trac/zulip_trac.py` and
`integrations/trac/zulip_trac_config.py` into your Trac installation’s
`plugins/` subdirectory. Once you’ve done that, edit your Trac
installation’s `conf/trac.ini` to add `zulip_trac` to the
`[components]` section, as follows:

```bash
[components]
zulip_trac = enabled
```

You may then need to restart Trac (or Apache) so that Trac will load
our plugin.

When people open new tickets (or edit existing tickets), notifications
will be sent to the stream `trac` (or whatever you
configured above) with a topic that matches the ticket name.

{!congrats.md!}

![](/static/images/integrations/trac/001.png)

**Additional trac configuration**

After using the plugin for a while, you may want to customize which
changes to tickets result in a Zulip notification using the
`TRAC_NOTIFY_FIELDS` setting in `zulip_trac_config.py`.

{'fraction_non_alphanumeric': 0.09653297076818491, 'fraction_numerical': 0.0020394289598912306, 'mean_word_length': 5.288461538461538, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5884673', 'n_tokens_mistral': 988, 'n_tokens_neox': 949, 'n_words': 350}