0

I have a python project for which I want to create:

  • requirements.txt -> with the modules needed for running the code but not the tests.
  • requirements_dev.txt -> with just the extra modules needed for the tests.

I will reuse those in the install_requires and extras_require fields of the setup.py.

If I do a pip freeze > requirements.txt, the whole thing goes into that file. How can I separate between test vs no test?

Javi Torre
  • 724
  • 8
  • 23
  • 1
    Does this answer your question? [How to customize a requirements.txt for multiple environments?](https://stackoverflow.com/questions/17803829/how-to-customize-a-requirements-txt-for-multiple-environments) – maximilionus Feb 01 '23 at 14:24
  • Is the question specifically about **how to determine** the requirements for the test environment? That's trivial: since the test environment conceptually **is a different environment**, simply *create a separate virtual environment for it*, configure it so that it makes the tests run, and freeze. – Karl Knechtel Feb 01 '23 at 14:34
  • 1
    You can't automatically. However, you should look to `poetry` to manage better dependencies and groups. – Corralien Feb 01 '23 at 14:36

0 Answers0