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)

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

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

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

finlab-0.1.27.dev1-py3-none-any.whl (53.7 kB view details)

Uploaded Python 3

File details

Details for the file finlab-0.1.27.dev1-py3-none-any.whl.

File metadata

  • Download URL: finlab-0.1.27.dev1-py3-none-any.whl
  • Upload date:
  • Size: 53.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.9

File hashes

Hashes for finlab-0.1.27.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 c11de9cdc7c3c8f847421c480391e88c7fa2d3f3a69454aa04cb86b004dbf98b
MD5 750d20fea2fd4fa1068af4cb6c1df56f
BLAKE2b-256 e0da4f8412442b504239ed63cf0d8a9ab3d178a2e856e1461b63f1344dc4bca8

See more details on using hashes here.

Supported by

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