dataflow-conda-plugin 0.1.0__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-conda-plugin might be problematic. Click here for more details.

@@ -0,0 +1,3 @@
1
+ Metadata-Version: 2.4
2
+ Name: dataflow-conda-plugin
3
+ Version: 0.1.0
@@ -0,0 +1,2 @@
1
+ # dataflow-conda-plugin
2
+ Conda plugin which install dataflow dependencies in every newly created conda environment.
@@ -0,0 +1,3 @@
1
+ Metadata-Version: 2.4
2
+ Name: dataflow-conda-plugin
3
+ Version: 0.1.0
@@ -0,0 +1,10 @@
1
+ README.md
2
+ setup.py
3
+ dataflow_conda_plugin.egg-info/PKG-INFO
4
+ dataflow_conda_plugin.egg-info/SOURCES.txt
5
+ dataflow_conda_plugin.egg-info/dependency_links.txt
6
+ dataflow_conda_plugin.egg-info/entry_points.txt
7
+ dataflow_conda_plugin.egg-info/top_level.txt
8
+ plugin/__init__.py
9
+ plugin/plugin.py
10
+ plugin/scripts/install_dataflow_deps.sh
@@ -0,0 +1,2 @@
1
+ [conda]
2
+ dataflow-conda-plugin = plugin.plugin
File without changes
@@ -0,0 +1,42 @@
1
+ import subprocess, sys, pkg_resources, os
2
+ from conda import plugins
3
+ from conda.base.context import context
4
+
5
+ def install_deps(command: str):
6
+ """Install dataflow dependencies."""
7
+ target_prefix = context.target_prefix
8
+ args = context._argparse_args
9
+ try:
10
+ # if cloning, skip the install
11
+ if (args.get('clone') is not None):
12
+ return
13
+
14
+ install_dataflow_deps = pkg_resources.resource_filename('plugin', 'scripts/install_dataflow_deps.sh')
15
+ process = subprocess.Popen(
16
+ ["bash", install_dataflow_deps, target_prefix],
17
+ stdout=subprocess.PIPE,
18
+ stderr=subprocess.STDOUT,
19
+ text=True,
20
+ bufsize=1
21
+ )
22
+
23
+ for line in iter(process.stdout.readline, ''):
24
+ print(line, end='')
25
+ sys.stdout.flush()
26
+
27
+ return_code = process.wait()
28
+ if return_code != 0:
29
+ print(f"Error in creating environment!!")
30
+
31
+ except Exception as e:
32
+ print(f"An unexpected error occurred: {str(e)}")
33
+
34
+
35
+
36
+ @plugins.hookimpl
37
+ def conda_post_commands():
38
+ yield plugins.CondaPostCommand(
39
+ name=f"install_deps_post_command",
40
+ action=install_deps,
41
+ run_for={"create"},
42
+ )
@@ -0,0 +1,25 @@
1
+ #!/bin/bash
2
+ set -e
3
+ conda_env_path=$1
4
+
5
+ py_version=$(${conda_env_path}/bin/python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))")
6
+
7
+ ${conda_env_path}/bin/pip install dash dash-renderer plotly flask flask-appbuilder typing jupyterhub oauthenticator jupyter-server-proxy jupyter streamlit ipython ipykernel ipython-sql jupysql psycopg2-binary dataflow-core dataflow-dbt
8
+
9
+ # 3. Install Dataflow Airflow to a separate path in environment
10
+ ${conda_env_path}/bin/pip install \
11
+ --force-reinstall --root-user-action ignore \
12
+ --no-warn-conflicts dataflow-airflow==2.10.5 \
13
+ --target ${conda_env_path}/bin/airflow-libraries/
14
+
15
+ files=(
16
+ ${conda_env_path}/lib/python${py_version}/site-packages/dbt/config/profile.py
17
+ ${conda_env_path}/lib/python${py_version}/site-packages/dbt/task/debug.py
18
+ )
19
+ for file in ${files[@]}
20
+ do
21
+ awk '{gsub("from dbt.clients.yaml_helper import load_yaml_text", "from dbt.dataflow_config.secrets_manager import load_yaml_text"); print}' $file > temp
22
+ mv temp $file
23
+ done
24
+
25
+ echo "Environment Creation Successful"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,24 @@
1
+ from setuptools import setup, find_packages
2
+ from setuptools.command.install import install
3
+ import os
4
+
5
+ class PostInstall(install):
6
+ """Post-installation script to set executable permissions for scripts."""
7
+ def run(self):
8
+ install.run(self)
9
+ install_dir = os.path.join(self.install_lib, 'plugin', 'scripts')
10
+ for filename in os.listdir(install_dir):
11
+ if filename.endswith('.sh'):
12
+ filepath = os.path.join(install_dir, filename)
13
+ os.chmod(filepath, 0o755)
14
+
15
+ setup(
16
+ name="dataflow-conda-plugin",
17
+ version="0.1.0",
18
+ entry_points={"conda": ["dataflow-conda-plugin = plugin.plugin"]},
19
+ packages=find_packages(include=["plugin"]),
20
+ package_data={'plugin': ['scripts/*.sh']},
21
+ cmdclass={
22
+ 'install': PostInstall,
23
+ },
24
+ )