You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MANIFEST.in文件的作用是什么?含示例配置功能问询

Great questions—let's break them down clearly, like you're asking a fellow Python developer who's spent way too much time packaging projects 😊

1. What is the purpose of MANIFEST.in?

When you're building a Python distribution package (think .tar.gz source archives or .whl wheels) with tools like setuptools or distutils, these tools don't automatically include every file in your project folder. By default, they only pick up core files like setup.py, setup.cfg, and Python modules (.py files that are part of a formal package structure).

That's where MANIFEST.in comes in: it's a plain text file that uses simple directives to tell the packaging tool exactly which additional files or directories to include (or exclude) in your final distribution.

Need to include documentation files, license texts, configuration templates, or even non-Python resources like JSON files? MANIFEST.in is your way to make sure those files aren't left out when you build your package. It's basically a "packing list" for your project's distribution.

2. What does the provided MANIFEST.in configuration do?

First, let's clean up the formatting a bit—each directive in MANIFEST.in should usually be on its own line, so the content you shared is likely meant to look like this:

recursive-include *.py
include README.rst
include LICENSE

Now let's break down each line:

  • recursive-include *.py: This tells the packaging tool to scan every subdirectory in your project recursively and include every file that ends with .py. While setuptools does include Python modules by default, this directive ensures that even standalone .py scripts (not part of a formal package) or files in nested subfolders aren't missed. It's a safety net to make sure all your code makes it into the distribution.
  • include README.rst: This explicitly adds the README.rst file to your package. READMEs are the first thing users look at to understand your project, so including this ensures anyone who downloads or installs your package gets that critical documentation immediately.
  • include LICENSE: This includes the LICENSE file, which is legally essential—it outlines the terms under which users can use, modify, and distribute your code. Omitting this would leave users unsure of their rights, so this line makes sure that legal information is part of the package.

All together, this MANIFEST.in ensures your distribution package is complete: it has all your Python code, the project's documentation, and the necessary license information.

内容的提问来源于stack exchange,提问作者user7693832

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 04:02:12