Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Hypothesis + Array API blog post #252

Merged
merged 11 commits into from
Oct 6, 2021

Conversation

honno
Copy link
Contributor

@honno honno commented Sep 16, 2021

This article gives a brief demo of how one would use Hypothesis to test array-consuming methods. The structure and contents is pretty much finished, but this is still a draft and thus I would recommend a proper review take place once I remove the draft status. As well as going through the checks below, I will solicit feedback and generally mull it over before this happens.

This is part of the internship series of blog posts, but do note that it's purely technical. I'll leave personal musing out of this (and possibly write something for my own personal blog to link in this article), which I'd prefer anyway and gives breathing room for fellow interns to go more personal for their blog posts.

nbviewer, GitHub's preview


Text styling

  • The blog is written with plain language (where relevant).
  • If there are headers, they use the proper header tags in order to do so (with only one level-one header).
  • All links describe where they link to (for example, check the Quansight labs website).
  • Any kind of styling that the author uses (for example, bold for emphasis) is consistent throughout the blog.

Non-text contents

  • All content is represented as text (for example, images need alt text and videos need captions or descriptive transcripts).
  • If there are emojis, there are not more than three in a row.
  • Don't use flashing gifs or videos.
  • If it were to be read as plain text, the blog still makes sense and no information is missing.

Me

  • Update notebook metadata once I get a publish date
  • Link personal blog post (if I write it)
  • Sort out blog preview on...
    • blog
    • social

For every commit

  • Run custom cleaning script
  • Check I can Restart + Run All in an isolated environment
  • Check it shows and renders correctly when running nikola
  • Update gist underlying nbviewer link (viewing files in PR repos is broken)

@rgommers rgommers added the type: content 📝 site content (blog posts, pages, ...) label Sep 16, 2021
@honno honno marked this pull request as ready for review September 17, 2021 20:59
@honno
Copy link
Contributor Author

honno commented Sep 17, 2021

I'm quite happy with this now (would appreciate reviews of-course). The sheet is clear this month but note #251 might be scheduled for Sep 21. cc @melissawm

Copy link
Collaborator

@melissawm melissawm left a comment

Choose a reason for hiding this comment

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

@honno I have very minor comments, otherwise this is looking really good. I like the pace and the progressive examples, they are motivating and clear. One thing I'd note is that it's not very clear at this point what exactly you worked on. You do say

Specifically I contributed "strategies" to the testing library Hypothesis, which I'm excited to announce is now available in hypothesis.extra.array_api.

But I think you could be a bit more specific or maybe link your PR to hypothesis here, to really showcase your hard work :)

posts/2021/09/hypothesis-array-api.ipynb Outdated Show resolved Hide resolved
posts/2021/09/hypothesis-array-api.ipynb Outdated Show resolved Hide resolved
posts/2021/09/hypothesis-array-api.ipynb Outdated Show resolved Hide resolved
posts/2021/09/hypothesis-array-api.ipynb Outdated Show resolved Hide resolved
posts/2021/09/hypothesis-array-api.ipynb Outdated Show resolved Hide resolved
posts/2021/09/hypothesis-array-api.ipynb Outdated Show resolved Hide resolved
posts/2021/09/hypothesis-array-api.ipynb Outdated Show resolved Hide resolved
posts/2021/09/hypothesis-array-api.ipynb Outdated Show resolved Hide resolved
posts/2021/09/hypothesis-array-api.ipynb Outdated Show resolved Hide resolved
posts/2021/09/hypothesis-array-api.ipynb Outdated Show resolved Hide resolved
@honno
Copy link
Contributor Author

honno commented Sep 23, 2021

Thank you Melissa for all your great feedback! Unfortunately I haven't quite got round to resolving everything, but I'll probably submit a "ready" draft tomorrow.

I took Ralf's feedback in a call today to end the blog post in a more helpful manner—I ended up talking a bit about "comparison testing", so you could look at that now... I probably need to add an extra sentence there though, as well as finish the Fin section.

My TODO seems to be:

  • Maybe add more context at the start
  • Nice quote-list style
  • Finishing paragraph(s)
  • Social preview image
  • Blog preview cut-off
  • Update notebook metadata when I get a publish date

@honno
Copy link
Contributor Author

honno commented Sep 25, 2021

I'm happy for another review. I changed the intro slightly (to give a tiny bit more context), and added a bit more to the end.

@honno honno force-pushed the honno/hypothesis-array-api branch 3 times, most recently from 8e0921d to e1097c6 Compare September 27, 2021 08:33
Copy link
Collaborator

@melissawm melissawm left a comment

Choose a reason for hiding this comment

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

This is looking really good, I have nothing else to note at this point :)

posts/2021/09/hypothesis-array-api.ipynb Outdated Show resolved Hide resolved
Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

I had another read, it looks great, I don't even have minor comments on the text. @honno could you move the post and image to the 2021/10/ folder, and look at my two comments? Then let's get this published.

"nikola": {
"author": "Matthew Barber",
"date": "2021-09-17 00:00:00 UTC",
"previewimage": "/images/2021/09/hypothesis-array-api-social.png",
Copy link
Member

Choose a reason for hiding this comment

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

Did you on purpose not use the image in the blog post itself? Could be nice to break up the text.

Copy link
Contributor Author

@honno honno Oct 6, 2021

Choose a reason for hiding this comment

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

Good shout. I put it at the start if that's okay (tested locally with a localhost link, but what I've pushed should work).

Copy link
Member

Choose a reason for hiding this comment

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

That didn't actually work, you need to use a relative link. Something like /images/2021/...

Copy link
Member

Choose a reason for hiding this comment

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

(check other posts for examples)

Copy link
Contributor Author

@honno honno Oct 6, 2021

Choose a reason for hiding this comment

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

I think it's fine? This won't work locally because the site preview uses the hardcoded labs.quansight.org link, not a dev environment friendly system.

Copy link
Member

Choose a reason for hiding this comment

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

This won't work locally because the site preview uses the hardcoded labs.quansight.org link, not a dev environment friendly system.

That's my point, it should work fine also with the dev env. All links should be /images/..... All other posts do it like that, why can't this link be the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I was getting confused. So the meta:og stuff hardcodes the link (so you can't preview social media images locally), but the post contents doesn't hardcode the link (I had just assumed it didn't heh). Fixed!

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, works for me too now!

posts/2021/09/hypothesis-array-api.ipynb Outdated Show resolved Hide resolved
@honno
Copy link
Contributor Author

honno commented Oct 6, 2021

@rgommers Awesome, hope it's ready now.

@honno
Copy link
Contributor Author

honno commented Oct 6, 2021

one sec (my force push didnt go through for some reason, so had to do it again—all good now!)

@honno honno force-pushed the honno/hypothesis-array-api branch from 0f939c3 to 61898c8 Compare October 6, 2021 17:34
Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

Very nice post, thanks again @honno

@rgommers rgommers merged commit f79ea5d into Quansight-Labs:main Oct 6, 2021
@Zac-HD
Copy link

Zac-HD commented Nov 24, 2021

Just found this - awesome post @honno! If you're still taking reviews...

  • Header image seems to have mis-rendered the colors of the Hypothesis logo - maybe the .png version would be more stable than .svg?
  • Since you're keen on pretty-printing, you might want to re-render the MultipleFailures traceback with our new support for Pytest traceback display 🎨
  • I wrote up a short conference paper for SciPy last year about PBT-for-scientific-code, which (at risk of self-promotion) is probably relevant when you suggest comparison-testing for readers' code.

@honno
Copy link
Contributor Author

honno commented Nov 24, 2021

Glad you like it @Zac-HD :) Yeah I'd like this post to be more of a reference than anything else, so updating the traceback and referencing your paper (handy!) are definitely good ideas. Will make a new PR at some point™ and ping you for additional review.

Header image seems to have mis-rendered the colors of the Hypothesis logo - maybe the .png version would be more stable than .svg?

Haha that's intentional, thought it'd be interesting to mix in the official Array API (or rather Data APIs) colour scheme. Let me know if you'd prefer I keep with rainbow/blue Scout for this and other things going forward.

@Zac-HD
Copy link

Zac-HD commented Nov 25, 2021

Awesome, if it's a deliberate variation I love it! Ping me whenever Hypothesis feedback would be useful 😊

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: content 📝 site content (blog posts, pages, ...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants