Skip to main content

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

  1. name the module as yourModule_encrypted.py in any package
  2. 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.

  1. Use import package.moduleName instead of import package.moduleName_encrypted
  2. Avoid using from package.moduleName import some_function, use
    import package.moduleName as m
    m.some_function
    
    instead.
  3. 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:

  1. local version *_encrypted.py
  2. online version packageName__encrypted.pye if user is VIP
  3. 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:

  1. change the version of setup.py and finlab/init.py
  2. source upload.sh (with password)

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

finlab-0.1.22.dev1-py3-none-any.whl (52.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page