Skip to content

fix: add a few missing parts to setup.cfg setup - #823

Merged
di merged 2 commits into
python:mainfrom
henryiii:fix/missingfind
Feb 9, 2021
Merged

di merged 2 commits into
python:mainfrom
henryiii:fix/missingfind

Conversation

@henryiii

@henryiii henryiii commented Feb 6, 2021 •

Copy link
Copy Markdown
Contributor

Closes pypa/packaging-problems#436

I've reordered the fields to match the description order, and synced the description orders for the two tabs. (I think I matched the order that is given in the setuptools docs originally for the cfg lines). I also added a missing description for python_requires to both tabs.

Personally, I rather think python_requires should have been metadata, not options, since it fills the Requires-Python slot, but it is in options.

@henryiii

henryiii commented Feb 6, 2021 •

Copy link
Copy Markdown
Contributor Author

FYI, the example I've used for the last year or so is here: https://scikit-hep.org/developer/packaging#setup-configuration-medium-priority, which has a few extra options set and uses /src layout.

@webknjaz

webknjaz commented Feb 6, 2021

Copy link
Copy Markdown
Member

@henryiii the PR title doesn't seem to reflect what you did here

@henryiii

henryiii commented Feb 6, 2021 •

Copy link
Copy Markdown
Contributor Author

There are three changes; I've added package = find:, I've reordered the options so they match the descriptions below, and I've added the missing python_requires description. Maybe I should generalize the title a bit? I was initially just trying to solve pypa/packaging-problems#436, and then was looking for anything else I might have possibly missed similar to that.

Is that better?

@henryiii henryiii changed the title fix: add missing packages = find: fix: add a few missing parts to setup.cfg setup Feb 6, 2021
@webknjaz

webknjaz commented Feb 6, 2021

Copy link
Copy Markdown
Member

Honestly, I find it easier to review/approve separate unrelated changes so if one of the updates wouldn't block others from being merged.

description = A small example package
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/pypa/sampleproject

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may be useful to also mention project_urls demonstrating links to issues/docs/CI/etc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to exactly replicate the setup.py example with no changes; would be happy to add a follow-on PR that adds anything that would be useful to add to the example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I didn't know about / start using project_urls until fairly recently, I don't I've even added it to the scikit-hep dev docs yet. But it is really nicely displayed in PyPI, so I think it's a good idea, even if not really minimal.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think I've been using it for the last 3-4 years maybe...

Comment on lines +276 to +283
- ``packages`` is a list of all Python :term:`import packages <Import
Package>` that should be included in the :term:`Distribution Package`.
Instead of listing each package manually, we can use :func:`find_packages`
to automatically discover all packages and subpackages. In this case, the
list of packages will be ``example_pkg`` as that's the only package present.
- ``python_requires`` gives the versions of Python supported by your
project. Installers like pip will look back though older versions of
packages until it finds one that has a matching Python version.

@webknjaz webknjaz Feb 6, 2021 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to deduplicate the copy-pasted explanations? Do you think using the .. include:: directive would help here, or maybe replace substitutions?

@henryiii henryiii Feb 6, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only some of them match; the "packages" description right above it, for example, does not match since it has a discussion of the find: directive in one case, and setuptools.find_packages() in the other.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include from the same file? It might be fragile, though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can only "include" from the same file with substitutions. Including with "start+end" of itself with the include directive sounds a bit wild but I don't see why it wouldn't work (at least in cases when you don't include the place with the directive itself) 🤯

@henryiii

henryiii commented Feb 6, 2021

Copy link
Copy Markdown
Contributor Author

Should I break it out? It's really just follow up cleanup to #818, and reordering doesn't go well in parallel with other changes. Happy to pull out in any order you want, though.

@webknjaz

webknjaz commented Feb 7, 2021

Copy link
Copy Markdown
Member

Should I break it out?

Usually when the title contains references to many things, has "and" in it, or is too vague within the 50 char limit, it's a sign that the PR is too broad and when you can describe its separate parts with a few specific titles, it's a good idea to have a PR per such a title. The person who would merge the PR may get stuck trying to come up with a good commit message for the merge when they'll be attempting to replace "do something related to setup.cfg" with anything that would give the reader any idea what the commit is about.

@henryiii

henryiii commented Feb 9, 2021

Copy link
Copy Markdown
Contributor Author

It would be nice to get this in, it's an edit to something I originally wrote in #818, and the missing line is tripping people up. If there's an issue with something above, I can pull out just the missing line, but there should not be anything controversial in it, I'm just matching the option order, adding the missing line, and added a missing description. I'm about to take off two weeks for the upcoming birth of my daughter, so would prefer not to make a series of very tiny PRs that have to be sequential...

@webknjaz
webknjaz requested a review from di February 9, 2021 17:37
@di
di merged commit 1ae4b30 into python:main Feb 9, 2021
henryiii added a commit to henryiii/packaging.python.org that referenced this pull request Feb 9, 2021
In python#823, it was mentioned that project_urls might be a good thing to show. This adds that example.
@henryiii henryiii mentioned this pull request Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trouble following packaging libraries tutorial

3 participants