linkedin / linkedin/shiv

Cache directory relative to executable path

Open
#169 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.9k
Forks
114
PR merge metrics
No merged PRs in 30d

Description

I currently have the problem that I want to move my cache directory relative to the executable path (sys.argv[0]).

This is needed because I want to have a shiv package distributed with an installer and all the package data at the installation directory. If the cache is global (e.g. ~/.shiv) I cannot remove it easily when deinstalling the package. Currently, I can only set the path to a directory relative to the current working directory or an environment variable. This is not feasible for me because the cwd can change and creating an environment variable would be a big overhead if installing multiple versions.

It would be great if I could specify something like "--root $__pkg__/cache" (introduce a special variable) or change the behavior to resolve "--root ./cache" relative to the sys.argv[0] directory. The first solution would also enable that you can use a subdirectory of a path set by a normal environment variable.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing --root handling and how paths are resolved relative to the current working directory or environment variables. Compare the two requested approaches around sys.argv[0], then confirm the chosen behavior supports installed shiv packages and allows their cache to be removed with the installation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.