Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 09 22:01
    jab commented #179
  • May 09 21:55
    jab commented #178
  • May 09 21:53
    codecov[bot] commented #179
  • May 09 21:50
    jab opened #179
  • May 09 21:50

    jab on 310

    Test with Python 3.10 (compare)

  • May 09 21:47
    jab commented #178
  • May 09 20:59
    codecov[bot] commented #178
  • May 09 20:56
    jab opened #178
  • May 09 20:56

    jab on dev

    Upgrade dependencies. (compare)

  • May 09 20:54

    jab on dev

    Add filterwarnings = error to pā€¦ (compare)

  • May 08 01:45
    eleventh83 starred jab/bidict
  • May 06 13:42
    MeisQuietude starred jab/bidict
  • May 05 15:58
    phborba starred jab/bidict
  • May 04 19:35
    nc-pennington starred jab/bidict
  • May 04 12:31
    zhqu1148980644 starred jab/bidict
  • May 04 02:44
    Bobholamovic starred jab/bidict
  • May 04 01:51
    Cuda-Chen starred jab/bidict
  • May 03 22:51
    Nanguage starred jab/bidict
  • May 03 22:21
    donovanr starred jab/bidict
  • Apr 27 00:21

    jab on deps

    (compare)

Joshua Bronson
@jab
šŸ‘‹ @IsaacG, nice to see you here! Looking forward to hacking with you on Friday.
LEONID GILMAN
@leonidgman_gitlab
Hi @jab
Joshua Bronson
@jab
Hey @leonidgman_gitlab, great to see you here! šŸ‘‹
Neil Tiwari
@neiltiwari
:wave: @jab
Joshua Bronson
@jab
šŸ‘‹@neiltiwari, welcome!
And welcome @/all to today's bidict Hack Day, great to see you here! If you'd like to follow my first suggestion for something to work on today, of adding property-based tests with Hypothesis, and you're new to the subject, you can start reading about it here: http://hypothesis.rtfd.io/
I can demo an example of adding a new property-based test for everyone on a screenshare at 10am Eastern. Join via https://meet.google.com/ouf-syai-xvv at that time if interested.
If you're interested in working on something else, let me know and I'll look forward to helping in any way I can!
Joshua Bronson
@jab
Also check out https://bidict.readthedocs.io/contributors-guide.html and let me know if you have any issues setting up a development environment.
Joshua Bronson
@jab
You may also wish to spend some time taking the "guided tour" through bidict's code that starts here: https://github.com/jab/bidict/blob/master/bidict/__init__.py (see the comment starting with "Welcome to the bidict source code" in the header)
Joshua Bronson
@jab
How's everyone doing?
Btw, someone please remind me to ask y'all if anyone wants to present at the Hack Day show-and-tell on Tuesday!
Neil Tiwari
@neiltiwari
@jab Some minor quick q:
  1. I noticed that https://github.com/jab/bidict/blob/07c2dcf1a75642af169da400bb40b59fe01fe3dd/tests/properties/test_properties.py#L354 is under test_properties but is it a property test?
  2. On https://github.com/jab/bidict/blob/07c2dcf1a75642af169da400bb40b59fe01fe3dd/tests/properties/test_properties.py#L267, is there a reason it is written that way with the pylint disable instead of assert hasattr(bi, "_isinv")
Tuan Anh Hoang-Vu
@hvtuananh
@jab just getting familiar with bidict dev environment and hypothesis. One quick question on the env setup: I'm getting this error running pip install, are you missing wheel in requirements?
Building wheels for collected packages: py-cpuinfo
  Running setup.py bdist_wheel for py-cpuinfo ... error
  Complete output from command /home/tuananh/projects/bidict/venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-03qu3tgi/py-cpuinfo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpeq9k47vbpip-wheel- --python-tag cp36:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for py-cpuinfo
  Running setup.py clean for py-cpuinfo
Failed to build py-cpuinfo
Joshua Bronson
@jab
Hey @neiltiwari, sorry I just saw your questions!
  1. Good eye, that's not a hypothesis-powered property-based test -- there's no @given(...) feeding hypothesis-generated input into it. I deliberately threw it into test_properties.py nonetheless to keep it together with the other property-based tests for that function, but I at least should have added a comment to make it clearer this was intentional (not missing a @given or something).
  2. Just that bi._isinv more clearly and concisely expresses the intent there, in my opinion.
@hvtuananh, sorry to hear you hit this! I've never seen that before. IIUC wheel should not need to be in setup_requires.
I'm down to dig into why you're hitting this later, but just to get your development environment set up more quickly, for now would you like to try passing --no-binary=:all: to your pip install command?
Tuan Anh Hoang-Vu
@hvtuananh
I resolved it by install wheel and reinstall py-cpuinfo. I guess py-cpuinfo does not list wheel as its dependency
Joshua Bronson
@jab
Great you worked around it already! (If/when interested in following up, could be worth comparing your environment to environments where this is working. e.g. On Travis-CI's Xenial image, pip install Just Works, and pip list includes wheel, see e.g. https://travis-ci.org/github/jab/bidict/jobs/730242994 (search for "pip list" in the console output) ā€“ but definitely for another time since this is exactly the kind of nonsense that can otherwise easily burn a whole hack day:)
Tuan Anh Hoang-Vu
@hvtuananh
yeah my system python env is pretty barren, does not have much there. I always use venv to avoid conflict
Joshua Bronson
@jab
Yeah, that's essential for reproduceability, but I'm using a virtualenv on Travis too.
Could be to do with the OS (which venv can't do anything about).
e.g. on macOS, it looks like wheel isn't even a transitive dependency.
Neil Tiwari
@neiltiwari

Something interesting, in poking around to find where the invariants might break, I found that by adding

HASHABLES = ATOMS | st.functions()

this causes test_pickle_roundtrips to fail because functions cannot be pickled. One can, amusedly create bidicts with functions as keys

bidict({print: print}).inv[print]("Hello world")
LEONID GILMAN
@leonidgman_gitlab
I'd add property test to iterate thru all mutable dict types to check for duplicate key/value logic
@given(st.MUTABLE_BIDICTS, booleans)
def test_dup_keyError(bi, val):
"""raise dup key error"""
for b in (bi, bi.inv):
b[val] = not val
try:
b[val] = val
except KeyDuplicationError as ex:
assert len(b) == len(b.inv)
else:
raise Exception("Dup not picked up")
Joshua Bronson
@jab
Nice find, @neiltiwari! Sounds like what the test_pickle_roundtrips actually wants as input are bidicts whose items are all PICKLEABLE, not just HASHABLE.
Neil Tiwari
@neiltiwari
right
Joshua Bronson
@jab
@leonidgman_gitlab, that sounds like a nice test to add, thanks! Btw, you can use something like with pytest.raises(KeyDuplicationError): ... to more succinctly assert that something should raise an expected exception.
LEONID GILMAN
@leonidgman_gitlab
@given(st.MUTABLE_BIDICTS, booleans)
def test_dup_keyError(bi, val):
"""raise dup key error"""
for b in (bi, bi.inv):
b[val] = not val
with pytest.raises(KeyDuplicationError):
b[val] = val
assert len(b) == len(b.inv)
Joshua Bronson
@jab
How's everyone doing? Ready to reconvene in https://meet.google.com/ouf-syai-xvv or want a little more time?
Joshua Bronson
@jab
Thanks @/all who joined for the sprint today, it was great hacking with you! I'm not sure I'll be able to make the show-and-tell on Tuesday (I have a training all next week), but if any of you want to present something at the show-and-tell, please coordinate here, and thank you for presenting! If there's anything you'd like me to review in advance, I'll be happy to try to take a look this weekend. Great collaborating with you all again, and looking forward to next time!
LEONID GILMAN
@leonidgman_gitlab
@jab how to run/enable precommit hooks?
Joshua Bronson
@jab
@leonidgman_gitlab sorry I just saw this. You can find the answer by running precommit -h or checking the precommit docs. Thanks for your PR, I touched it up and merged it to master this evening.