对话机器人 Rasa(二十一):Rasa 项目的 gitignore 配置

文章目录

    rasa init 初始化项目之后,可以看到增加了很多不需要添加到 git 项目管理中的文件,例如

    • 模型文件。默认的模型文件大小就有 24M。
    • cache 文件

    等。

    在开始动手修改各种 yml 配置文件之前,最好先提交原始的文件到 git 管理中,防止误操作。

    网上找到一个规范的 rasa gitignore 文件,用来过滤这些文件。

    参考

    https://raw.githubusercontent.com/RasaHQ/rasa-nlu-examples/main/.gitignore

    gitignore 配置

    # Byte-compiled / optimized / DLL files
    __pycache__/
    *.py[cod]
    *$py.class
    
    # C extensions
    *.so
    
    # Distribution / packaging
    .Python
    build/
    develop-eggs/
    dist/
    downloads/
    eggs/
    .eggs/
    lib/
    lib64/
    parts/
    sdist/
    var/
    wheels/
    *.egg-info/
    .installed.cfg
    *.egg
    MANIFEST
    
    # PyInstaller
    #  Usually these files are written by a python script from a template
    #  before PyInstaller builds the exe, so as to inject date/other infos into it.
    *.manifest
    *.spec
    
    # Installer logs
    pip-log.txt
    pip-delete-this-directory.txt
    
    # Unit test / coverage reports
    htmlcov/
    .tox/
    .nox/
    .coverage
    .coverage.*
    .cache
    nosetests.xml
    coverage.xml
    *.cover
    .hypothesis/
    .pytest_cache/
    
    # Translations
    *.mo
    *.pot
    
    # Django stuff:
    *.log
    local_settings.py
    db.sqlite3
    
    # Flask stuff:
    instance/
    .webassets-cache
    
    # Scrapy stuff:
    .scrapy
    
    # Sphinx documentation
    docs/_build/
    
    # PyBuilder
    target/
    
    # Jupyter Notebook
    .ipynb_checkpoints
    
    # IPython
    profile_default/
    ipython_config.py
    
    # pyenv
    .python-version
    
    # celery beat schedule file
    celerybeat-schedule
    
    # SageMath parsed files
    *.sage.py
    
    # Environments
    .env
    .venv
    env/
    venv/
    ENV/
    env.bak/
    venv.bak/
    
    # Spyder project settings
    .spyderproject
    .spyproject
    
    # Rope project settings
    .ropeproject
    
    # mkdocs documentation
    /site
    
    # mypy
    .mypy_cache/
    .dmypy.json
    dmypy.json
    
    .idea
    tests/data/fasttext/*.bin
    models/*.tar.gz
    results/*
    /.pytype/
    
    Untitled*.ipynb
    .DS_Store
    **/.DS_Store
    tests/data/stanza
    .vscode
    .rasa
    

    提交的文件清单

    本地添加 gitignore 文件之后,可以看到模型文件,cache 文件等已经被过滤掉了。

    > git add .
    > git status
    On branch master
    
    No commits yet
    
    Changes to be committed:
      (use "git rm --cached <file>..." to unstage)
            new file:   .gitignore
            new file:   actions/__init__.py
            new file:   actions/actions.py
            new file:   config.yml
            new file:   credentials.yml
            new file:   data/nlu.yml
            new file:   data/rules.yml
            new file:   data/stories.yml
            new file:   domain.yml
            new file:   endpoints.yml
            new file:   tests/test_stories.yml
    

    关于作者 🌱

    我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊,或者关注我的个人公众号“大象工具”, 查看更多联系方式