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

Reorganize Python deps and use pip-compile #7874

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Commits on Dec 7, 2023

  1. Reorganize Python deps and use pip-compile

    This change is to simplify our Python dependency specifications and to use [pip-tools](https://pypi.org/project/pip-tools/#description)'s `pip-compile` to generate hashed requirements files with the full dependency tree from input files. This also performs dependency resolution and will highlight any conflicting versions. The model for this is that of [Mozilla's Bedrock project, the Django project that serves mozilla.org](https://github.com/mozilla/bedrock).
    
    The new file structure is as follows:
    
    - `deployment.in`: requirements for deployment to production and other servers
    - `test.in`: requirements for executing Python tests locally or in CI
    - `dev.in`: requirements for development work, running, and testing
    - `docs.txt`: requirements to build the consumerfinance.gov docs.
    - `scripts.txt`: Requirements for running certain jobs on Jenkins, so scripts can run in Jenkins without having to install all the other requirements.
    
    The contents of `base.txt`, `django.txt`, `wagtail.txt`, and `libraries.txt` move into `deployment.in`, which contains the minimum necessary to run consumerfinance.gov. `test.in` includes tools like `coverage`, `diff_cover`, and `tox` that are required to run our Python tests. `docs.in` and `scripts.in` are relatively unchanged, and `dev.in` combines all of the above to construct a local environment.
    
    These relationships between files now look like this:
    
    ```mermaid
    flowchart TD
        deployment.in
        test.in
        dev.in
        docs.in
        scripts.in
    
        deployment.in --> dev.in
        test.in --> dev.in
        scripts.in --> dev.in
    ```
    
    Where previously they looked like this:
    
    ```mermaid
    flowchart TD
        ci.txt
        docs.txt
    
        base.txt
        deployment.txt
        django.txt
        libraries.txt
        local.txt
        wagtail.txt
    
        scripts.txt
        test.txt
    
        django.txt --> base.txt
        wagtail.txt --> base.txt
        libraries.txt --> base.txt
    
        base.txt --> deployment.txt
    
        base.txt --> local.txt
    ```
    willbarton committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    2d12a61 View commit details
    Browse the repository at this point in the history
  2. Pin linting tools

    willbarton committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    98ad35c View commit details
    Browse the repository at this point in the history
  3. Fix tox for 4+

    Update tox more
    willbarton committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    ab76177 View commit details
    Browse the repository at this point in the history
  4. Add tox env to validate requirements

    This will check that our requirements are appropriately compiled.
    willbarton committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    74f17f2 View commit details
    Browse the repository at this point in the history
  5. Minor code review updates

    willbarton committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    10cfd72 View commit details
    Browse the repository at this point in the history
  6. Update New Relic docs

    This change updates our New Relic docs to remove information that is no longer valid.
    
    It's not clear to me that this entire section is particularly useful to document here though.
    willbarton committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    37cfa45 View commit details
    Browse the repository at this point in the history