cenpy-devs / cenpy

Explore and download data from Census APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setup.py vs. setup.cfg

jGaboardi opened this issue · comments

Originally raised by @ronnie-llamado in #136.

Potential updating setup.py to the more modern setup.cfg.

See also setuptools-declarative-requirements for managing requirement declarations in a setup.cfg.

For easier referencing, here's the previous conversation:

@jGaboardi Looks good. While you're in there updating it, do you have any take on a setup.py vs setup.cfg?

I have never used a setup.cfg file myself (actually never even seen one). It appears to be useful for passing in command line args? I'm not sure about the need or usefulness of having one for this project. Is there a case you have in mind for using/needing a setup.cfg?

PyPA suggests using setup.cfg in most cases since it's static metadata compared to setup.py's dynamic metadata (Packaging Python Projects).
I think you're right though - the implications on this project are minimal. The one added benefit for this project would be configurations for tools like pytest or flake8 would be also be contained in setup.cfg.

Indeed very interesting and elegant. What I can see as a pain point here is that setup.py extracts the version from cenpy.__init__.py. Not sure on how to accomplish this within setup.cfg. Also, where are requirements stipulated in setup.cfg files?

I think this setuptools documentation shows a better example of setup.cfg.

For the version, one can use the attr directive (very snazzy);

[metadata]
...
version = attr: cenpy.__version__

For the requirements, it would be relisted under install_requires (not so snazzy):

[options]
...
install_requires =
    requests
    ...
    geopandas

Not a huge fan manually listing out the requirements though.

Let's leave the decision up to @ljwolf. Also, it might be good to have that in a separate PR. It is a relatively minor thing, but a break from the norm since cenpy's inception.