mdklatt / cookiecutter-python-app

Cookiecutter template for a Python application project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Replace setup.py with pyproject.toml

mdklatt opened this issue · comments

The use of setup.py is deprecated, and a pyproject.toml file should be used instead. See serial-core v0.9.0 as an example.

In the current implementation, the template application's top-level etc/ directory is for configuration files and other user-editable assets. The data_files directive in setup.py is used to install this directory to the application install root. This directive is deprecated in Setuptools and has no comparable alternative. The recommended replacement is to use package data, but internal package data is not suitable for user-facing assets.

Using an external tool seems to be the only option to install files external to the wheel/package.

Commit ac01709 replaces setup.py with pyproject.toml, but the etc/ directory now has to be installed manually. The installation process depends on the installation target (virtualenv, Docker image, etc.), which is outside the scope of this template.

The pyproject.toml file and related standards has improved the packaging and distribution of Python libraries, but has done nothing for applications (it has arguably made it worse). See, for example, this request for data_files support in Poetry for a discussion of the issues around installing external data files along with a Python application.

Installation is a such a multi-faceted problem that it cannot be captured in this template without making a lot of assumptions. So, the final decision about how to handle the etc/ directory during installation will be left to the user.

Issue resolved by commit d5afdf6.