跳转到主要内容

自动将$PWD设置为环境变量。

项目描述

Testing Linting Read the Docs Codecov PyPi Package MIT License

https://app.codecov.io/gh/libranet/autoset-pwd

autoset-pwd

通过sitecustomize-入口点自动将当前工作目录的$PWD目录添加到环境变量中。

它是如何工作的?

我们将autoset_pdw.entrypoint()函数注册到由sitecustomize-entrypoints包安装的sitecustomize模块。

注册的函数将查找当前工作目录中的os.getcwd()并将其设置为环境变量。

安装

通过pip安装

> bin/pip install autoset-pwd

或将它添加到你的基于poetry的项目中

> poetry add autoset-pwd

验证和用法

安装此包后,无需进行任何明确的操作。我们可以通过启动一个python会话并检查环境变量来验证插件是否正确工作

> bin/python
>>> import os
>>> print(os.getcwd())
    "<path-to-your-current-dir>"

print(os.getenv("PwD_DIR")) ""

注册sitecustomize-entrypoint

《autoset_pwd》函数已在我们的 pyproject.toml_ 中注册为《sitecustomize》入口点。

    [tool.poetry.plugins]
    [tool.poetry.plugins."sitecustomize"]
    autoset_pwd = "autoset_pwd:entrypoint"

在每次 Python 进程启动时,都会执行 Sitecustomize 以及其所有注册的入口点。更多信息,请参见 sitecustomize-entrypoints

兼容性

Python Version PyPI - Implementation

autoset-pwd 在 Python 3.8+ 上运行,包括 PyPy3。测试至 Python 3.11。

重要依赖项

项目详情


下载文件

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

源代码发行版

autoset_pwd-0.1.tar.gz (5.1 kB 查看哈希值)

上传时间 源代码

构建发行版

autoset_pwd-0.1-py3-none-any.whl (3.4 kB 查看哈希值)

上传时间 Python 3

由以下支持