How can I test my python module without installing it

后端 未结 3 2198
無奈伤痛
無奈伤痛 2021-02-13 00:56

I\'m in the process of redesigning/refactoring my Python quantum chemistry package (pyquante). One of the things I don\'t like about the existing release is that I have to insta

相关标签:
3条回答
  • 2021-02-13 01:12

    Altering sys.path much in production environment may be unwise. Altering it for testing is usually OK.

    If you don't want to tinker with the variable from sys, use an environment variable named PYTHONPATH, it's a clean and documented way.

    0 讨论(0)
  • 2021-02-13 01:16

    Create a proper package for your stuff and use

    python setup.py develop
    

    to make it a proper dev-package.

    See:

    • https://stackoverflow.com/a/19048754/548039
    • http://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode
    0 讨论(0)
  • 2021-02-13 01:24

    I would honestly insist on using virtualenv, its designed for this exact reason in mind. very small overhead, and if you ever mess up just delete directory. I am sure as you grow, things won't be as simple as they are now for your current situation. Take it as an opportunity to learn.

    0 讨论(0)
提交回复
热议问题