Comments (8)
this would be a pain to support for a Path Type
We could introduce the contract that path variants always return the first of the multipath. If users want multipath they would need to do: user_data_dir().split(os.pathsep)
, at which point they can cast the elements into Path if they'd wish to 🤔
from platformdirs.
We could introduce the contract that path variants always return the first of the multipath.
Alternatively, site_data_path
could return a list of pathlib.Path
objects if multipath=True
was passed. Ideally, site_data_dir
would return a list of strings in that case, too (as suggested by @RonnyPfannschmidt). But this wouldn't be backwards compatible, correct?
From what I can see, site_data_dir
is the only affected API here, correct?
from platformdirs.
It also would mutate the type returned based on a boolean flag which I don't like at all 😬
from platformdirs.
We could introduce the contract that path variants always return the first of the multipath.
In other words, the multipath
flag would have no effect on site_data_path
. It will simply always return the first path, which is the default for site_data_dir
if multipath
is not set.
How come that there is a binary flag for this anyway? Wouldn't it make more sense to have two new api calls: site_data_dir_list
and site_data_path_list
?
from platformdirs.
Because for dirs the return type does not change 😬 because we don't return the paths as a list are but joined by os.pathsep. obviously we can't do that for pathlib.
from platformdirs.
Because for dirs the return type does not change
That is of course correct, but their output changes semantically, i.e. as a user I have to handle multipath output differently than singlepath output. It looks to me like all the arguments of a boolean-flag trap apply here as well. Nonetheless, #27 follows your suggestion to only return the first item in case site_data_dir
is called with multipath=True
.
from platformdirs.
That is of course correct, but their output changes semantically, i.e. as a user I have to handle multipath output differently than singlepath output.
Not really, UNIX site config values always return paths joined by os.pathsep... In simple case just happens to not matter, because joining an array of length 1 is always the same as the array element.
from platformdirs.
We solved this for now by picking first for paths. str endpoints still work.
from platformdirs.
Related Issues (20)
- getuid is not Linux specific HOT 1
- Testing could fail with pytest-randomly HOT 1
- Windows support link broken HOT 2
- `user_runtime_dir` for root on Unix
- user_runtime_dir for *BSD HOT 3
- Feature: add user_downloads_dir HOT 1
- Feature: user_desktop_dir HOT 2
- Cannot import name '__version__' from 'platformdirs.version' HOT 6
- Unix user_log_dir doesn't create log dir HOT 1
- Optionally redirect `user_*_dir()` calls to `site_*_dir()` for root on Unix HOT 2
- Add `site_state_dir()` counterpart for `user_state_dir()` HOT 1
- Add `site_log_dir()` counterpart for `user_log_dir()`
- pre-commit updates of pyproject.toml:[build-system]:requires HOT 3
- Support Homebrew prefixes
- HOME and StartMenu? HOT 1
- Missing changelog for 4.0 HOT 3
- Feature Request: Be able to create directories HOT 1
- multipath cannot work for path HOT 5
- Adding to stdlib/pathlib? HOT 13
- Paths can be overridden using environment variables on Linux, but not MacOS? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from platformdirs.