Analyzing stock has never been easier.
Project description
finlab
Analyzing stock has never been easier.
Encryption
Prerequirements
pip install --upgrade google-cloud-storage
export GOOGLE_APPLICATION_CREDENTIALS=path_of_the_credentials
Create an encrypted module
- name the module as
yourModule_encrypted.py
in any package - run the following script
python encryption.py generate packageA packageB ...
It will automatically generate yourModule.py
, so that the user can import it seamlessly.
Notes
When importing the *_encrypted.py
from other py files (self dependencies), the following rules should be followed, otherwise the production version may throw errors.
- Use
import package.moduleName
instead ofimport package.moduleName_encrypted
- Avoid using
from package.moduleName import some_function
, use
instead.import package.moduleName as m m.some_function
- Avoid using relative import in
moduleName_encryption.py
.
Upload encrypted modules
run the following script
python encryption.py upload packageA packageB ...
A folder encrypted_py_file
will be created.
The folder contains all files with the postfix *_encrypted.py
of packages.
Inside the folder, the sourcedefender module is called to encrypt *_encrypted.py
-> *_encrypted.pye
Finally, all files *_encrypted.pye
are uploaded to cloud storage.
Scope of encrypted modules
When the user imports an encrypted module, the system loads the module in the following order:
- local version
*_encrypted.py
- online version
packageName__encrypted.pye
if user is VIP - a shallow module that has functions that throw errors. A developer with the source code default to importing the local module. However, an online test is still necessary.
Testing the online encrypted version of the module
To test the online version, a developer can use the following commands to hide or show the *_encrypted.py
:
python encryption.py hide packageA packageB ...
python encryption.py show packageA packageB ...
When *_encrypted.py
is hidden, an online version of the file is automatically loaded.
When hiding a file such as yourFile_encrypted.py
, the file will be renamed to ".yourFile_encrypted.py", so you can still find it with the command ls --all
.
How to update the official package:
- change the version of setup.py and finlab/init.py
- source upload.sh (with password)
test
export api_token=''
python -m unittest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for finlab-0.1.27.dev1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c11de9cdc7c3c8f847421c480391e88c7fa2d3f3a69454aa04cb86b004dbf98b |
|
MD5 | 750d20fea2fd4fa1068af4cb6c1df56f |
|
BLAKE2b-256 | e0da4f8412442b504239ed63cf0d8a9ab3d178a2e856e1461b63f1344dc4bca8 |