ActiveState / appdirs

A small Python module for determining appropriate platform-specific dirs, e.g. a "user data dir".
http://pypi.python.org/pypi/appdirs
MIT License
1.05k stars 98 forks source link

Move to a setuptools declarative syntax #136

Open jdufresne opened 4 years ago

jdufresne commented 4 years ago

Introduced in setuptools 30.3.0 (8 Dec 2016).

https://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files

The declarative syntax removes the need to execute custom code during setup.py. Reduces setup.py boilerplate and opens the ability to modify the metadata using scripts.

McSinyx commented 4 years ago

Is this taken into considerations?

appdirs is a dependency of setuptools, so allow installing without it.

Placement for metadata is entirely esthetic, while this change may cause unforeseen complications.

jdufresne commented 4 years ago

setuptools vendors its dependency, they aren't installed through traditional tools such as PyPI. So, IMO, the comment in setup.py is misguided and inaccurate. Using setup.py it is not necessary for setuptools' sake.

Placement for metadata is entirely esthetic

It is not simply an aesthetic choice. Using setup.cfg:

this change may cause unforeseen complications.

Do you have something in mind? I suppose any change ever could cause unforeseen complications, they are unforeseen after all. If you have something in mind, or even a hunch, I can take a deeper look.

McSinyx commented 4 years ago

setuptools vendors its dependency, they aren't installed through traditional tools such as PyPI

I was trying to say that as commented, appdirs should not be dependent on setuptools. I have not investigated any further on how setuptools installs appdirs without setup.py, but I'm quite sure it would not be possible for a user to install appdirs with only Python stdlib if this get merged. I have no data to back-up the importance of keeping such backward-compatibility:

allow installing without [setuptools]

and that's some of the unforeseen complication. I guess it would not be a problem for most cases to add setuptools as build dependency, but that's just pure guessing. I believe appdirs is made to be as portable as possible, and the current build is not broken, so naturally I'm against any uncertainty of a change.

Using setup.cfg:

  • Avoids custom code execution when installing from a source distribution
  • Avoids custom code execution when building source and wheel distributions
  • Reduces boilerplate copied form setup.py to setup.py throughout the ecosystem
  • Opens the potential for more scripting as the data is now in a well formed, well understood

I'd refer to these as (favorable) esthetic, aside from custom code execution, which may have something to do with portability and security. Actually as suggested by PEP 517 and 518, futuristically pure Python packages should drop setup.py for good and adopt something like flit, but I believe our number one priority here is to maintain portability especially across obsolate platforms.

Note that the above are just my opinions, I'm just a downstream user of this package.