跳转到主要内容

一个用于以可编辑模式安装分发的库。

项目描述

frontend-editables 是一个用于开发Python包的库,最初作为 PEP 662 的一个概念证明而创建。它支持使用四种不同的方法安装预期的“可编辑”wheel

  • “宽松”符号链接

    仅符号链接 顶级 包和模块 - 包的内容可能与发布版本中的内容不同。

  • “严格”符号链接

    仅符号链接 文件,忠实地反映发布版本中包的结构。

  • 重定向器

    生成一个自定义模块查找器,用于从磁盘上的另一个位置加载包和模块,并在启动时使用动态 .pth 文件注入到 sys.meta_path。这与“宽松”符号链接方法类似 - 更多信息,请参阅 editables

  • 静态 .pth 文件

    创建一个 .pth 文件,列出包含分发包和模块的目录,以添加到Python路径。这将暴露可能在同一文件夹中的各种包和模块。

安装

$ python -m pip install frontend-editables

基本用法

import sysconfig

import frontend_editables

path_mapping = ...  # Will have been returned by the backend.
installed_files = frontend_editables.install(
    [frontend_editables.PthFileInstaller],
    "name",
    sysconfig.get_path("purelib"),
    path_mapping,
)
# Then append the ``installed_files`` to the distribution's ``RECORD``,
# optionally by passing ``append_to_record=<path to RECORD>`` to ``install``.

路径必须将潜在的wheel文件映射到磁盘上的绝对路径;文件夹路径无效。

命令行界面

frontend_editables 包含一个非常原始的CLI,作为可编辑安装标准化的临时解决方案。您可以用它来代替 python -m pip install -e ...。CLI支持库支持的所有布局和安装方法。一些示例

  • 要安装包含单个模块 foo.py 的项目,对其进行符号链接: python -m frontend_editables.transitional_cli -m strict_symlink foo.py foo.py

  • 使用 foo 包安装项目,该包位于 <project-root>/src/foo,通过 pth 文件辅助:运行 python -m frontend_editables.transitional_cli -m pth_file src/foo foo

  • 使用重定向路径查找器安装位于不同位置的多个包的项目:运行 python -m frontend_editables.transitional_cli -m redirector {src/,}foo {lib/,}bar

可编辑的发行版可以像平常一样使用 pip 卸载。

usage: python -m frontend_editables.transitional_cli [-h] --method
                                                     {lax_symlink,pth_file,redirector,strict_symlink}
                                                     [--spec SPEC]
                                                     path_pairs [path_pairs ...]

Wacky transitional editable project installer.

positional arguments:
  path_pairs            pairs of path on disk and corresponding path in the
                        virtual wheel (posix)

optional arguments:
  -h, --help            show this help message and exit
  --method {lax_symlink,pth_file,redirector,strict_symlink}, -m {lax_symlink,pth_file,redirector,strict_symlink}
                        editable installation method to use (default: None)
  --spec SPEC           requirement specifier (default: .)

贡献

您可以使用 frontend-editables 安装用于开发的 frontend-editables

$ PYTHONPATH=src python -m frontend_editables.transitional_cli \
    --spec .[test] {src/,}frontend_editables

在提交合并请求之前,安装 nox 并运行 nox。类型检查步骤依赖于外部依赖项 npm

祝您编码愉快!

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

frontend-editables-0.2.0.tar.gz (7.3 kB 查看哈希值)

上传时间

构建分布

frontend_editables-0.2.0-py3-none-any.whl (9.2 kB 查看哈希值)

上传时间 Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面