When I'm just learning a new programming language or framework, I prefer to have something like create-react-app [0], django-admin startproject [1], cargo new [2], or lein new [3]. Guides like these are just full of (the wrong type of) rabbit holes. Just give new people something that lets them work productively as soon as possible and refer them to language documentation to understand how features of the language or…
`poetry new`[0] is what you are looking for, previously I have used pyscaffold[1] but I like the pyproject.toml from PEP 518[2] better than all the old stuff. Unfortunately poetry does not set up docs like pyscaffold does though. [0]: https://poetry.eustace.io/ [1]: https://pyscaffold.org/en/latest/ [2]: https://www.python.org/dev/peps/pep-0518/
Structuring Your Project
31–40 of 40 posts
Re: Structuring Your Project
#32Most of the advice here seems okay but this stuck out to me: foo += 'ooo' # This is bad, instead you should do: foo = ''.join([foo, 'ooo']) This seems like such a silly micro-optimization. I also have to question its validity, even in scenarios where you're working with huge strings.
Re: Structuring Your Project
#33When I'm just learning a new programming language or framework, I prefer to have something like create-react-app [0], django-admin startproject [1], cargo new [2], or lein new [3]. Guides like these are just full of (the wrong type of) rabbit holes. Just give new people something that lets them work productively as soon as possible and refer them to language documentation to understand how features of the language or…
`poetry new`[0] is what you are looking for, previously I have used pyscaffold[1] but I like the pyproject.toml from PEP 518[2] better than all the old stuff. Unfortunately poetry does not set up docs like pyscaffold does though. [0]: https://poetry.eustace.io/ [1]: https://pyscaffold.org/en/latest/ [2]: https://www.python.org/dev/peps/pep-0518/
The directory will be in my PATH? That makes me wonder what else it might take the liberty to reconfigure on my system.
But, reading the installer script, it seems like it at least prompts you for confirmation first, so perhaps I'll try it.
Re: Structuring Your Project
#34Re: Structuring Your Project
#35I find myself coming back to this guide whenever I set up a new project: https://sourcery.ai/blog/python-best-practices/
Additionally I can't be the only person who utterly despises pipenv. It is confusing for most people who don't know python packaging internals, phenonomially slow for everyone else and besides discourages building proper distributables (or:wheels).
Re: Structuring Your Project
#36Most of the advice here seems okay but this stuck out to me: foo += 'ooo' # This is bad, instead you should do: foo = ''.join([foo, 'ooo']) This seems like such a silly micro-optimization. I also have to question its validity, even in scenarios where you're working with huge strings.
Re: Structuring Your Project
#37I find myself coming back to this guide whenever I set up a new project: https://sourcery.ai/blog/python-best-practices/
A general ignore_missing_imports=True in mypy.ini is very bad advice. This will hide lots of real errors. It's surprisingly easy to set up mypy such that it will silently not check types in many files. Additionally I can't be the only person who utterly despises pipenv. It is confusing for most people who don't know python packaging internals, phenonomially slow for everyone else and besides discourages building prop…
Re: Structuring Your Project
#38 To give the individual tests import context, create a tests/context.py file:
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
Or you can convert your tests directory to package by placing __init__.py. It's pretty amazing that Kenneth Reitz uses this ugly solution.Re: Structuring Your Project
#39Earlier quoted context omitted.
A general ignore_missing_imports=True in mypy.ini is very bad advice. This will hide lots of real errors. It's surprisingly easy to set up mypy such that it will silently not check types in many files. Additionally I can't be the only person who utterly despises pipenv. It is confusing for most people who don't know python packaging internals, phenonomially slow for everyone else and besides discourages building prop…
What do you do instead of pipenv?
Re: Structuring Your Project
#40Earlier quoted context omitted.
What do you do instead of pipenv?
Pipenvs attempts to replace all other tooling to the answer is: all other tooling. Specifically, setuptools via either setup.py or setup.cfg. pbr, virtualenvs, tox, pip-tools, pip, etc are all useful. Anything that does not take 5-10 minutes to recompute dependencies basically!