# Command to extract dependencies from a Python project?

**URL:** <https://discuss.python.org/t/command-to-extract-dependencies-from-a-python-project/86428>\
**Category:** Python Help\
**Tags:** packaging-help\
**Created:** [March 29, 2025, 5:45pm UTC](https://discuss.python.org/t/command-to-extract-dependencies-from-a-python-project/86428 "2025-03-29T17:45:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yurivict](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/yurivict/32/19019_2.png) [@yurivict](https://discuss.python.org/u/yurivict)\
**Post date:** [March 29, 2025, 5:45pm UTC](https://discuss.python.org/t/command-to-extract-dependencies-from-a-python-project/86428/1 "2025-03-29T17:45:38Z")

</div>

Given a PEP517 project, are there a commands that can extract build-time and run-time dependencies in a uniform way?

Same question for setup.py based projects.

---

<div class="post-metadata">

**Author:** ![sinoroc](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sinoroc/32/1607_2.png) [@sinoroc](https://discuss.python.org/u/sinoroc)\
**Post date:** [March 29, 2025, 6:11pm UTC](https://discuss.python.org/t/command-to-extract-dependencies-from-a-python-project/86428/2 "2025-03-29T18:11:08Z")

</div>

For runtime dependencies:

> <https://stackoverflow.com/questions/71271825/how-to-get-setup-cfg-metadata-at-the-command-line-python/71276197#71276197>

For built-time dependencies, I guess maybe this one:

> **[API Documentation - build 1.2.2.post1](https://build.pypa.io/en/stable/api.html#build.ProjectBuilder.get_requires_for_build)**

---

<div class="post-metadata">

**Author:** ![MegaIng](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/megaing/32/16162_2.png) [@MegaIng](https://discuss.python.org/u/MegaIng)\
**Post date:** [March 29, 2025, 6:13pm UTC](https://discuss.python.org/t/command-to-extract-dependencies-from-a-python-project/86428/3 "2025-03-29T18:13:59Z")

</div>

AFAIK, for runtime dependencies the only way is to build the project and then read out the wheel file. Dependencies can be platform dependent and/or dynamically generated.

For build dependencies you just need to read one key - this is a short python script you could write. You could also use tomlq/tq: [GitHub - cryptaliagy/tomlq: A tool for getting data from TOML files on the command line](https://github.com/cryptaliagy/tomlq)
