Automatically set $PWD as an environment-variable.
Project description
https://app.codecov.io/gh/libranet/autoset-pwd
autoset-pwd
Automatically add the $PWD-directory to the PWD_DIR
-environment variable
via sitecustomize
-entrypoint.
How does it work?
We register the autoset_pdw.entrypoint()
-function to the sitecustomize
-module that is installed by the
sitecustomize-entrypoints-package.
The registered function will look up os.getcwd()
in your current working directory and
set it as PWD_DIR
-environment variable.
Installation
Install via pip:
> bin/pip install autoset-pwd
Or add to your poetry-based project:
> poetry add autoset-pwd
Validate & Usage
After installing this package there is nothing left to do explicitly.
We can validate that the plugin work correctly by starting a python-session and checking the PWD_DIR
-environment-variable:
> bin/python
>>> import os
>>> print(os.getcwd())
"<path-to-your-current-dir>"
print(os.getenv("PwD_DIR")) ""
Registered sitecustomize-entrypoint
The autoset_pwd
-function is registered as a sitecustomize
-entrypoint in our pyproject.toml_:
[tool.poetry.plugins]
[tool.poetry.plugins."sitecustomize"]
autoset_pwd = "autoset_pwd:entrypoint"
Sitecustomize and all its registered entrypoints will be executed at the start of every python-process. For more information, please see sitecustomize-entrypoints
Compatibility
autoset-pwd
works on Python 3.8+, including PyPy3. Tested until Python 3.11,
Notable dependencies
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file autoset_pwd-0.1.tar.gz
.
File metadata
- Download URL: autoset_pwd-0.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1030d2596057326a6b7d5ce9491516c6b9196a01035aa30808b3af50a56174b7 |
|
MD5 | 2cf797359916af652a655ed898744ac5 |
|
BLAKE2b-256 | 4438c77f7acce819d24e92892e1cb86f80beb541eaaa50ea13a874a1186d368d |
File details
Details for the file autoset_pwd-0.1-py3-none-any.whl
.
File metadata
- Download URL: autoset_pwd-0.1-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a5a4ff4c40adfbd6781b96b760341998fd497c403c2006e4bb60422fdd70f68 |
|
MD5 | 471367e28b2ecad1ac59a89a974dadef |
|
BLAKE2b-256 | 384dafbdf1727baad73e5b7f2860994555fe74b3eefaaa6a2557367f38c9a4d6 |