python文件被pyproject忽略,托姆尔

ghhkc1vu  于 2023-04-28  发布在  Python
关注(0)|答案(2)|浏览(110)

在src(mlm)目录下忽略python文件。我在where中包含了mlm目录,用于查找包。

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "arichuvadi"
version = "0.0.3"
authors = [
  { name="vanangamudi", email="sgfrecfs@gmail.com" },
]
description = "a basic set of tools to work with Tamil text"
readme = "YENNAI_PADI.txt"
license = { file="LICENSE" }
requires-python = ">=3.5"
classifiers = [
    "Programming Language :: Python :: 3",
    "Operating System :: OS Independent",
]

[project.urls]

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
where = ["src"]  # ["."] by default
include = ["*.py"]  # ["*"] by default
exclude = []  # empty by default
namespaces = true  # true by default

这是项目的目录布局

(arichuvadi)$ tree
.
├── LICENSE
├── MANIFEST.in
├── src
│   ├── arichuvadi.py
│   ├── orunguri-tha.py
│   ├── tharavu
│   │   ├── adaiyalamitta-ari.txt
│   │   ├── ari.txt
│   │   └── ari-uni.txt
│   └── valam.py
├── pyproject.toml
├── README.org -> YENNAI_PADI.txt
├── setup.py
└── YENNAI_PADI.txt
mklgxw1f

mklgxw1f1#

由于缺少__init__.py,您的src目录根本不包含python包(或模块)。你应该得到这样的结果:

.
├── LICENSE
├── MANIFEST.in
├── src
│   ├── my_actual_package_name
│   |   ├── __init__.py
│   │   ├── arichuvadi.py
│   │   ├── orunguri-tha.py
│   │   ├── tharavu
│   │   │   ├── adaiyalamitta-ari.txt
│   │   │   ├── ari.txt
│   │   │   └── ari-uni.txt
│   │   └── valam.py
├── pyproject.toml
├── README.org -> YENNAI_PADI.txt
├── setup.py
└── YENNAI_PADI.txt

如果您想在包中包含txt文件,还应该确保设置package_data配置。

ttygqcqt

ttygqcqt2#

或者,您可以在不更改目录树的情况下执行此操作:

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "arichuvadi"
version = "0.0.3"
authors = [
  { name="vanangamudi", email="sgfrecfs@gmail.com" },
]
description = "a basic set of tools to work with Tamil text"
readme = "YENNAI_PADI.txt"
license = { file="LICENSE" }
requires-python = ">=3.5"
classifiers = [
    "Programming Language :: Python :: 3",
    "Operating System :: OS Independent",
]

[project.urls]

[tool.setuptools]
packages = ["src"]

如果你有PyProject。toml,你不一定需要www.example www.example.com 更多

相关问题