<commit_before>import os
import pathlib
import pkg_resources
import shutil

import click

from .server import get_app
from .utils import path_type


@click.group()
def main():
    """Entry point for fanghorn."""
    pass


@main.command('dev-server')
@click.option('--local', 'env', flag_value='local', default=True, show_default=True, help='Run with dev configs.')
@click.option('--prod', 'env', flag_value='prod', help='Run with prod configs.')
@click.option('--config-dir', type=path_type, help='Explicit configuration directory to use.')
@click.option('-h', '--hostname', default='127.0.0.1', show_default=True, help='Host for the server.')
@click.option('-p', '--port', default=8080, show_default=True, help='Port for the server.')
@click.option('-d', '--debugger', is_flag=True, help='Start server with debugger.')
@click.option('-r', '--reloader', is_flag=True, help='Start server with hot reloader.')
def dev_server(hostname, port, reloader, debugger, env):
    """Run the development server."""
    app = get_app(env)
    from werkzeug.serving import run_simple
    run_simple(hostname, port, app, use_reloader=reloader, use_debugger=debugger)
<commit_msg>guard against dev server import errors<commit_after>import os
import pathlib
import pkg_resources
import shutil

import click

from .server import get_app
from .utils import path_type


@click.group()
def main():
    """Entry point for fanghorn."""
    pass


@main.command('dev-server')
@click.option('--local', 'env', flag_value='local', default=True, show_default=True, help='Run with dev configs.')
@click.option('--prod', 'env', flag_value='prod', help='Run with prod configs.')
@click.option('--config-dir', type=path_type, help='Explicit configuration directory to use.')
@click.option('-h', '--hostname', default='127.0.0.1', show_default=True, help='Host for the server.')
@click.option('-p', '--port', default=8080, show_default=True, help='Port for the server.')
@click.option('-d', '--debugger', is_flag=True, help='Start server with debugger.')
@click.option('-r', '--reloader', is_flag=True, help='Start server with hot reloader.')
def dev_server(hostname, port, reloader, debugger, env):
    """
    Run the development server.

    Run the development server with the provided options. Requires the
    development dependencies to be installed to work.
    """
    app = get_app(env)
    try:
        from werkzeug.serving import run_simple
    except ImportError:
        click.secho('Development dependencies not installed!', fg='red', err=True)
        raise click.Abort()
    else:
        run_simple(hostname, port, app, use_reloader=reloader, use_debugger=debugger)

{'fraction_non_alphanumeric': 0.15604975499434603, 'fraction_numerical': 0.007538635506973238, 'mean_word_length': 4.924107142857143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3057872', 'n_tokens_mistral': 849, 'n_tokens_neox': 834, 'n_words': 238}