• 5 Posts
  • 144 Comments
Joined 1 year ago
cake
Cake day: March 1st, 2024

help-circle


  • v1.8.1 was release on 2025-03-17

    So pynput is being maintained. BUT there are current 155 open issues and 23 PRs. This means nothing besides this is a popular package.

    v1.8.1 Changes

    • Remove incorrectly merged line for the Xorg backend. Thanks to sphh!
    • Let events know about the new injected parameter. Thanks to phpjunkie420!

    Mentioned that a PR dealt with a Xorg backend issue. Don’t know if this addresses your particular issue.

    What pynput version do you have in your venv?

    Run this command please to get the package version

    python -m pip list | grep pynput

    Can understand your issue report would be buried in all the other issues. So help there might not come within a timely manner.

    The next step would be to create a pytest file to be able to repeat the tests, rather than run them each time manually. Obviously logging in and out is not possible. But it’s probably also completely unnecessary.

    I use Xorg and Linux. Competent enough with pytest (author of pytest-logging-strict).

    Before roll up my sleeves want you to confirm v1.8.1 still has this issue.


  • You yourself are a victim

    Having good intentions you tried and found out the hard way that in fact packaging does matter.

    You were tricked.

    I looked at it, recognized the flaming turd being thrown at the proverbial wall, and dodged.

    That is our job when doing code reviews and offering advice. Be kind up to the point where being honest is unavoidable.

    A series of scripts does not make a package. Have to put our collective foot down; follow Nancy Reagon’s advice, Just say no!

    This project cannot be helped. It needs a complete rewrite.

    Having minimal expectations is not being mean to noobs. Not getting anywhere in the ballpark of minimal expectations is being mean to potential users …




  • User friendly LOL!

    If you encounter any issues or bugs, let me know so I can fix them!

    You shoulda lead with that. I love the humor. Can’t stop laughing,

    The entire project is a bug LOL!

    Where to start?

    1. There is no packaging at all

    Start with a pyproject.toml and work from there.

    1. no tests

    Everything is a bug until it’s got test coverage.

    1. screenshots

    In the .github folder?! That’s gotta be a 1st

    1. no dev environment

    Expecting pre-commit as well as isort, flask, black, and mypy

    1. print statements galore

    Looked into requirements.txt expecting to find a console UI framework. There is none!

    A pattern has emerged that many Python coders have spent not enough to no time learning packaging, dev toolchain, and CI/CD publishing. When asking folks to test your work they’ll be expecting a published package, not a series of amateurish scripts and a bash install script.

    Should write an advertisement

    Please someone skilled at console UI and packaging please please please help in a paid position.

    Can confidently say, you need help.

    Not writing more features the OP is good at that. Just packaging and swapping out the prehistoric console UI with a modern console UI framework.



  • a use case – feature flags

    Mix and match to plan your day

    will i be going home today?

    >>> OUTRAGED_BY_NEWS = 0b00000001
    >>> GET_A_COFFEE = 0b00000010
    >>> GO_FOR_A_HIKE = 0b00000100
    >>> GO_FOR_A_RUN = 0b00001000
    >>> GO_HOME = 0b00010000 
    >>> various_flags_ored_together = GET_A_COFFEE | GO_FOR_A_RUN | GO_HOME
    >>> various_flags_ored_together & GO_HOME == GO_HOME
    True
    >>> various_flags_ored_together & GO_FOR_A_HIKE == GO_FOR_A_HIKE
    False
    >>> various_flags_ored_together = GET_A_COFFEE | GO_FOR_A_RUN | GO_HOME
    >>> bin(various_flags_ored_together)
    '0b11010'
    >>> various_flags_ored_together & OUTRAGED_BY_NEWS == OUTRAGED_BY_NEWS
    >>> False
    >>> bin(OUTRAGED_BY_NEWS)
    >>> '0b1'
    >>> various_flags_ored_together >> OUTRAGED_BY_NEWS
    >>> bin(various_flags_ored_together)
    '0b1101'
    

    Guess haven’t gone for a hike today…maybe tomorrow

    right shift removes bit at flag position. Which, in this case, happens to correspond to the right most bit.

    use case – file access permissions

    For those looking to check file access permissions there is the stat module

    >>> import stat
    >>> from pathlib import Path
    >>> path_f = Path.home().joinpath(".bashrc")
    >>> stat.S_IRUSR
    256
    >>> path_f.stat().st_mode
    33188
    >>> is_owner_read = path_f.stat().st_mode & stat.S_IRUSR == stat.S_IRUSR
    >>> is_owner_read
    True
    >>> path_f = Path("/etc/fstab")
    >>> is_other_write = path_f.stat().st_mode & stat.S_IWOTH == stat.S_IWOTH
    >>> is_other_write
    False
    

    Assumes ~/.bashrc exists, if not choose a different file you are owner and have read access to.

    path_f.stat().st_mode & stat.S_IRUSR == stat.S_IRUSR

    Looking thru the mundane file (not Linux access control list) permissions. All those flags are crammed into st_mode. In st_mode, on/off bit at 2^8 is that on?

    Sources

    read user access stat.S_IRUSR

    write others access stat.S_IWOTH

    os.stat_result

    pathlib.Path.stat







  • logging_stricttoPythonProfiling slow imports in Python
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    1 month ago

    The sample code for lazy imports looks wrong

    STRIPE = None
    
    def _stripe():
        global STRIPE
        if STRIPE is None:
            import stripe
    
            return stripe
        return STRIPE
    
    

    STRIPE is never changed. And two return statements in the same function?!

    Anyways can imagine how to do lazy imports without relying on the given code sample.


  • logging_stricttoLinuxI'm done with Ubuntu
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    so does zfs, so does wayland, so does trying out every distro, so does trying out every text editor and associated plugins, so does trying out ventoy, so does GrapheneOS, …

    Everything makes life easier, but comes down to,

    Linux isn't free, it costs you your time

    Which can be reframed, what do you really want to spend your time on?

    If i really really really had to answer that overly honestly, want:

    • my GUI apps non-blocking on heavy background processes

    • distributing out tasks to many computers and runners

    None of which screams or necessitates systemd or zfs or wayland or trying out every distro, every text editor every plugin, ventoy, or GrapheneOS.

    Not in a house with a fox with a crow and a bow a knot on a cot or relaxed in the snow, i will not eat never ending random suggestions Sam, i will never eat them Sam i am.



  • How to separate requirements handling and build backend

    then drain-swamp (+drain-swamp-action) which supports build plugins with built in plugin for specifying semantic version.

    Prefer to tell the builder the desired version rather than to be told. Options: ‘tag’, ‘current’, or specify the version. Version bump is silly.

    This way can set the semantic version before tagging a release.

    Warning

    This is hardcore. Not for noobs, the faint of heart, or wise guys. If you don’t need build plugins then maybe drain-swamp is not for you. If you are doing something in setup.py, that you can’t live without, then might have a looksie at drain-swamp.


  • logging_strictOPtoPythonDependency management
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    1 month ago

    No, that’s… against community rules :) I don’t like the common use of venvs or .toml very much and I don’t like their use by other people and “timid” is also diplomatic. So you’re getting timid, and we get to get along and we can agree to disagree on the use of .venvs and we can wish each other a pleasant day.

    Think you broke the Internet. That’s brilliant /nosarc.

    Want you to write my code of misconduct!