-
-
Notifications
You must be signed in to change notification settings - Fork 117
Migrate to src Layout and use pyproject.toml #97
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
Conversation
Signed-off-by: Manuel Stausberg <m.stausberg@pm.me>
Signed-off-by: Manuel Stausberg <m.stausberg@pm.me>
Thanks for this!!
Interesting... Did every single test fail and can you let me know what the pixel diff was? I believe it should have printed that output. Can you also let me know some basic details about the machine you're using like OS/version?
I like that. Since you mentioned PIL (pillow) before, is that something that should be added into those optional dependencies? Looks like I didn't see it there... Otherwise it looks OK to me! Are there any other changes to our DEV/deployment flow that you can think of that would occur after changing from |
Also for the failed tests it would be useful to find where it stored the generated images (somewhere in a local temp directory) and see if there are any obvious differences between those and the reference files. For example one thing that @ehmatthes and I ran into several times are obvious differences in fonts across systems that would cause the pixels to be different enough from the reference images to fail the tests. |
It is already installed as a dependency of manim, so I did not add it explicitly (but we can do that of course).
Not that I am aware of... how does your deployment workflow look like? If it's based on setuptools then it should be no problem. Regarding the failed tests, When comparing the reference images with the ones generated during testing, it is obvious that the commands are working as expected, but the font is slightly different: image rendered during reference image: So I think this is just an artifact of the OS differences. |
Only one passed, must be
|
Thanks I think it's a good idea because I believe I had to manually install on my end. For some reason it wasn't pulled in for me as a dependency of something else.
Currently the deployment process is only 2 steps, but I do specifically mention the
Which builds the latest version of the package and then uploads it to the PyPI.
Interesting... @ehmatthes and I specifically picked a font to be used in the tests called "Courier New" and hoped it would exist on major OS's. Any way you can check your system to see if this font exists somewhere? Looks like there may also be an issue with bolding, but the font-family itself is def different between the screenshots you linked. |
I am most of the way through a demo of using a local font file for testing. It involves building support for paths in the I'll share more when I have another hour or two, but if this works it would do away with these cross-platform testing issues, which I believe will always pop up in frustrating ways. I think it would allow nailing down a tight pixel ratio, and any errors would be breaking issues, not just OS-specific differences. |
Okay, quick rundown:
Jacob, I think if you run the test suite on this branch it will pass for you. I had to install |
One major simplification I haven't had time to dig into: Wherever |
I can't spend more time on this right now, but I was able to move the font context work to I'll work this up into a clean PR and you can evaluate whether it's worth implementing. (I assume a PR is the best way to share an idea, even if the PR itself doesn't end up being the version that's merged in the end?) |
Sorry for sharing the exploratory work yesterday, I'm not sure that was helpful. I submitted a much cleaner PR that should address test consistency across systems. |
Hey thanks for these updates @ehmatthes - they were helpful. When @paketb0te ran into test failures I probably should have made a note to move the discussion about that into #55. But it's all good. |
@paketb0te I merged @ehmatthes PR #98 into the dev branch and added Also, let me know if you can think of any potential issues with the new src/ layout and the deployment process I mentioned above. If everything works for you I think we can close this one. |
Just did, all tests are passing 🥳 |
I think you just need to change your build command to You probably have to install the # previously 'python setup.py sdist bdist_wheel'
python3 -m build
twine upload --skip-existing dist/* |
Hi @paketb0te! Here's def compare_images(path_gen, path_ref):
...
# Images are similar if only a small % of pixels differ significantly.
# This value can be increased if tests are failing when they shouldn't.
# It can be decreased if tests are passing when they shouldn't.
msg = f"bad pixel ratio ({path_ref.stem[8:]}): {ratio_diff}"
assert ratio_diff < 0.015, msg Can you drop the threshold for ratio_diff down to 0.0075 and see if tests still pass for you? How about 0.005? Assuming they fail there, what's the highest failing ratio that you see? I'm asking because I think we can drop that ratio back to 0.0075 now that everyone's tests should be running with the exact same font. |
I dropped it down to 0.0075 as you suggested @ehmatthes , but this made 11/18 tests fail again:
|
Okay, thanks. I'll set up an Ubuntu VM at some point soon and look at what's happening. I think keeping it at 0.015 is fine for now. We will almost certainly use a different font for testing long term, and we may change the way the images are compared, both of which would take the place of this setting anyway. |
This implements #85.
Unfortunately the tests did not pass on my machine even before migrating, but at least they fail with the same errors (same amount of pixel diff), so I think / hope that I broke nothing in the process...
I added some optional dependencies (see
[project.optional-dependencies]
in pyproject.toml) which are only required for development, and can be installed withpip install -e .[dev]
.(Updated CONTRIBUTING.md accordingly)
Let me know what you think @initialcommit-io 😃