dataflow-core 2.0.5__tar.gz → 2.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dataflow-core might be problematic. Click here for more details.

Files changed (29) hide show
  1. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/PKG-INFO +1 -1
  2. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/dataflow.py +43 -4
  3. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow_core.egg-info/PKG-INFO +1 -1
  4. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/setup.py +5 -3
  5. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/README.md +0 -0
  6. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/__init__.py +0 -0
  7. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/dataflowairflowauthenticator.py +0 -0
  8. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/dataflowhubauthenticator.py +0 -0
  9. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/dataflowsupersetauthenticator.py +0 -0
  10. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/package/__init__.py +0 -0
  11. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/package/configuration.py +0 -0
  12. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/package/models/__init__.py +0 -0
  13. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/package/models/database.py +0 -0
  14. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/package/models/session.py +0 -0
  15. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/authenticator/package/models/user.py +0 -0
  16. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/__init__.py +0 -0
  17. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/configuration.py +0 -0
  18. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/models/__init__.py +0 -0
  19. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/models/database.py +0 -0
  20. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/models/session.py +0 -0
  21. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/models/user.py +0 -0
  22. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/utils/__init__.py +0 -0
  23. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow/utils/aws_secrets_manager.py +0 -0
  24. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow_core.egg-info/SOURCES.txt +0 -0
  25. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow_core.egg-info/dependency_links.txt +0 -0
  26. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow_core.egg-info/entry_points.txt +0 -0
  27. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow_core.egg-info/requires.txt +0 -0
  28. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/dataflow_core.egg-info/top_level.txt +0 -0
  29. {dataflow-core-2.0.5 → dataflow-core-2.0.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: dataflow-core
3
- Version: 2.0.5
3
+ Version: 2.0.6
4
4
  Summary: Dataflow core package
5
5
  Home-page: UNKNOWN
6
6
  Author: Dataflow
@@ -2,21 +2,21 @@ import os, requests
2
2
  from .models.database import DatabaseManager
3
3
  from sqlalchemy.inspection import inspect
4
4
  from .utils.aws_secrets_manager import SecretsManagerClient
5
- import json
5
+ import json, asyncio, pkg_resources
6
6
  from authenticator.package.configuration import ConfigurationManager
7
7
 
8
8
 
9
9
  class Dataflow:
10
10
  def __init__(self):
11
- self.dataflow_config = ConfigurationManager('/dataflow/app/auth_config/dataflow_auth.cfg')
12
- self.auth_api = self.dataflow_config.get_config_value('auth', 'ui_auth_api')
13
11
  self.secrets_manager = SecretsManagerClient('us-east-1')
14
12
 
15
13
  def auth(self, session_id: str):
16
14
  """Retrieve user information from the auth API."""
17
15
  try:
16
+ dataflow_config = ConfigurationManager('/dataflow/app/auth_config/dataflow_auth.cfg')
17
+ auth_api = dataflow_config.get_config_value('auth', 'ui_auth_api')
18
18
  response = requests.get(
19
- self.auth_api,
19
+ auth_api,
20
20
  cookies={"dataflow_session": session_id, "jupyterhub-hub-login": ""}
21
21
  )
22
22
 
@@ -86,3 +86,42 @@ class Dataflow:
86
86
 
87
87
  except Exception as e:
88
88
  return None
89
+
90
+ async def create_env(self, env_name, py_version, py_requirements, status, env_version=None):
91
+ """
92
+ Creates a conda environment at the specified path and installs libraries in one command.
93
+ """
94
+ config = ConfigurationManager('/dataflow/app/config/dataflow.cfg')
95
+ status = status.lower()
96
+ if status == "published":
97
+ env_base_path = config.get_config_value('paths', 'published_env_path')
98
+ conda_env_path = os.path.join(env_base_path, env_name)
99
+ else:
100
+ env_base_path = config.get_config_value('paths', 'drafts_env_path')
101
+ conda_env_path = os.path.join(env_base_path, env_name, f"{env_name}_v{env_version}")
102
+ try:
103
+ if not os.path.exists(conda_env_path):
104
+ os.makedirs(conda_env_path, exist_ok=True)
105
+
106
+ py_requirements = ",".join(py_requirements)
107
+
108
+ script_path = pkg_resources.resource_filename('dataflow', 'scripts/create_environment.sh')
109
+
110
+ # Make the script executable
111
+ os.chmod(script_path, 0o755)
112
+
113
+ # Prepare command with arguments
114
+ command = ["bash", script_path, py_requirements, conda_env_path, py_version]
115
+
116
+ process = await asyncio.create_subprocess_exec(
117
+ *command,
118
+ stdout=asyncio.subprocess.PIPE,
119
+ stderr=asyncio.subprocess.PIPE
120
+ )
121
+
122
+ return process
123
+ except OSError as e:
124
+ print(f"OS error while creating {conda_env_path}: {e}")
125
+ except Exception as e:
126
+ print(f"Unexpected error while creating {conda_env_path}: {e}")
127
+ return {"error": str(e)}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: dataflow-core
3
- Version: 2.0.5
3
+ Version: 2.0.6
4
4
  Summary: Dataflow core package
5
5
  Home-page: UNKNOWN
6
6
  Author: Dataflow
@@ -2,10 +2,12 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="dataflow-core",
5
- version="2.0.5",
6
- packages=find_packages(exclude=["tests", "tests.*"]),
5
+ version="2.0.6",
6
+ packages=find_packages(include=["dataflow", "dataflow.*", "authenticator", "authenticator.*"]),
7
7
  include_package_data=True,
8
- package_data={},
8
+ package_data={
9
+ "dataflow": ["scripts/*.sh"],
10
+ },
9
11
  install_requires=[
10
12
  'sqlalchemy',
11
13
  'boto3',
File without changes
File without changes