madhup / libify Goto Github PK
View Code? Open in Web Editor NEWImport Databricks notebooks as libraries/modules
License: MIT License
Import Databricks notebooks as libraries/modules
License: MIT License
Hi Team,
I am facing a parse exception on libify.importer(globals(), config={}. In config I am passing key and file path through a json. See below screen shot:
I also tried to pass the key and file in this way (libify.importer(globals(), config={"key"= "afdasdfsadfsf" , "file" : "/abc/abc"}))
Can someone please help me here to understand the issue and its resolution?
Thanks,
Code that I run:
!pip install libify
import libify
io = libify.importer(globals(), '/Users/[email protected]/src/input_output/test_notebook')
function = io.cast_days()
AttributeError Traceback (most recent call last)
in
----> 1 function = io.cast_days()
AttributeError: module 'libified_' has no attribute 'cast_days
Code in the notebook:
import pandas as pd
import libify
def cast_days(days):
if not isinstance(days, pd.DatetimeIndex):
return pd.DatetimeIndex(list(days))
return days
libify.exporter(globals())
Hey,
Thanks a lot for the lib, very useful! :) There is however one annoying issue with it at the moment.
Whenever we have the need to use a function that we import using libify within a dataframe foreach/foreachPartition we receive these errors:
ModuleNotFoundError: No module named 'libified_'
or
Can't pickle <class 'libified_.BW'>: it's not found as libified_.BW
My use-case is the following. I want to create a database connection for each partition to do some sort of batch export from a spark dataframe using https://github.com/SAP/PyHDB
If I create directly a pyhdb connection using pyhdb.connect(...)
within my foreachPartition it works fine but if I am using a library that I imported with libify that would do a
def get_connection():
return pyhdb.connect(...)
it does not work with the errors mentioned above
Currently it doesn't seem possible to access the json output of libify.exporter(globals()). The only way to do so is by copying it from the console. Is there a work-around?
Hi,
this is more of a question than a bug report. I just implement the lib to organize code for my somewhat complex databricks project. However, I am experiencing significant drops in loading speeds when compared to standard %run './utils'
, that is from seconds to minutes.
Is there something I could do to improve the loading speed?
Also, how do you debug such a code without reporting the actual error messages in the importing notebook?
Thanks.
Br,
MF
setup.py
in this package seems to have no install_requires
. This causes error "ModuleNotFoundError: No module named 'cryptography'" when importing libify because pip doesn't know dependencies of the package.
v0.78
$ pip install libify
Collecting libify
Downloading libify-0.78-py3-none-any.whl (4.3 kB)
Installing collected packages: libify
Successfully installed libify-0.78
$ python -c "import libify"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/.../python3.8/site-packages/libify/__init__.py", line 3, in <module>
from cryptography.fernet import Fernet
ModuleNotFoundError: No module named 'cryptography'
By writing dependencies in setup.py
, pip should find information for the dependencies correctly.
--- a/setup.py
+++ b/setup.py
@@ -20,4 +20,7 @@ setup(name='libify',
'Operating System :: OS Independent',
],
python_requires='>=3.5',
+ install_requires=[
+ 'cryptography>=37.0.2',
+ ],
zip_safe=False)```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.