Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkPipPackageInfo.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkPipPackageInfo_h
14 #define mitkPipPackageInfo_h
15 
17 
18 #include <nlohmann/json_fwd.hpp>
19 
20 #include <string>
21 #include <vector>
22 
23 namespace mitk
24 {
26  enum class PackageStatus
27  {
28  Pending,
29  Installing,
30  Installed,
31  Failed
32  };
33 
36  {
37  std::string name;
38  std::string version;
39  std::string specifier;
41  bool requested = false;
42  int group = 0;
43  };
44 
60  {
61  PipInstallGroup() = default;
62 
63  PipInstallGroup(std::initializer_list<std::string> requirements);
64 
65  std::vector<std::string> requirements;
66  std::string indexUrl;
67  std::vector<std::string> extraPipArgs;
68  };
69 
89  {
90  std::string displayName;
91  std::string pythonCode;
92  bool optional = false;
93  };
94 
102  {
103  std::string name;
104  std::string venvName;
105  std::vector<PipInstallGroup> groups;
106  bool upgradePipFirst = true;
107  std::vector<PostInstallStep> postInstallSteps;
115  static PipInstallSpec FromFile(const std::string& path);
116 
123  static PipInstallSpec FromResource(const std::string& resourcePath);
124 
130  void SaveToFile(const std::string& path) const;
131  };
132 
133  MITKPYTHONINSTALLER_EXPORT void from_json(const nlohmann::ordered_json& j, PipInstallGroup& g);
134  MITKPYTHONINSTALLER_EXPORT void to_json(nlohmann::ordered_json& j, const PipInstallGroup& g);
135 
136  MITKPYTHONINSTALLER_EXPORT void from_json(const nlohmann::ordered_json& j, PostInstallStep& s);
137  MITKPYTHONINSTALLER_EXPORT void to_json(nlohmann::ordered_json& j, const PostInstallStep& s);
138 
139  MITKPYTHONINSTALLER_EXPORT void from_json(const nlohmann::ordered_json& j, PipInstallSpec& s);
140  MITKPYTHONINSTALLER_EXPORT void to_json(nlohmann::ordered_json& j, const PipInstallSpec& s);
141 }
142 
143 #endif
#define MITKPYTHONINSTALLER_EXPORT
Find image slices visible on a given plane.
void from_json(const nlohmann::json &, GenericLookupTable< T > &)
Deserialize a GenericLookupTable from JSON.
PackageStatus
Status of a single package during installation.
void to_json(nlohmann::json &j, const GenericLookupTable< T > &t)
Serialize a GenericLookupTable to JSON.
A set of packages that share the same pip options.
PipInstallGroup(std::initializer_list< std::string > requirements)
std::vector< std::string > extraPipArgs
std::vector< std::string > requirements
Full specification for a pip installation run.
std::vector< PostInstallStep > postInstallSteps
std::vector< PipInstallGroup > groups
static PipInstallSpec FromResource(const std::string &resourcePath)
Load a PipInstallSpec from a Qt resource path.
void SaveToFile(const std::string &path) const
Save this PipInstallSpec to a JSON file.
static PipInstallSpec FromFile(const std::string &path)
Load a PipInstallSpec from a JSON file.
Describes a single resolved pip package.
A Python command to run in the activated venv after pip install.