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

Use declarative setuptools #7629

Merged
merged 18 commits into from
Mar 30, 2023
Merged

Conversation

graingert
Copy link
Member

@graingert graingert commented Mar 8, 2023

mostly built by running pipx run setup-py-upgrade . and pipx run versioneer install --no-vendor with some manual tweaks

related to #7622

  • Tests added / passed
  • Passes pre-commit run --all-files

Copy link
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @graingert. Do you have bandwidth to do the same things for dask/dask? dask/dask#10032

@graingert
Copy link
Member Author

this fails with:

The reported errors are:
- Encountered problems while solving:
-   - nothing provides requested dask-core 2023.3.1a230308
- 

Leaving build/test directories:
  Work:
 /usr/share/miniconda3/envs/test/conda-bld/work 
  Test:
 /usr/share/miniconda3/envs/test/conda-bld/test_tmp 
Leaving build/test environments:
  Test:
source activate  /usr/share/miniconda3/envs/test/conda-bld/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p 
  Build:
source activate  /usr/share/miniconda3/envs/test/conda-bld/_build_env 


Traceback (most recent call last):
  File "/usr/share/miniconda3/envs/test/lib/python3.8/site-packages/boa/cli/mambabuild.py", line 141, in mamba_get_install_actions
    solution = solver.solve_for_action(_specs, prefix)
  File "/usr/share/miniconda3/envs/test/lib/python3.8/site-packages/boa/core/solver.py", line 230, in solve_for_action
    t = self.solve(specs)
  File "/usr/share/miniconda3/envs/test/lib/python3.8/site-packages/boa/core/solver.py", line 220, in solve
    raise RuntimeError("Solver could not find solution." + error_string)
RuntimeError: Solver could not find solution.Mamba failed to solve:
 - dask-core 2023.3.1a230308
 - python >=3.8
 - pip

@jrbourbeau
Copy link
Member

Hrm, there's usually some delay between packages showing up on the web and them being available for download (something to do with CDN refreshing). I'll restart the conda build CI job to see if it passes now

@jrbourbeau
Copy link
Member

jrbourbeau commented Mar 8, 2023

Okay, so it's still failing, but got further in the build process

EDIT: ModuleNotFoundError: No module named 'versioneer'

@graingert
Copy link
Member Author

yeah it looks like pip is ignoring the [build-system] requires

@graingert
Copy link
Member Author

it looks like boa disables pip build isolation, https://github.com/mamba-org/boa/blob/cd087c5582e11125fc0a8bc855056de5b4b41ddf/boa/core/build.py#L399-L406 which is needed for pyproject.toml build-system requires to work

@jrbourbeau
Copy link
Member

cc @jakirkham @charlesbluca in case you have any thoughts on making pyproject.toml + boa work well together

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

       26 files  +       1         26 suites  +1   12h 8m 39s ⏱️ - 20m 6s
  3 543 tests ±       0    3 437 ✔️ +       1     104 💤 ±  0  2  - 1 
44 822 runs  +1 320  42 726 ✔️ +1 246  2 094 💤 +75  2  - 1 

For more details on these failures, see this check.

Results for commit 1280220. ± Comparison against base commit 0d39c19.

♻️ This comment has been updated with latest results.

setup.cfg Outdated Show resolved Hide resolved
@jakirkham
Copy link
Member

cc @jakirkham @charlesbluca in case you have any thoughts on making pyproject.toml + boa work well together

There shouldn't be anything to do here

@jrbourbeau
Copy link
Member

Yeah, sorry @graingert fixed that in d3106d0

@graingert
Copy link
Member Author

looks like we're getting hit by python/cpython#99130 the recommendation is to use importlib_metadata on platforms with a buggy importlib.metadata.entry_points implementation what do you think @jrbourbeau ?

@jakirkham
Copy link
Member

Not James, but that seems sensible to me

@jrbourbeau
Copy link
Member

Not James

But even better!

@graingert FWIW using importlib_metadata in these cases seems reasonable to me too

@graingert graingert force-pushed the use-declarative-config branch 3 times, most recently from 8aae43e to e6372d5 Compare March 16, 2023 16:12
@graingert graingert marked this pull request as ready for review March 16, 2023 16:13
@graingert graingert requested a review from fjetter as a code owner March 16, 2023 16:13
@graingert graingert marked this pull request as draft March 16, 2023 16:54
@graingert graingert marked this pull request as ready for review March 16, 2023 16:58
Copy link
Member

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

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

Thanks Thomas! 🙏

Generally this looks good. Had a couple minor questions below

setup.cfg Outdated Show resolved Hide resolved
setup.cfg Outdated Show resolved Hide resolved
.github/workflows/conda.yml Show resolved Hide resolved
Copy link
Member

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks Thomas! 🙏

Copy link
Member

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

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

Thanks Thomas! 🙏

This is looking pretty good. Had one minor comment below

Copy link
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Thanks @graingert! Overall this looks great.

distributed/deploy/tests/test_old_ssh.py::test_nprocs_attribute_is_deprecated and distributed/deploy/tests/test_old_ssh.py::test_old_ssh_nprocs_renamed_to_n_workers seems to be failing consistently in CI here but also don't appear in the flaky test reports. I opened #7717 to double check that those failures aren't on main. Maybe some modification was made when copying over the pytest filterwarnings?

@jrbourbeau
Copy link
Member

Yeah, it looks like those tests are passing over in #7717. So it appears they're related to the changes here. Again, my guess is it's related to our filterwarnings

@graingert
Copy link
Member Author

@jrbourbeau nice catch, I diffed the value of pprint.pp(warnings.filters) before and after my changes and got:

   None,
   0),
  ('ignore',
-  re.compile('(?s)Exception in thread.*old_ssh.*channel\\.send\\(b"\\\\x03"\\).*Socket is closed', re.IGNORECASE|re.DOTALL),
+  re.compile('(?s)Exception in thread.*old_ssh.*channel\\.send\\(b"\\x03"\\).*Socket is closed', re.IGNORECASE|re.DOTALL),
   <class 'pytest.PytestUnhandledThreadExceptionWarning'>,
   None,
   0),

Copy link
Member

@charlesbluca charlesbluca left a comment

Choose a reason for hiding this comment

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

Thanks @graingert 😄 a couple questions, mostly around conda build stuff:

.github/workflows/conda.yml Outdated Show resolved Hide resolved
.github/workflows/conda.yml Outdated Show resolved Hide resolved
@@ -27,6 +27,8 @@ requirements:
- python >=3.8
- pip
- dask-core {{ dask_version }}
- versioneer =0.28
- tomli # [py<311]
Copy link
Member

Choose a reason for hiding this comment

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

Is the version selector necessary here? IIRC this is a noarch build

Copy link
Member Author

Choose a reason for hiding this comment

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

If we build on 3.11 tomli isn't needed, my understanding is noarch builds still build a package for each python version?

Copy link
Member

@jakirkham jakirkham Mar 28, 2023

Choose a reason for hiding this comment

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

While true, versioneer has try...except... logic to prefer the builtin when available. So it probably doesn't matter much whether the selector is here or not

Think Charles' point is we generally don't want to use selectors in a noarch file since it can't really be conditioned. That said, with build & host dependencies this is less relevant. Since those are just used for the build and the packages wind up with a fixed set of dependencies regardless

This all to say there are valid reasons to drop this selector or keep it. However in terms of the end result, it shouldn't matter which way we go

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the clarification @jakirkham - I'm fine going either way here, just wanted to verify that this had no impact on the build

-p no:legacypath'''
filterwarnings = [
"error",
'''ignore:Please use `dok_matrix` from the `scipy\.sparse` namespace, the `scipy\.sparse\.dok` namespace is deprecated.:DeprecationWarning''',
Copy link
Member

Choose a reason for hiding this comment

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

Nit for readability - is there a reason all of these are triple-single-quoted? Assuming some of these are for character escaping purposes (not too familiar with TOML syntax), but this example pyproject.toml seems to imply that a lot of these could be double quoted instead:

https://github.com/rapidsai/dask-cuda/blob/9fef6b7b1a65ab0a5bd5784c440451d8fcb2d71e/pyproject.toml#L121-L131

Copy link
Member Author

Choose a reason for hiding this comment

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

A few of these have literal backslash escapes and single quotes in and I wanted the indentation to line up across all of them

Copy link
Member

Choose a reason for hiding this comment

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

Ah thanks for the clarification, didn't realize that pytest requires literal backslashes in the filter strings. In that case understand that it's probably best to stick to one TOML string type and stay consistent

@jakirkham jakirkham mentioned this pull request Mar 30, 2023
2 tasks
@jakirkham
Copy link
Member

Any more thoughts on this one?

@jrbourbeau jrbourbeau changed the title use declarative setuptools Use declarative setuptools Mar 30, 2023
Copy link
Member

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Thanks @graingert for all your work here -- and @jakirkham @charlesbluca for the reviews

@jrbourbeau jrbourbeau merged commit 78a926d into dask:main Mar 30, 2023
@graingert graingert deleted the use-declarative-config branch March 30, 2023 16:01
@jakirkham
Copy link
Member

Thanks James! 🙏

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.

4 participants