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

Migrate from setup.cfg to pyproject.toml #1371

Merged
merged 4 commits into from
Dec 28, 2022
Merged

Conversation

maresb
Copy link
Contributor

@maresb maresb commented Dec 15, 2022

Migrates from setup.cfg to pyproject.toml. I confirmed that the contents of both the sdist and wheel are equivalent up to trivial changes.

PKG-INFO before:

Metadata-Version: 2.1
Name: aesara
Version: 2.8.9+90.ge9bd02684
Summary: Optimizing compiler for evaluating mathematical expressions on CPUs and GPUs.
Home-page: https://github.com/aesara-devs/aesara
Author: aesara-devs
Author-email: aesara.devs@gmail.com
License: BSD
Keywords: aesara,math,numerical,symbolic,blas,numpy,autodiff,differentiation
...

PKG-INFO after:

Metadata-Version: 2.1
Name: aesara
Version: 2.8.9+105.ge708ed4e4
Summary: A library for defining, optimizing, and efficiently evaluating mathematical expressions involving multi-dimensional arrays.
Author-email: aesara-devs <aesara.devs@gmail.com>
License: BSD-3-Clause
Project-URL: Homepage, https://github.com/aesara-devs/aesara
Keywords: aesara,math,numerical,symbolic,blas,numpy,autodiff,differentiation
...

Thank you for opening a PR!

Here are a few important guidelines and requirements to check before your PR can be merged:

  • There is an informative high-level description of the changes.
  • The description and/or commit message(s) references the relevant GitHub issue(s).
  • pre-commit is installed and set up.
  • The commit messages follow these guidelines.
  • The commits correspond to relevant logical changes, and there are no commits that fix changes introduced by other commits in the same branch/BR.
  • There are tests covering the changes introduced in the PR.

Don't worry, your PR doesn't need to be in perfect order to submit it. As development progresses and/or reviewers request changes, you can always rewrite the history of your feature/PR branches.

If your PR is an ongoing effort and you would like to involve us in the process, simply make it a draft PR.

@maresb maresb marked this pull request as draft December 15, 2022 00:10
@maresb
Copy link
Contributor Author

maresb commented Dec 15, 2022

Ah, looks like I have to modify the GH workflows.

Copy link
Member

@brandonwillard brandonwillard left a comment

Choose a reason for hiding this comment

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

Looks like the flake8 errors might be due to the program not finding the settings in pyproject.toml (see PyCQA/flake8#234).

.pre-commit-config.yaml Outdated Show resolved Hide resolved
pipx install ini2toml[full]
ini2toml setup.cfg > pyproject.toml
rm setup.cfg
@maresb maresb force-pushed the use-pyproject branch 2 times, most recently from 670cbcf to 127aed1 Compare December 17, 2022 17:01
@maresb maresb changed the title Use pyproject.toml Use pyproject.toml instead of setup.cfg Dec 17, 2022
@maresb maresb changed the title Use pyproject.toml instead of setup.cfg Migrate from setup.cfg to pyproject.toml Dec 17, 2022
@maresb maresb marked this pull request as ready for review December 17, 2022 18:05
@codecov
Copy link

codecov bot commented Dec 17, 2022

Codecov Report

Merging #1371 (aafd5fa) into main (67ea5b6) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1371      +/-   ##
==========================================
+ Coverage   74.66%   74.68%   +0.02%     
==========================================
  Files         177      195      +18     
  Lines       49050    49744     +694     
  Branches    10400    10529     +129     
==========================================
+ Hits        36623    37153     +530     
- Misses      10131    10266     +135     
- Partials     2296     2325      +29     
Impacted Files Coverage Δ
aesara/link/jax/dispatch/random.py 100.00% <100.00%> (ø)
aesara/tensor/random/basic.py 99.03% <100.00%> (+<0.01%) ⬆️
aesara/tensor/utils.py 96.42% <0.00%> (ø)
aesara/tensor/random/__init__.py 100.00% <0.00%> (ø)
aesara/typed_list/__init__.py 100.00% <0.00%> (ø)
aesara/tensor/nnet/__init__.py 100.00% <0.00%> (ø)
aesara/utils.py 66.99% <0.00%> (ø)
aesara/scan/__init__.py 100.00% <0.00%> (ø)
aesara/d3viz/__init__.py 100.00% <0.00%> (ø)
aesara/tensor/__init__.py 95.55% <0.00%> (ø)
... and 10 more

brandonwillard
brandonwillard previously approved these changes Dec 21, 2022
Copy link
Member

@brandonwillard brandonwillard left a comment

Choose a reason for hiding this comment

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

I squashed and updated the project description; otherwise, looks good!

@maresb
Copy link
Contributor Author

maresb commented Dec 22, 2022

Thanks a lot for the approval! I still want to do one final pass to readd the fields which were dropped by the ini2toml tool which I used. This may take me a few days. (BTW, would you be okay with me unsquashing the commit f07ec50 since the extended commit information includes instructions for generating pyproject.toml with ini2toml?)

@brandonwillard
Copy link
Member

BTW, would you be okay with me unsquashing the commit f07ec50 since the extended commit information includes instructions for generating pyproject.toml with ini2toml?

No problem.

@maresb
Copy link
Contributor Author

maresb commented Dec 25, 2022

Unsquashing...

maresb and others added 3 commits December 25, 2022 19:34
Co-authored-by: Brandon T. Willard <brandonwillard@users.noreply.github.com>
@maresb
Copy link
Contributor Author

maresb commented Dec 25, 2022

@brandonwillard, got some time on the train today. I think this is now ready to merge. I made an exhaustive comparison with the original setup.cfg, squashed the commits to an extent that I think they'll be a useful when doing the same for other aesara-devs projects, and finally, again I compared the sdists and wheels to make sure nothing was amiss.

Since your last commit, git diff 48ed84f @ > changes.patch

diff --git a/pyproject.toml b/pyproject.toml
index 65a7b0fa0..675601a51 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -75,6 +75,7 @@ platforms = [
     "Mac OS-X",
     "Unix",
 ]
+# Not from setup.cfg
 include-package-data = false
 
 [tool.setuptools.packages.find]
@@ -82,12 +83,11 @@ exclude = [
     "tests",
     "tests.*",
 ]
+# Not from setup.cfg:
 namespaces = false
 
 [tool.setuptools.package-data]
 "*" = [
-    "*.txt",
-    "*.rst",
     "*.txt",
     "*.rst",
     "*.cu",
@@ -99,6 +99,8 @@ namespaces = false
     "*.cpp",
     "ChangeLog",
     "c_code/*",
+]
+"aesara" = [
     "py.typed",
 ]
 "aesara.misc" = ["*.sh"]
@@ -153,7 +155,7 @@ lines_after_imports = 2
 lines_between_sections = 1
 honor_noqa = true
 skip_gitignore = true
-skip = ["aesara/version.py", "**/__init__.py"]
+skip = ["aesara/version.py"]
 skip_glob = ["**/*.pyx"]
 
 [tool.mypy]
@@ -261,6 +263,14 @@ module = ["aesara.tensor.rewriting.basic"]
 ignore_errors = true
 check_untyped_defs = false
 
+[[tool.mypy.overrides]]
+module = ["aesara.tensor.rewriting.shape"]
+warn_unused_ignores = false
+
+[[tool.mypy.overrides]]
+module = ["aesara.tensor.rewriting.elemwise"]
+warn_unused_ignores = false
+
 [[tool.mypy.overrides]]
 module = ["aesara.tensor.subtensor"]
 ignore_errors = true
@@ -326,6 +336,10 @@ module = ["aesara.tensor.random.utils"]
 ignore_errors = true
 check_untyped_defs = false
 
+[[tool.mypy.overrides]]
+module = ["aesara.scan.op"]
+warn_unused_ignores = false
+
 [[tool.mypy.overrides]]
 module = ["aesara.link.numba.dispatch.extra_ops"]
 ignore_errors = true

Explanations: include-package-data = false and namespaces = false were not present in setup.cfg. These will be removed when we switch to Hatch, so I'm not inclined to track down what's going on. The removed .txt and .rst entries are duplicated. Also, **/__init__.py was not originally in setup.cfg so I removed it. Finally, I readded the warn_unused_ignores = false entries which were missing.

Copy link
Member

@brandonwillard brandonwillard left a comment

Choose a reason for hiding this comment

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

Looks great!

@maresb maresb merged commit f874925 into aesara-devs:main Dec 28, 2022
@maresb maresb deleted the use-pyproject branch December 28, 2022 19:24
@maresb maresb mentioned this pull request Jan 2, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants