Define a set of named features and logic to manage their dependencies.#480
Draft
Define a set of named features and logic to manage their dependencies.#480
Conversation
259c67a to
1c523ba
Compare
The codebase has a number of features that, when selected, require certain dependencies. Thus far the handling for this hsa been split between this repository and the docker-migrid, which encodes a large amount of version information for the various features and in addition allows overriding these at build time. There is a desire to see these become per-feature requirements files expresed in this repository, but then to also retain the ability to override the package versions at the time of build. This commit introduces work that will allow that. The features are explicitly defined by name in a ini file that describes them. The added features tool reads this file and, after consulting a source for what is enabled (this can be the environment but also a .env file, as used within the docker builds, directly) will output the lines needed to install the packages. Any complexity here stems from the requirement to be able to override certain packages. Since a requirements file can easily contain more than one package, we must be able to override one of the set of specified dependencies.
1c523ba to
6b810ce
Compare
This mode can be enabled by a command line flag which, when set, causes the dependencies for each feature to be checked for presence within the active python environment and their installation skipped if present. In practice this means the requirements files can list dependencies exhaustively but still allow the host environment arranged by a build process to provision packages in the host environment and have these respected during installation. Further, if such a package is only one of many requirements then it alone will be skipped while all other dependencies will be correctly installed.
6b810ce to
6597a2a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This work povides a way to make use of per-feature requirements files while maintaining the ability to have certain requirements overridden during build and other be met by system packages. This would make it suitable for immediate use in docker-migrid where it would replace the series of hand rolled pip install lines gated by feature checks and the package installation lines those checks contain.
Detail:
The codebase has a number of features that, when selected, require certain dependencies. Thus far the handling for this has been split between this repository and the docker-migrid, which encodes a large amount of version information for the various features and in addition allows overriding these at build time.
There is a desire to see these become per-feature requirements files expressed in this repository - that would mean the dependencies are captured alongside the code that depends upon them. However, the ability to override the versions being used and, more critically, to make use of packages provided by the distribution must remain possible.
This PR introduces work that will allow that. The features are explicitly defined by name in a static file that describes them. The added features tool reads this file and, after consulting a source for what is enabled (this can be the environment but also a .env file, as used within the docker builds, directly) will output the lines needed to install the packages.
This simple conceptual design allows us to handle package overrides and distribution packages. We maintain a list of environmental keys to be consulted for certain package versions and if present expand the packages we must install from the requirements file and make use of the an applicable override instead. In the situation of distribution packages, we perform the same requirements expansion but check whether the dependency is already met in the python environment and skip its installation if so.
Review
To anyone taking a look: not all the features are fully defined here as a way to first share the approach. The tests coves all installation cases, but when run directly the repository level notion of defined features are used. Two named features re currently defined, CLOUD and MIGUX (which likely gives you an idea of what I was working on). I would recommend comparing the output from the following commands: