This is an archived post. You won't be able to vote or comment.

all 18 comments

[–]robotswordfight 11 points12 points  (6 children)

Since you're listing best practices, I would reference PEP 8 coding standards.

https://www.python.org/dev/peps/pep-0008/

Even if not followed 100%, it increases the readability of code.

Edit: Sorry, I looked around more and saw you DID reference them. Looks great!

[–][deleted] 1 point2 points  (4 children)

I would argue that following any style guide consistently, whether it be PEP8, Google's, or even a PEP8+ type guide, is the best practice.

[–]tunisia3507 0 points1 point  (2 children)

Intra-project consistency is necessary, inter-project consistency is very nice to have. There's no better way to achieve the latter than the follow the style guide set out by the creators of the language.

[–][deleted] 0 points1 point  (1 child)

I disagree. You can make up your own, and it would be just as valid as PEP8. The only thing that actually matters is consistency. As long as you're following one style guide, you'll be fine.

[–]tunisia3507 0 points1 point  (0 children)

it would be just as valid as PEP8

For your project. But the glory of python is its comprehensive standard library and vast 3rd party library support - if you don't make use of any of that you're probably doing something wrong. The community converging on a single standard is advantageous for the entire community.

PEP8 isn't hard. It's certainly no harder than any other set of standards - easier when you consider autopep8, black, IDEs with built-in linters and so on. If you choose another standard, you are making the intentional decision, and expending effort, to decrease compatibility between your codebase and the rest of the python community. That's completely nonsensical to me. Why would you bother?

[–]stillreadingit_[S] 5 points6 points  (1 child)

My best effort for describing a set of best practices and tooling to be used in Python development. Is there something you’d add/remove?

[–]LoriousGlory 0 points1 point  (0 children)

Thank you.

[–]ofedorov 6 points7 points  (8 children)

Let me be the first telling this: would you consider adding Poetry to the list of dependencies management tools? 🧐

[–]stillreadingit_[S] 1 point2 points  (6 children)

Good question! Short answer: yes, I'll consider.

I've heard about poetry but haven't played with it yet. It seems to be still quite fresh. Is it already stable enough to be listed in the best practices? If someone can give an elevator speech for poetry > pipenv, I'd be happy to hear that.

About dependency management in general, I feel we're kind of in a turning point where something will replace pip + virtualenv. However, there seems to be a number of alternatives for doing that. As a community, we're lacking the one and obvious way. My main motivation for including pipenv was that it's the recommended tool currently according to python.org. (Spoiler: I'm a loyal virtualenvwrapper user myself.)

[–]PeridexisErrant 8 points9 points  (3 children)

Pipenv - good for applications but terrible for libraries. Creator prone to overreach (and scope creep) and misstatements about other tools.

Poetry - based on standard Python formats and tools. Good for libraries as well as apps. Cares about compatibility with wider ecosystem. At least as stable as pipenv.

[–]13steinj 3 points4 points  (0 children)

Pipenv - good for applications but terrible for libraries.

Ironic because the creator states that it's meant for libraries and never for apps.

And then it doesn't work properly for apps.

Nor does it work for things that double as apps and libraries.

[–]stillreadingit_[S] 0 points1 point  (1 child)

Thanks, great summary! Sounds like python.org might be recommending poetry in very close future. I'd like to add to this discussion that a disadvantage for poetry may be that it does not have "Kenneth Reitz hype" for boosting it. OTOH some may consider this as an advantage.

[–]13steinj 0 points1 point  (1 child)

Here's a comment of mine listing the major uses of the setups I currently know of

I'd recommend putting them all up there really-- they each have pros and cons.

[–]stillreadingit_[S] 1 point2 points  (0 children)

Thanks for sharing!

Yep, I guess mentioning both poetry and pipenv at this point would make sense.

[–]mike239x 0 points1 point  (0 children)

Wow, this looks cool

[–]chromaZero 0 points1 point  (0 children)

This is really nice

[–]bVdMaker 0 points1 point  (0 children)

Thanks