Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Folder specific custom commands #16023

Closed
1 task done
JeremyBorys opened this issue Apr 4, 2024 · 5 comments
Closed
1 task done

[feature] Folder specific custom commands #16023

JeremyBorys opened this issue Apr 4, 2024 · 5 comments
Assignees

Comments

@JeremyBorys
Copy link

JeremyBorys commented Apr 4, 2024

What is your suggestion?

Hi!

As a developer who works on many different projects,
I would like for conan custom commands to be able to automatically pickup custom commands created for a specific project/folder
so that I don't need to continually install custom commands or change the conan_home folder.

Right now what I am doing is creating a .conanrc file and redirecting the conan_home folder to a directory within my project root. I don't want to do that anymore as it is awkward.

For example what I would like is something along the lines of:

/<project_root>/extensions/commands (context aware commands)
~/.conan2/extensions/commands (cross folder user commands)

In the above structure I would like commands from both the (context aware) and the (cross folder user commands) to be available for use.

I don't know if this functionality already exists, but scouring the source code, docs, and list of issues, I didn't find any results.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded memsharded self-assigned this Apr 4, 2024
@memsharded
Copy link
Member

Hi @JeremyBorys

Thanks for your suggestion.

While we have considered this in the past, we haven't decided to move this idea forward yet.

The problem is not the custom commands, those are relatively easy to aggregate. The problem is many of the other information, that users might expect some kind of "merging" behavior:

  • remotes
  • custom settings.yml (and settings_user.yml)
  • global.conf
  • The packages themselves
  • all plugins
  • credentials (both source and conan remotes credentials)

Specially the packages storage could be very problematic. The cache depends on the Conan version, and the package storage DB is migrated (mainly forward, but also backwards sometimes). Making the package storage multi-level would be a very major feature, bringing a lot of complexity.

This is the reason why the .conanrc only allows defining the CONAN_HOME. It might be possible in the home redirect in global.conf the storage_path to a common storage for all different projects to save space and time, if the rest of the configuration is compatible.

I don't want to do that anymore as it is awkward.

If more functionality is added to support more local configuration, like local commands, it will still use this, or a very similar mechanism. It is not possible to use a <project_root>/extensions folder, because extensions folder might already exist in user projects. Also the project_root is not always evident or explicit, not necessarily where the conanfile.py is, as there are users with different layouts and putting conanfile in different subfolders.

Why would it be awkward? That is a valid mechanism to define this kind of information and behavior, and there are other tools using similar approaches.

@JeremyBorys
Copy link
Author

JeremyBorys commented Apr 4, 2024

Thanks for the response @memsharded,

To expand on what I find awkward, it is repeated synchronization and typing of conan config install <...> to install all of my custom commands between global conan home directory ~/.conan2 and the project / folder that has redirected conan_home via a .conanrc.

If more functionality is added to support more local configuration, like local commands, it will still use this, or a very similar mechanism.

This is exactly what I am was looking and hoping for :) and I have zero issues with this approach

While we have considered this in the past, we haven't decided to move this idea forward yet.

Thanks, knowing that something like this is on your radar is comforting.

@memsharded
Copy link
Member

To expand on what I find awkward, it is repeated synchronization and typing of conan config install <...>

Regarding this, maybe it is worth checking the new conan config install-pkg functionality in Conan 2.2, it will still be necessary, but at least using a package reference instead of a url is easier to remember, easier to type and easier to update using version ranges like conan config install-pkg "myconf/[*]" will update to the latest conf. Not what you are looking for but maybe a small UX improvement in the meantime

@JeremyBorys
Copy link
Author

Yes that's interesting and I will keep it in the back of my mind. I can play with it to see if it helps.

Anyhow if I understood the thread correctly it sounds like the feature I have requested has been considered in the past and it might be done at some point in the future. With that in mind I don't think there is a need to keep this issue open any longer and I hope this can be a somewhat useful reference in the future.

Take care!

@memsharded
Copy link
Member

Great. I am adding an entry in the #15992 ticket, which is the one we will be using to centralize efforts in the new workspaces for Conan 2, please track that issue for progress, I am closing this one. Thanks very much for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants