[feature] [2.0] Make conan use conanonical config/cache/etc files.
See original GitHub issue- Iβve read the CONTRIBUTING guide.
Tl;dr
What Iβm suggesting
Stop using HOME/.conan for everything and instead use the canonical folders. So on linux settings.yml would go in HOME/.config/conan since itβs configuration and the data folder would go in HOME/.cache/conan since it can easily be regenerated.
The python project appdirs gives an easy way to find the right folders for everything in a cross platform way.
Why is this important
- People who know the OS will understand what each folder/file does better.
- The OS and other tools will be able to better handle Conan
- Sysadmins will be able to better handle Conan
- Making backups will be more straight forward
- Its cool to do things the Right Way
Potential problems
- People who donβt know there OSs customs might find this more confusing difficult.
- Even if a user knows the OS customs they might be confused for a while about the change.
- Conan shouldnβt use global folders like /usr/local/share if Conan was installed locally. I donβt think appdirs can detect a local installation though.
- Conan can automatically migrate all the files it knows about but if the user put their own files into .conan then Conan doesnβt know whether those are config, cache, data etc. In those cases the migration will have to be finished by the user by hand.
Longer form
What Iβm suggesting
Currently in Linux Conan has folder called .conan directly under the home folder. This is the old school linux way of doing things. Nowadays linux encourages the the use of .config, .cache and other such folders. This keeps the home folders clean and adds semantic information to the config files.
The .config is where configuration needs to stay. So when Iβm backing up my computer I know I need to backup .config. Neovim uses the .config to store the vimrc, for example. The .cache folder is for stuff that can be regenerated. When my computers getting low on storage I can nuke .cache without worry. Pip uses .cache folder to cache wheels and other packages it pulls from PyPi and pypoetry uses it for virtual environments.
Conans folder structure looks like this right now.
HOME
βββ .conan
βββ artifacts.properties
βββ cacert.pem
βββ conan.conf
βββ data
β βββ <pkg name>
β β βββ <version>
β βββ <other pkg>
β βββ <version>
βββ hooks
β βββ attribute_checker.py
βββ profiles
β βββ default
βββ remotes.json
βββ settings.yml
βββ version.txt
On linux it should probably look something like this
HOME
βββ .config
β βββ conan
β βββ artifacts.properties
β βββ cacert.pem
β βββ conan.conf
β βββ hooks
β β βββ attribute_checker.py
β βββ profiles
β β βββ default
β βββ remotes.json
β βββ settings.yml
β βββ version.txt
βββ .cache
βββ conan
βββ data
βββ <pkg name>
β βββ <version>
βββ <other pkg>
βββ <version>
On windows thereβs the AppData and I donβt even know what Mac uses. Luckily thereβs a handy python library called appdirs the takes care of finding the OS specific locations.
I havenβt dug into the conan source code but I feeling that this change would touch many files but each individual change will likely be pretty straight forward (if itβs put into Conan 2.0 as a breaking change).
Why this helps
When I was trying to understand Conan a lot of things were mysterious to me. It took me a good couple hours before I realized I could just delete the data folder without consequence. Using the canonical folders is in some ways another form of documentation. When something is in .config it tells the user βthis is per user configuration, if you need to configure conan for your user the files to do so are in here somewhereβ. When I see that I have a .conan in the home directory I am told βall the data for conan is here probably.β
Tools and people trust this configuration for system administration, backups, etc. My backup scripts go into .config and backup the folders of all the programs I care about. I donβt know whatβs in there or how it works half the time but I know itβs configuration. My script ignores everything in .cache because I know it can all be regenerated and I want my backups slim. Every time a program drops their stuff in the home directory I have to actually learn about the program, folder by folder, and in some cases file by file, and decide whatβs important to keep (*cough* firefox *cough*). Using the standard system administration easier.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
@memsharded Thank you for taking the time to respond to this in full. I appreciate it a lot.
A couple of notes about this:
<userhome>/.conan
in all platforms. This can also simplify CI scripts of users dealing with multiple platforms.While I understand the Linux specific layout could have advantages, the fact is that other OS doesnβt have such strong convention, and that results that in practice a ton of tools do not follow that convention, as well described in https://twitter.com/codeinred/status/1445275055626199040?s=20. At the moment I tend to think (as always, it is a trade off) that even if slightly more convenient for Linux users, it would be overall better to keep it because of the above reasons.