How do I protect my Python codebase so that guests can't see certain modules but so it still works?

后端 未结 3 1499
情深已故
情深已故 2021-01-03 09:09

We\'re starting a new project in Python with a few proprietary algorithms and sensitive bits of logic that we\'d like to keep private. We also will have a few outsiders (sel

3条回答
  •  无人及你
    2021-01-03 10:08

    Here's an alternate solution I noticed when reading the docs for Flask:

    flaskext/__init__.py

    The only purpose of this file is to mark the package as namespace package. This is required so that multiple modules from different PyPI packages can reside in the same Python package:

    __import__('pkg_resources').declare_namespace(__name__)
    

    If you want to know exactly what is happening there, checkout the distribute or setuptools docs which explain how this works.

提交回复
热议问题