Skip to content

Conversation

@franramirez688
Copy link
Contributor

@franramirez688 franramirez688 commented Jan 12, 2026

Changelog: Feature: Add conan require command to add/remove requirements to/from your local conanfile.
Docs: conan-io/docs#4354

$ conan require add -h
usage: conan dep add [-h] [--out-file OUT_FILE] [-v [{quiet,error,warning,notice,status,verbose,debug,v,trace,vv}]] [-cc CORE_CONF] [-req REQUIRES] [-tor TOOL_REQUIRES] [-ter TEST_REQUIRES] [-r REMOTE | -nr] [path]

Add a new requirement to your local conanfile as a version range. By default, it will look for the requirement versions remotely.

positional arguments:
  path                  Path to a folder containing a recipe (conanfile.py). Defaults to the current directory

options:
  -h, --help            show this help message and exit
  --out-file OUT_FILE   Write the output of the command to the specified file instead of stdout.
  -v [{quiet,error,warning,notice,status,verbose,debug,v,trace,vv}]
                        Level of detail of the output. Valid options from less verbose to more verbose: -vquiet, -verror, -vwarning, -vnotice, -vstatus, -v or -vverbose, -vv or -vdebug, -vvv or -vtrace
  -cc, --core-conf CORE_CONF
                        Define core configuration, overwriting global.conf values. E.g.: -cc core:non_interactive=True
  -req, --requires REQUIRES
                        Requirement name.
  -tor, --tool-requires TOOL_REQUIRES
                        Tool requirement name.
  -ter, --test-requires TEST_REQUIRES
                        Test requirement name.
  -r, --remote REMOTE   Remote names. Accepts wildcards ('*' means all the remotes available)
  -nr, --no-remote      Do not use remote, resolve exclusively in the cache
$ conan require remove -h
usage: conan dep remove [-h] [--out-file OUT_FILE] [-v [{quiet,error,warning,notice,status,verbose,debug,v,trace,vv}]] [-cc CORE_CONF] [-req REQUIRES] [-tor TOOL_REQUIRES] [-ter TEST_REQUIRES] [path]

Removes a requirement from your local conanfile.

positional arguments:
  path                  Path to a folder containing a recipe (conanfile.py). Defaults to the current directory

options:
  -h, --help            show this help message and exit
  --out-file OUT_FILE   Write the output of the command to the specified file instead of stdout.
  -v [{quiet,error,warning,notice,status,verbose,debug,v,trace,vv}]
                        Level of detail of the output. Valid options from less verbose to more verbose: -vquiet, -verror, -vwarning, -vnotice, -vstatus, -v or -vverbose, -vv or -vdebug, -vvv or -vtrace
  -cc, --core-conf CORE_CONF
                        Define core configuration, overwriting global.conf values. E.g.: -cc core:non_interactive=True
  -req, --requires REQUIRES
                        Requirement name.
  -tor, --tool-requires TOOL_REQUIRES
                        Tool requirement name.
  -ter, --test-requires TEST_REQUIRES
                        Test requirement name.

@franramirez688
Copy link
Contributor Author

franramirez688 commented Jan 12, 2026

Pending issues/discussions:

  • conan init: Jinja form? Allow more parameters as requirements?
  • conan dep:
    • Only works with .py, but should it work with .txt too?
    • No API created for now.
    • Command name is fine?

@memsharded
Copy link
Member

conan init: Jinja form? Allow more parameters as requirements?

This will be a given if using conan new existing command instead with a template just with the conanfile.py.

Only works with .py, but should it work with .txt too?

No, better only .py

@franramirez688 franramirez688 changed the title [commands] New conan dep and init [commands] New conan dep Jan 13, 2026
@franramirez688 franramirez688 marked this pull request as ready for review January 13, 2026 16:36
Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good

@franramirez688
Copy link
Contributor Author

@czoido @memsharded I'll open another PR with the full conan new changes. I did not want to make any further changes to this one.

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good to me.

Maybe my only issue is that conan dep as a command still doesn't fully click. It is a bit different to other commands that are more verb-like conan create/install/export/inspect/list..., the closest one would be conan editable add/remove and conan remote add/remove.

I can't think of a better name though, so all good for me.

@franramirez688 franramirez688 changed the title [commands] New conan dep [commands] New conan require Jan 21, 2026
@czoido czoido merged commit 72be546 into conan-io:develop2 Jan 22, 2026
16 checks passed
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

Successfully merging this pull request may close these issues.

4 participants