This library offers concise manners to modify list sys.path. The user should not need to directly interact with that list.
Project description
FRANÇAIS
Cette bibliothèque offre des manières concises de modifier la liste sys.path.
L'utilisateur ne devrait pas avoir besoin d'interagir directement avec cette
liste.
Contenu
Les fonctions de syspathmodif prennent un chemin de type str ou
pathlib.Path comme argument.
Elles convertissent les arguments de type pathlib.Path en str puisque
sys.path n'est censée contenir que des chaînes de caractères.
sp_appendajoute le chemin donné à la fin desys.path.sp_containsindique sisys.pathcontient le chemin donné.sp_removeenlève le chemin donné desys.path.
Dès son instanciation, la classe SysPathBundle contient plusieurs chemins et
les ajoute à sys.path. Quand on vide (clear) une instance, elle efface son
contenu et l'enlève de sys.path. Ainsi, cette classe facilite l'ajout et le
retrait d'un groupe de chemins.
Il est possible d'utiliser SysPathBundle comme un gestionnaire de contexte
(context manager). Dans ce cas, l'instance est vidée à la fin du bloc with.
Pour plus d'informations, consultez la documentation des fonctions et les démos dans le dépôt de code source.
ENGLISH
This library offers concise manners to modify list sys.path.
The user should not need to directly interact with that list.
Content
The functions in syspathmodif take a path of type str or pathlib.Path
as an argument.
They convert arguments of type pathlib.Path to str since sys.path is
supposed to contain only character strings.
sp_appendappends the given path to the end ofsys.path.sp_containsindicates whethersys.pathcontains the given path.sp_removeremoves the given path fromsys.path.
Upon instantiation, class SysPathBundle stores several paths and adds them to
sys.path. When a bundle is cleared, it erases its content and removes it from
sys.path. Thus, this class facilitates adding and removing a group of paths.
SysPathBundle can be used as a context manager. In that case, the instance is
cleared at the with block's end.
For more information, consult the functions' documentation and the demos in the source code repository.
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
File details
Details for the file syspathmodif-1.2.0.tar.gz.
File metadata
- Download URL: syspathmodif-1.2.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e9d5ce42acb8adfbe9397c9735332f7f01742c104d562768a66bd79a88415a1
|
|
| MD5 |
b572a899d2eb2f35928de2e145080890
|
|
| BLAKE2b-256 |
2deaf7314eec384333b07901cea86c2627b557489f8887098b0956261eddf871
|