Skip to content

Convert package to source layout#151

Merged
jared321 merged 7 commits intomainfrom
150SrcLayout
Jun 24, 2025
Merged

Convert package to source layout#151
jared321 merged 7 commits intomainfrom
150SrcLayout

Conversation

@jared321
Copy link
Contributor

@jared321 jared321 commented Jun 24, 2025

Details for this provided in Issue #150.

Note that I also had to remove the use of the Windows 2019 action runner as it will be removed soon. I took the opportunity to add in the new Windows 2025 action runner.

While this is a simple change, my PR review will be significant to ensure that we are creating packages correctly

  • Confirm that version is being set correctly
    • In pydoc output
    • In pip show surmise
    • With >>> surmise.__version__
    • In name of source dists and binary wheels
  • Confirm that source layout is working as expected by running in the nocoverage venv python -m pydoc surmise from the root of the repo and from my home directory to confirm that both are using the installed package
  • Review all changes
  • Run all tox tasks and see that they are working as best they can with the test suite outside the package
    • coverage generates the matern .so each time and runs correctly if I delete it beforehand.
    • nocoverage now runs even if I delete the .so file in the local clone that was created by a previous coverage run. That file remains absent after nocoverage finishes. I do, however, see the .so file created in the package installation.
    • Confirm correct building and installation of C extension. Run multiple times and confirm no difference.
  • Run notebook examples in both coverage and nocoverage venvs to confirm successful execution
  • Confirm only correct minimal set of files in distributions including license file, C file, and .pyx file
    • The source distribution is still including in the .rst files from the root of the repo, but this seems OK for that distro.
    • The binary wheel I build was built with clang and I do see the compiled .so file in it.
  • Install the package from source on different machines and install with different compiler suites
    • Installed with macOS 14 with clang 16.0.0. The install pulled in numpy 2.1.3.
    • On same Mac, forced the use of gcc by running
CC=/opt/homebrew/bin/gcc-14 python -m pip install -v dist/surmise-0.3.1.dev50+g6a62dcf.d20250624.tar.gz
  • Installed with gcc 12.3.0 on Red Hat Enterprise Linux 8.10. The install pulled in numpy 2.1.3.
  • On same linux forced install with Intel's icc and icx
  • For all these, I confirmed that I could import the package, print the version, and that the .so file was in place. I also inspected these with otool -L or ldd and see only OS and compiler external dependencies.
  • Also built a wheel with icx and installed.
  • Confirm that all actions are passing

I had to update some of the autodocumentation information so that the location
of code elements is specified with the full dot path.

Ran all tox tasks successfully.  The nocoverage tox task actually ran through
now even when there is no .so file in the local clone.
@jared321 jared321 self-assigned this Jun 24, 2025
jared321 added 6 commits June 24, 2025 09:30
This runner will be officially removed on June 30, 2025.  Our tests that use it
are intentionally "failing" to communicate us of this impending deprecation.
This runner was transitioned from Beta to "generally available" on 2025-04-08.
Not a surprise.  It doesn't for 2022 and didn't for 2019 either.
It was in the source distribution, but not the wheel.
I was getting different Cython output when I ran with tox -r -e cythonize and
tox -e cythonize.  With this flag, I always get the same output regardless of
how I run it or if the file was already altered.
@jared321 jared321 changed the title DRAFT: Convert package to source layout Convert package to source layout Jun 24, 2025
@jared321 jared321 requested a review from mosesyhc June 24, 2025 19:37
Copy link
Member

@mosesyhc mosesyhc left a comment

Choose a reason for hiding this comment

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

In the review, I verify that tox -e coverage/nocoverage functions as expected and refers to the correct venv. Additionally I confirmed that the src layout has now eliminated the issue where python first checks the script directory for the package.

@jared321 jared321 merged commit 7e7be93 into main Jun 24, 2025
45 checks passed
@jared321 jared321 mentioned this pull request Jun 24, 2025
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.

2 participants