Skip to content

Support for operating-system-specific requirements file #384

@dhalperi

Description

@dhalperi

🚀 feature request

Relevant Rules

load("@rules_python//python:pip.bzl", "pip_install")

Description

Our company uses both macOS and Linux (Ubuntu and Docker) as development / test / production platforms.

As recommended on Bazel #python Slack, we use a requirements.in file to produce requirements.txt using pip-compile. This works great, except...

The requirements.txt compilation process can be OS dependent. For example, ipython has OS_dependent deps via ':sys_platform == "darwin"': ["appnope"],.

I can't figure out how to make requirements.txt be dependent on the operating system (platform?). There's only room for one in the WORKSPACE declaration, and select statements don't work there.

Relevant thread from Slack, from @thundergolfer:

Jonathon Belotti 6 minutes ago
Ok I understand better. Yeah, in our work codebase we enforce that Linux+OSX both have the same transitively locked requirements.txt file. It's working fine in practice.
:sys_platform == "darwin"': ["appnope"] is the one place we've hit a problem.

Describe the solution you'd like

I'm not sure what the best solution is here. Can we do something in the rule to take a mapping and resolve it that way?

Describe alternatives you've considered

The main thing that seems like it would work without a rule change is a configure script that links to requirements.txt.<platform>. Seems heavyweight though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy