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

Add a minimal pyproject.toml #114

Merged
merged 14 commits into from
Apr 14, 2023
Merged

Add a minimal pyproject.toml #114

merged 14 commits into from
Apr 14, 2023

Conversation

corranwebster
Copy link
Contributor

This is enough to permit installation without needing numpy and cython in the environment via PEP-517 style isolated builds.

Fixes #105

@jwiggins
Copy link
Member

Windows, Python 3.9 failed during Cython installation. Would pinning the version fix this?

@corranwebster
Copy link
Contributor Author

Windows, Python 3.9 failed during Cython installation. Would pinning the version fix this?

Possibly - I think there is a more fundamental issue that the command-line args to setup.py may not be passed through to the isolated build.

setup.py Outdated Show resolved Hide resolved
@corranwebster
Copy link
Contributor Author

Assuming that everything passes, this is probably ready for review.

Comment on lines 31 to 34
- name: Install library and dependencies
run: python -m pip install -e .
if: matrix.os == 'ubuntu-latest'
- name: Install library (w/o text rendering support)
run: python -m pip install -e . --install-option --no-text-rendering
if: matrix.os != 'ubuntu-latest'
Copy link
Member

@jwiggins jwiggins Apr 14, 2023

Choose a reason for hiding this comment

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

Can we keep the explicit no-text-rendering test? Using the CELIAGG_NO_TEXT_RENDERING flag in the environment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but what's the goal? To test the builds with no text rendering or because there is an issue on Windows?

The tests pass on Windows with text rendering (even though there is no Harfbuzz)

Copy link
Member

@jwiggins jwiggins Apr 14, 2023

Choose a reason for hiding this comment

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

The goal would be to explicitly exercise the logic in setup.py (and also the parts of the library looking out for the absence of text rendering)

Copy link
Member

Choose a reason for hiding this comment

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

To be more clear: It was decided in the early days of this project that one should be able to build the library with only numpy if they don't care about missing text rendering. So as long as that functionality is in place, we should endeavor to test it.

This decision can of course be revisited, but that's not the intent of this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My concern was that we had a branch of the text rendering code (the windows non-freetype rendering) that is being missed from tests - ie. if something breaks text rendering on windows, we wouldn't know.

It seems like a richer matrix might make sense, perhaps at the expense of testing less Python versions on Windows/Mac.

What I might do is revert this to testing exactly the same set of cases as the original, and there can be another PR around what cases we actually want to test.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good. That's a very good point about explicitly testing Windows text rendering.

Comment on lines 23 to 26
- name: Install dependencies for MacOS
run: |
brew install pkg-config freetype harfbuzz
if: matrix.os == 'macos-latest'
Copy link
Member

Choose a reason for hiding this comment

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

Can we leave this out? macOS runners are generally pretty oversubscribed, so it would be nice to keep the build fast there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It only adds 11 seconds, but it looks like they may already be installed:

Warning: pkg-config 0.29.2_3 is already installed and up-to-date.
To reinstall 0.29.2_3, run:
  brew reinstall pkg-config
Warning: freetype 2.13.0_1 is already installed and up-to-date.
To reinstall 2.13.0_1, run:
  brew reinstall freetype
Warning: harfbuzz [7](https://github.com/celiagg/celiagg/actions/runs/4691785631/jobs/8316700693?pr=114#step:4:8).1.0 is already installed and up-to-date.
To reinstall 7.1.0, run:
  brew reinstall harfbuzz

If we are concerned about minimizing MacOS runner time, do we want to test only on a subset of Python versions (eg. 3.8 and 3.11)?

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough. Another PR can improve the build matrix.

setup.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
I fear that this won't work correctly: environment variables may not be
passed in.
@corranwebster
Copy link
Contributor Author

corranwebster commented Apr 14, 2023

Environment variables are not being passed through: see eg. windows tests:

test_no_text_draw_text_failure (tests.test_no_text.TestNoTextSupport) ... skipped 'Text support is available'

which should now not have text support.

Nope - just too many negations.

Copy link
Member

@jwiggins jwiggins left a comment

Choose a reason for hiding this comment

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

Looks good. I just have some minor formatting quibbles

setup.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
@jwiggins
Copy link
Member

Thanks for grinding through this!

@corranwebster corranwebster merged commit 5e298c8 into main Apr 14, 2023
@corranwebster corranwebster deleted the enh/add-pyproject-toml branch April 14, 2023 10:21
corranwebster added a commit that referenced this pull request Apr 21, 2023
This is enough to permit installation without needing numpy and cython in the environment via PEP-517 style isolated builds.  Text rendering in the builds is now controlled by an environment variable.

Fixes #105
corranwebster added a commit that referenced this pull request Apr 21, 2023
This is enough to permit installation without needing numpy and cython in the environment via PEP-517 style isolated builds.  Text rendering in the builds is now controlled by an environment variable.

Fixes #105
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.

Add pyproject.toml to permit easier pip installs
2 participants