Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update package metadata #817

Merged
merged 4 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [docs] Add more examples
- [dev] Change github action job names
- [docs] Add additional examples for installation from git repos
- [packaging] Switch to [PEP 621](https://www.python.org/dev/peps/pep-0621/)

## 1.0.0

Expand Down
14 changes: 0 additions & 14 deletions MANIFEST.in

This file was deleted.

3 changes: 0 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"flake8-bugbear==21.11.29",
"mypy==0.930",
"types-jinja2",
"check-manifest==0.47",
"packaging>=20.0",
"isort==5.10.1",
]
Expand Down Expand Up @@ -173,8 +172,6 @@ def lint(session):
"--warn-unused-ignores",
*files,
)
session.run("check-manifest")
session.run("python", "setup.py", "check", "--metadata", "--strict")


@nox.session(python=PYTHON_ALL_VERSIONS)
Expand Down
59 changes: 57 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,61 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling>=0.14.0"]
gaborbernat marked this conversation as resolved.
Show resolved Hide resolved
build-backend = "hatchling.build"

[project]
name = "pipx"
description = "Install and Run Python Applications in Isolated Environments"
readme = "README.md"
license = "MIT"
requires-python = ">=3.7"
keywords = [
"pip",
"install",
"cli",
"workflow",
"Virtual Environment",
]
authors = [
{ name = "Chad Smith", email = "[email protected]" },
]
classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
Copy link
Contributor

@gaborbernat gaborbernat Feb 19, 2022

Choose a reason for hiding this comment

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

One feature gap compared to setuptools and setup.cfg I see here is that this file is now manually maintained and formatted while using setuptools one can use the excellent setup-cfg-fmt project for it. Does hatch have plans to add formatting support? Without it I'm tempted to keep using setuptools 🤔 Naturally if other maintainers even with that feature gap like hatch I'm not going to oppose 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose I could add a command for that but:

  1. Something like that is indeed better suited as a small, separate project that can be used by all.
  2. I would personally never use it because I would like to retain comments, and tomlkit is extremely buggy.

Are you saying that until there is a pyproject.toml linter you're not keen on using PEP 621?

Copy link
Contributor

@gaborbernat gaborbernat Feb 19, 2022

Choose a reason for hiding this comment

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

Indeed 😊 I am loosing some functionality otherwise that I do have with the current framework, and the benefits of switching to PEP-621 in the short term are not that much compared to setup.cfg.

Copy link
Contributor

Choose a reason for hiding this comment

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

Setup-cfg-fmt does a lot more than just formatting, it also keeps up the classifiers for new Python versions and cleans them up, sorts dependencies, etc. It also runs in pre-commit, can taplo?

It also strips comments, valid empty (sub) sections, and can’t be disabled for part of a file AFAIK…

Copy link
Contributor

@henryiii henryiii Feb 20, 2022

Choose a reason for hiding this comment

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

tomlkit is extremely buggy.

👍

An eventual tool should not be tied to a build backend, but be a generic tool; probably a pair of tools like taplo & (imaginary atm) pep621-fmt or something. Fmt is a little off since it would be more of a validator. Happy to have it live alongside hatch though. ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

There are some very good reasons to put comments in sometimes, like https://github.com/scikit-hep/awkward-1.0/blob/6d3c1d23d7ab492d0178b1798e179088a066e00a/pyproject.toml#L90-L157 - probably rare for the project metadata itself, but the other tool fields might need comments (flake8/pylint config being big ones for needed comments). Comments can be overdone, sure, but sometimes they are needed. setup-cfg-fmt doesn't support them for technical reasons, not primarily because they are a bad idea. I usually have managed without comments in setup.cfg, though, sometimes painfully with flake8, but really hope not to leak that issue over into pyproject.toml. :)

Copy link

@abravalheri abravalheri Feb 25, 2022

Choose a reason for hiding this comment

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

I would personally never use it because I would like to retain comments, and tomlkit is extremely buggy.

tomlkit has received a lot of improvements over the last 6 months. I personally have contributed several patches and @frostming has become a maintainer and has been doing an amazing job!

As an example of its potential, I can safely use it in ini2toml for translating the "AST" of .ini files to .toml, which includes preserving comments.

So if its being a while that you last checked tomlkit, maybe it is a good time to have a look if it improved for your use cases?

Copy link
Contributor

Choose a reason for hiding this comment

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

For what's worth I've been using tomlkit for https://github.com/gaborbernat/pyproject-fmt and works well for me 👍

Copy link

@frostming frostming Feb 25, 2022

Choose a reason for hiding this comment

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

Run into this due to the ping, and I found @gaborbernat already made a pyproject.toml formatter, powered by tomlkit

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried to use toolkit in cibuildwheel (at least 6 months ago, probably more), and found it too buggy to use; it was a rather weird format, but it was important to keep it, which it failed to do. I ended up just writing a manual writer, since it was a very well structured limited file. Great to hear it is seeing improvements! I know it was not 1.0.0 compliant either last I checked, but is now. :)

And @gaborbernat, @abravalheri, and @ofek have all made TOML formatter/validators. :) pypyroject-fmt, pyproject-validate, and validate-pyproject.

"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
dependencies = [
"argcomplete>=1.9.4",
"colorama>=0.4.4; sys_platform == 'win32'",
"importlib-metadata>=3.3.0; python_version < '3.8'",
"packaging>=20.0",
"userpath>=1.6.0",
]
dynamic = ["version"]

[project.urls]
Documentation = "https://pypa.github.io/pipx/"
"Source Code" = "https://github.com/pypa/pipx"
"Bug Tracker" = "https://github.com/pypa/pipx/issues"

[project.scripts]
pipx = "pipx.main:cli"

[tool.hatch.version]
source = "code"
path = "src/pipx/version.py"

[tool.hatch.build.targets.sdist]
include = [
"/src",
"/logo.png",
"/pipx_demo.gif",
"/*.md",
]

[tool.isort]
profile = "black"
Expand Down
45 changes: 0 additions & 45 deletions setup.cfg

This file was deleted.

14 changes: 0 additions & 14 deletions setup.py

This file was deleted.