pypa / flit

Simplified packaging of Python modules
https://flit.pypa.io/
BSD 3-Clause "New" or "Revised" License
2.15k stars 131 forks source link

Add `flit new` CLI #597

Open Conchylicultor opened 1 year ago

Conchylicultor commented 1 year ago

Currently poetry has a poetry new my_package command which create a new folder containing the minimal required files to publish a project to PyPI.

This is very convenient because I can publish a new PyPI project directly from the CLI:

poetry new my_project
cd my_project
poetry build
poetry publish

However this is currently not possible with flit because the lack of new command. Like everything in flit, the default template could be something minimal, like:

my_project/
    my_project/
        __init__.py
    pyproject.toml
    README.md
pradyunsg commented 1 year ago

FWIW, how would this be different from flit init?

Conchylicultor commented 1 year ago

flit init / poetry init only create the pyproject.toml on an existing my_project/ folder. poetry new create a minimal my_project/ folder (with __init__.py, pyproject.toml, README.md)

takluyver commented 1 year ago

I can see the attraction of the idea, but I think this kind of project setup & automation should be done in a separate tool, not as part of Flit itself.

cookiecutter is one such tool, and there's nothing to stop anyone making a 'Python project with Flit packaging' template for that. Maybe someone already has? Cookiecutter has never entirely clicked for me, though, because I like to start with an empty folder and add bits like packaging, tests, docs, CI when I'm ready for them. I'd be interested to see a tool based around adding pieces like that onto an existing project, like a more advanced cousin of flit init and sphinx-quickstart.

Of course, there's also value in keeping things simple and not forcing people to learn many different tools. That's why flit init exists. But at present, I'm inclined to leave it at that and not add more features for setting up and modifying a project.

z3dev commented 7 months ago

Tis true that initializing a project structure might be outside the scope of flit, however even the python.org manual on managing python packing only supplies a 'suggested' folder structure. And if you search around, there are hundreds of opinions.

So, for the new python user, a tool to setup a new project would be a huge benefit. Why not flit? It has a certain expectations on the structure.