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

Move project metadata to pyproject.toml #122

Merged
merged 12 commits into from Apr 16, 2024

Conversation

bswck
Copy link
Contributor

@bswck bswck commented Apr 15, 2024

Closes #121.

@bswck bswck closed this Apr 15, 2024
@bswck bswck reopened this Apr 15, 2024
@bswck
Copy link
Contributor Author

bswck commented Apr 16, 2024

How do you imagine mass-scale migration in downstream projects?

pyproject.toml Outdated Show resolved Hide resolved
setup.cfg Show resolved Hide resolved
@jaraco
Copy link
Owner

jaraco commented Apr 16, 2024

How do you imagine mass-scale migration in downstream projects?

Great question. First, I should probably sync all projects with skeleton prior to merging this change. Then, I'll want to make sure the automatic merge conflict resolution takes into account pyproject.toml (where it currently expects setup.cfg). That won't help with populating placeholders for this change, though, because pyproject.toml won't conflict, so I'll also want a routine to populate the placeholders. Still, that won't be enough to cause any customizations in setup.cfg to make it to pyproject.toml. Probably what we need if we want to help mechanize that process is a tool to convert the setup.cfg to pyproject.toml first in each project. Then at least we can use conflict resolution tools to facilitate the resolution.

I found at least two tools that promise to do the job:

pyproject.toml Outdated Show resolved Hide resolved
@jaraco
Copy link
Owner

jaraco commented Apr 16, 2024

Looks like ini2toml[full] does a pretty good job:

 tempora main @ pip-run 'ini2toml[full]' -- -m ini2toml setup.cfg
DEPRECATION: Loading egg at /opt/homebrew/Cellar/tbb/2021.12.0/lib/python3.12/site-packages/TBB-0.2-py3.12-macosx-14.0-arm64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
openvino 2024.0.0 requires openvino-telemetry>=2023.2.1, which is not installed.
[build-system]
requires = ["setuptools>=61.2"]
build-backend = "setuptools.build_meta"

[project]
name = "tempora"
authors = [{name = "Jason R. Coombs", email = "jaraco@jaraco.com"}]
description = "Objects and routines pertaining to date and time (tempora)"
readme = "README.rst"
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3 :: Only",
]
urls = {Homepage = "https://github.com/jaraco/tempora"}
requires-python = ">=3.8"
dependencies = [
    "pytz",
    "jaraco.functools>=1.20",
]
dynamic = ["version"]

[project.optional-dependencies]
testing = [
    # upstream
    "pytest >= 6, != 8.1.*",
    "pytest-checkdocs >= 2.4",
    "pytest-cov",
    "pytest-mypy",
    "pytest-enabler >= 2.2",
    "pytest-ruff >= 0.2.1",
    # local
    "pytest-freezer",
    "types-pytz",
]
docs = [
    # upstream
    "sphinx >= 3.5",
    "jaraco.packaging >= 9.3",
    "rst.linker >= 1.9",
    "furo",
    "sphinx-lint",
    # tidelift
    "jaraco.tidelift >= 1.4",
    # local
]

[project.scripts]
calc-prorate = "tempora:calculate_prorated_values"

[tool.setuptools]
include-package-data = true

@bswck
Copy link
Contributor Author

bswck commented Apr 16, 2024

Looks like ini2toml[full] does a pretty good job:

 tempora main @ pip-run 'ini2toml[full]' -- -m ini2toml setup.cfg
DEPRECATION: Loading egg at /opt/homebrew/Cellar/tbb/2021.12.0/lib/python3.12/site-packages/TBB-0.2-py3.12-macosx-14.0-arm64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
openvino 2024.0.0 requires openvino-telemetry>=2023.2.1, which is not installed.
[build-system]
requires = ["setuptools>=61.2"]
build-backend = "setuptools.build_meta"

[project]
name = "tempora"
authors = [{name = "Jason R. Coombs", email = "jaraco@jaraco.com"}]
description = "Objects and routines pertaining to date and time (tempora)"
readme = "README.rst"
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3 :: Only",
]
urls = {Homepage = "https://github.com/jaraco/tempora"}
requires-python = ">=3.8"
dependencies = [
    "pytz",
    "jaraco.functools>=1.20",
]
dynamic = ["version"]

[project.optional-dependencies]
testing = [
    # upstream
    "pytest >= 6, != 8.1.*",
    "pytest-checkdocs >= 2.4",
    "pytest-cov",
    "pytest-mypy",
    "pytest-enabler >= 2.2",
    "pytest-ruff >= 0.2.1",
    # local
    "pytest-freezer",
    "types-pytz",
]
docs = [
    # upstream
    "sphinx >= 3.5",
    "jaraco.packaging >= 9.3",
    "rst.linker >= 1.9",
    "furo",
    "sphinx-lint",
    # tidelift
    "jaraco.tidelift >= 1.4",
    # local
]

[project.scripts]
calc-prorate = "tempora:calculate_prorated_values"

[tool.setuptools]
include-package-data = true

Looks promising. There are 2 incompatibilities that could potentially cause a mess, I think.
First, I would apply this fix:

-authors = [{name = "Jason R. Coombs", email = "jaraco@jaraco.com"}]
+authors = [
+    { name = "Jason R. Coombs", email = "jaraco@jaraco.com" },
+]

to facilitate merging the skeleton.

Another fix would be:

-urls = {Homepage = "https://github.com/jaraco/tempora"}
+[project.urls]
+Homepage = "https://github.com/jaraco/tempora"

so, again, it is easier to merge the skeleton when additional URLs are added in a downstream project.

@bswck
Copy link
Contributor Author

bswck commented Apr 16, 2024

First, I should probably sync all projects with skeleton prior to merging this change. Then, I'll want to make sure the automatic merge conflict resolution takes into account pyproject.toml (where it currently expects setup.cfg). That won't help with populating placeholders for this change, though, because pyproject.toml won't conflict, so I'll also want a routine to populate the placeholders. Still, that won't be enough to cause any customizations in setup.cfg to make it to pyproject.toml. Probably what we need if we want to help mechanize that process is a tool to convert the setup.cfg to pyproject.toml first in each project. Then at least we can use conflict resolution tools to facilitate the resolution.

I found at least two tools that promise to do the job:

Sounds like a great plan. If neither of these tools do things fully as we need technically (they are very specific and have to do with whitespaces and final TOML tokens), I suggest adding an extra routine in jaraco.develop that first invokes ini2toml/pyproject-migrator and later applies some tweaks programmatically to be compatible with skeleton's pyproject.toml format. As for now, I'm thinking that tomlkit would be the best tool we could use for round-trip TOML "post-processing".

pyproject.toml Outdated Show resolved Hide resolved
@jaraco
Copy link
Owner

jaraco commented Apr 16, 2024

There are 2 incompatibilities that could potentially cause a mess, I think.

I'm thinking rather than address these proactively, maybe just let the conflicts occur (between the generated form and the skeleton) and then use skeleton "known merge" features to reconcile. I'll try that concept and see how it goes.

Well, I tried it on tempora, and I can see it's going to be more complicated than known merges, mostly due to ordering differences.

image

I hadn't fully grasped that project.urls was being defined in two different scopes (as a value of project or in its own section). Now I agree, the conversion should make some of these tweaks early.

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
@jaraco
Copy link
Owner

jaraco commented Apr 16, 2024

Looking good:

image

I'm a little annoyed that an exact match on authors still gets included in the conflict, but c'est la vie.

@jaraco
Copy link
Owner

jaraco commented Apr 16, 2024

Diff for tempora is perfect now. Close enough that I may not even bother developing a mechanical merge resolution and may just push through with --strategy ours. I'll spot check a few more repos.

image

@bswck
Copy link
Contributor Author

bswck commented Apr 16, 2024

Let's go, let's go! 🚀

@jaraco jaraco merged commit f4529af into jaraco:main Apr 16, 2024
12 of 14 checks passed
@bswck bswck deleted the feat/pep-621-metadata branch April 16, 2024 20:40
clrpackages pushed a commit to clearlinux-pkgs/pypi-jaraco.functools that referenced this pull request Apr 22, 2024
…0 to version 4.0.1

Avasam (1):
      Allow mypy on PyPy (jaraco/skeleton#111)

Bartosz Sławecki (3):
      Tweak coverage configuration for type checking (jaraco/skeleton#97)
      Add link to blog entry from jaraco/skeleton#115 above CI build matrix.
      Move project metadata to `pyproject.toml` (jaraco/skeleton#122)

Christian Clauss (2):
      Upgrade GitHub Actions checkout (jaraco/skeleton#94)
      GitHub Actions: Combine tox jobs diffcov and docs (jaraco/skeleton#95)

Dimitri Papadopoulos Orfanos (2):
      Use the ruff formatter (jaraco/skeleton#99)
      ruff: extended-ignore → ignore (jaraco/skeleton#105)

Jason R. Coombs (24):
      Limit sphinxlint jobs to 1. Workaround for sphinx-contrib/sphinx-lint#83.
      Remove news fragment after allowing time to be processed downstream.
      Suppress deprecation warning in dateutil. Workaround for dateutil/dateutil#1284.
      Update Github Actions badge per actions/starter-workflows#1525.
      Separate collateral jobs on different lines for easier override/extension.
      Drop minimum requirement on pytest-mypy as most environments are already running much later. Closes jaraco/skeleton#96.
      Remove sole entry for branches-ignore. Workaround for and closes jaraco/skeleton#103.
      Bump year on badge
      Remove build and dist from excludes. It appears they are not needed and their presence blocks the names of packages like 'builder' and 'distutils'. Ref pypa/distutils#224.
      Exclude docs and tests directories properly per Setuptools behavior.
      Rely on default discovery for good heuristics for finding packages.
      Enable preview to enable preserving quotes.
      Use latest versions in RTD boilerplate.
      Remove Sphinx pin. Ref sphinx-doc/sphinx#11662.
      Include deps from the base config in diffcov.
      Enable complexity check and pycodestyle warnings. Closes jaraco/skeleton#110.
      Use 'extend-select' to avoid disabling the default config. Ref jaraco/skeleton#110.
      Re-enable ignoring of temporary merge queue branches. Closes jaraco/skeleton#103.
      Fetch unshallow clones in readthedocs. Closes jaraco/skeleton#114.
      Move Python 3.11 out of the test matrix.
      Configure pytest to support namespace packages. Ref pytest-dev/pytest#12112.
      Pin against pytest 8.1.x due to pytest-dev/pytest#12194.
      Migrated config to pyproject.toml using jaraco.develop.migrate-config and ini2toml.
      Finalize

Sviatoslav Sydorenko (1):
      Enable testing merge queues @ GitHub Actions CI/CD (jaraco/skeleton#93)

bswck (1):
      Remove deprecated `call_aside` from __init__.pyi
clrpackages pushed a commit to clearlinux-pkgs/pypi-inflect that referenced this pull request Apr 26, 2024
…ion 7.2.1

Bartosz Sławecki (2):
      Add link to blog entry from jaraco/skeleton#115 above CI build matrix.
      Move project metadata to `pyproject.toml` (jaraco/skeleton#122)

Jason R. Coombs (25):
      Configure pytest to support namespace packages. Ref pytest-dev/pytest#12112.
      Pin against pytest 8.1.x due to pytest-dev/pytest#12194.
      Migrated config to pyproject.toml using jaraco.develop.migrate-config and ini2toml.
      Extract _handle_chunk function, one small step toward simplification.
      Simplify a bit by using booleans instead of ints.
      Extract _sub_ord function.
      Re-use _sub_ord where the same pattern appears.
      Remove unnecessary variable and type assignment
      Implemented _sub_ord as one regex operation.
      Prefer expression algebra
      Remove comment that's redundant to the docstring.
      Extract _chunk_num and _remove_last_blank functions.
      Avoid repetition in call and assignment and vary on the parameter.
      Extract function for _get_sign
      Prefer None for tri-state variable
      Remove remnant comment
      Refactor signout handling to consolidate some behavior and limit interacting branches.
      Re-write first as a single assignment of a boolean expression.
      Extract _render method for rendering the chunks.
      Simplify logic by yielding the comma separately.
      Consolidate returns across group and non-group.
      Reformat
      Add news fragment.
      Finalize
      Restore Python 3.8 compatibility in annotations.
clrpackages pushed a commit to clearlinux-pkgs/pypi-keyring that referenced this pull request Apr 30, 2024
…sion 25.2.0

BakerNet (9):
      add getcreds to cli for interface to get_credentials
      Syntax
      ruff
      fix _check_args
      format
      switch to --get-mode instead of separate operation
      Add output format argument for get operation
      typos
      change --get-mode to --mode

Bartosz Sławecki (2):
      Add link to blog entry from jaraco/skeleton#115 above CI build matrix.
      Move project metadata to `pyproject.toml` (jaraco/skeleton#122)

Jason R. Coombs (11):
      Pin against pytest 8.1.x due to pytest-dev/pytest#12194.
      Migrated config to pyproject.toml using jaraco.develop.migrate-config and ini2toml.
      Allow macos on Python 3.8 to fail as GitHub CI has dropped support.
      Move project.urls to appear in the order that ini2toml generates it. Remove project.scripts.
      Extract methods for getting the credential or password.
      Extract methods for emitting a credential.
      Re-write do_get to re-use credential objects.
      Move checks for 'no result' back into do_get.
      Rewrite _check_args using rules for required params. Consolidates logic and reduces cyclomatic complexity to 2.
      Add news fragment.
      Finalize
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.

Move project metadata to pyproject.toml
2 participants