News for hackers. Stuff that matters.
Re:Structuring Your Project by zomglings on Saturday December 07, 2019 @05:58PM (#21733176)
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 the runtime work - in case they want to dig deeper.

Most people will not want to dig deeper, anyway. They will be happier to just have boilerplate that works and that they can iterate upon.

Look at the golang version of this guide: https://github.com/golang-standards/project-layout

How many programmers new to go are going to want to wade through all of that? Especially when they're probably starting out with projects for which most of those conventions don't even apply!

It's surprising to me that Python, as focused as its philosophy is on providing canonical solutions to problems, doesn't have a "python -m newproject". There must be a good reason. Will try making one in my free time to find out.

[0] https://github.com/facebook/create-react-app

[1] https://docs.djangoproject.com/en/2.2/ref/django-admin/#star...

[2] https://doc.rust-lang.org/cargo/guide/creating-a-new-project...

[3] https://github.com/technomancy/leiningen/blob/master/doc/TUT...

Re:Structuring Your Project by Datenstrom on Saturday December 07, 2019 @06:07PM (#21733226)
`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/

Re:Structuring Your Project by ptx on Sunday December 08, 2019 @05:49AM (#21735295)
I never tried Poetry because of this somewhat worrying part of installation instructions: "The installer installs the poetry tool to Poetry's bin directory ... located at $HOME/.poetry/bin ...This directory will be in your $PATH environment variable".

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 by zomglings on Saturday December 07, 2019 @06:10PM (#21733244)
Nice, thank you! Will definitely check out poetry now - have been avoiding it for reasons of inertia so far. :)
Re:Structuring Your Project by theHamsta on Sunday December 08, 2019 @04:35AM (#21735084)
Psyscaffold has a --pyproject option (or at least an add-on linked in the readme, don't remember)
Re:Structuring Your Project by j88439h84 on Saturday December 07, 2019 @07:19PM (#21733582)
poetry new --src projectname

is my preference these days.

Re:Structuring Your Project by JulianWasTaken on Saturday December 07, 2019 @06:24PM (#21733328)
Given Python's history, there are just too many "one way"s to do things.

The space of packaging has changed hugely in the last 5 years, and probably will again in the next 5 (both in good ways).

Maybe then we get a standard templater.

Though sure, if poetry is your thing, it does this.

(Me, FWIW, given that I still generally stick to setuptools for better or worse, I have my own templater that I use [0])

[0] https://github.com/Julian/mkpkg

Re:Structuring Your Project by lifeisstillgood on Sunday December 08, 2019 @03:09AM (#21734868)
Tooting my own horn try: https://github.com/mikadosoftware/mkrepo

mkrepo reponame .

will get a fairly decent skeleton created (been using a lot for my own stuff recently)

Re:Structuring Your Project by dragonwriter on Sunday December 08, 2019 @03:19AM (#21734895)
> It's surprising to me that Python, as focused as its philosophy is on providing canonical solutions to problems, doesn't have a "python -m newproject". There must be a good reason.

The reason is probably related to the perennial python packaging problem; many of the projects offering solutions to that problem have their own project generator bundled.