最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python packaging - Why pdm-build does not include the files I have specified in the includes? - Stack Overflow

programmeradmin1浏览0评论

I am using PDM for virtual environment package management. Also, I am using the pdm build backend, which is problematic. When I was originally packaging apps with setuptools, I was able to specify non-python files that would get included in the installed package, when installed as a library. With PDM, on the other hand, I was not able to include the files into the distribution whatever effort I exerted.

My project tree looks like the following:

Project
  report
    assets
      report_template.html
    conf
      reporter
        background
          drive.yaml
          conf1.yaml
          conf2.yaml
          ...
        ...
      ...
    __init__.py
    __main__.py
    src_file1.py
    src_file2.py
    ...
  tests
    conf
      test_conf1.yaml
      test_conf2.yaml
    __init__.py
    conftest.py
    test1.py
    test2.py
    ...
  .gitignore
  README.md
  pyproject.toml
  ...

my pyproject.toml contains the following:

[project]
name = "report"
dynamic = ["version"]
description = "..."
authors = [
  ...
]
requires-python = ">=3.11"
readme = "README.md"
license = { file = "LICENSE" }
classifiers = [
    ...
]
dependencies = [
    ...
]

[tool.pdm.version]
source = "file"
path = "report/__init__.py"

[tool.pdm.dev-dependencies]
dev = ["mypy", "pre-commit", "ruff"]
test = ["pytest", "pytest-cov"]


[tool.pdm.scripts]
report = "python -m report"
help = "python -m report.get_conf -h"
template = "python -m report.get_conf"

[tool.pdm.build]
package-dir = "."
includes = ["report", "report/conf/**/*.yaml", "report/assets/**/*.html", "report/assets/report_remplate.html"]


l = { composite = ["lint", "format", "mypy"] }
test = "pytest tests"
lint = "ruff check --fix"
format = "ruff format"
mypy = "mypy ."
post_install = { composite = [
    "pre-commit autoupdate",
    "pre-commit install",
    "pre-commit install --hook-type commit-msg",
] }

The HTML and YAML files do not get included, when I install the package from git using git+ssh (for example pdm add git+ssh://gitlab.domain.some/repo@commit_hash).

I tried every combination of settings from different versions of PDM, tried to add the files to MANIFEST.in, tried adding random init.py files everywhere, it just does not make sense to me.

The interesting thing is, that I was not able to find anyone else complaining about this online. This makes me believe that I am probably missing something others do not.

If anyone sees what I am missing, please help.

发布评论

评论列表(0)

  1. 暂无评论
ok 不同模板 switch ($forum['model']) { /*case '0': include _include(APP_PATH . 'view/htm/read.htm'); break;*/ default: include _include(theme_load('read', $fid)); break; } } break; case '10': // 主题外链 / thread external link http_location(htmlspecialchars_decode(trim($thread['description']))); break; case '11': // 单页 / single page $attachlist = array(); $imagelist = array(); $thread['filelist'] = array(); $threadlist = NULL; $thread['files'] > 0 and list($attachlist, $imagelist, $thread['filelist']) = well_attach_find_by_tid($tid); $data = data_read_cache($tid); empty($data) and message(-1, lang('data_malformation')); $tidlist = $forum['threads'] ? page_find_by_fid($fid, $page, $pagesize) : NULL; if ($tidlist) { $tidarr = arrlist_values($tidlist, 'tid'); $threadlist = well_thread_find($tidarr, $pagesize); // 按之前tidlist排序 $threadlist = array2_sort_key($threadlist, $tidlist, 'tid'); } $allowpost = forum_access_user($fid, $gid, 'allowpost'); $allowupdate = forum_access_mod($fid, $gid, 'allowupdate'); $allowdelete = forum_access_mod($fid, $gid, 'allowdelete'); $access = array('allowpost' => $allowpost, 'allowupdate' => $allowupdate, 'allowdelete' => $allowdelete); $header['title'] = $thread['subject']; $header['mobile_link'] = $thread['url']; $header['keywords'] = $thread['keyword'] ? $thread['keyword'] : $thread['subject']; $header['description'] = $thread['description'] ? $thread['description'] : $thread['brief']; $_SESSION['fid'] = $fid; if ($ajax) { empty($conf['api_on']) and message(0, lang('closed')); $apilist['header'] = $header; $apilist['extra'] = $extra; $apilist['access'] = $access; $apilist['thread'] = well_thread_safe_info($thread); $apilist['thread_data'] = $data; $apilist['forum'] = $forum; $apilist['imagelist'] = $imagelist; $apilist['filelist'] = $thread['filelist']; $apilist['threadlist'] = $threadlist; message(0, $apilist); } else { include _include(theme_load('single_page', $fid)); } break; default: message(-1, lang('data_malformation')); break; } ?>