Is a Scripts directory an anti-pattern in Python? If so, what's the right way to import?

后端 未结 4 1039
醉酒成梦
醉酒成梦 2021-02-19 01:31

I\'ve always created scripts directories in every project I\'ve built because they\'re useful for putting infrequently used executable scripts. In Python, I\'ll always put an

4条回答
  •  情深已故
    2021-02-19 01:43

    The link in the question only says about running scripts that reside in a package directory which is a potential problem because... well... packages are not scripts and scripts are not packages. They serve different purposes and are invoked in different ways, so if you mix them together, there'll be a mess at some point.

    Since Python itself has had a Scripts directory for ages and no one complains, it's in no way an anti-pattern.

    See How do I separate my executable files from my library files? on how we dealt with executable scripts at my last occupation. It never caused any problems that I'm aware of.

提交回复
热议问题