-
-
Notifications
You must be signed in to change notification settings - Fork 526
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 calendar heatmap display format #1759
Conversation
I'm not sure how to resolve this last lint error:
It looks structurally identical to https://github.com/alichtman/jrnl/blob/bd921f2e0518f0051f7887d3ed42123e750fe26a/jrnl/journals/__init__.py#L1-L5 |
Thanks for the PR! I'm playing around with it and it looks nice. I like that it doesn't introduce any new dependencies, also.
It's in pyproject.toml:161. It should pass if you change that line to this (which I think is a good change):
The overall construction of this PR looks nice. I think the only things left to add are some BDD tests like those in formats.feature, and some unit tests in the new utility functions. |
I took a look at setting up some tests for this. The scaffolding for the test went into that last commit, but the test output is all misformatted, and I'm not sure why. At first glance, it seems like the output is being wrapped because it hits a character boundary. Except not all output is wrapped. See this example specifically. Why are the July calendar dates wrapped, but not the bar at the top of the calendar? And why aren't the numbers that should be below
...
The following works on my machine without any weird formatting. I don't know why the test is rendering it differently:
|
That's very strange. I'm not sure what's going on. It looks like pytest is treating the output fine in the GitHub Actions tests. On my Windows 10 machine, pytest is wrapping the output at 80 characters (well, 82 actually, but there it adds a 2-space indent before the output). Maybe there's something in your environment that it's reading through pytest? You might try it in the isolated tox environment:
When I do that, it wraps to the full width of my terminal (then breaks because pytest adds 2 more spaces to indent the output, but at least that's explicable). As for the root cause, I wonder if it has something to do with Rich's method for getting the terminal size. If you're not running Windows, it investigates STDIN, STDERR, and STDOUT for terminal size (console.py:1016), and uses the first terminal size it can get without an error. Maybe there's something going on there? |
I'm not sure when I'll have time to look into this. |
Following up on our Signal conversation: Since this is a non-critical component of the codebase, and none of us are going to invest the time in getting these tests working, I'm proposing shipping this diff without the tests. |
All tests pass.
|
@alichtman Hey, we're just getting everything caught up after being away for a while (updated dependencies today). We'll get this PR reviewed soon. Thanks for your patience! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for your patience!
* Update dependency ruff to v0.6.8 (jrnl-org#1900) * Update dependency ruff to v0.6.8 * Run `ruff check .` instead of `ruff .` due to ruff error * Preface ruff lint keys with .lint to address ruff deprecation warning * Changes to appease ruff linter --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com> * Update changelog [ci skip] * Update dependency cryptography to v42.0.8 (jrnl-org#1904) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency requests to v2.32.3 (jrnl-org#1899) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency mkdocs to v1.6.1 (jrnl-org#1895) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency jinja2 to v3.1.4 (jrnl-org#1892) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency python-dateutil to v2.9.0 (jrnl-org#1898) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update changelog [ci skip] * Update dependency pytest-bdd to v7.3.0 (jrnl-org#1896) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency black to v24.8.0 (jrnl-org#1923) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency keyring to v25.4.1 (jrnl-org#1924) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency parse-type to v0.6.3 (jrnl-org#1922) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency pytest-xdist to v3.6.1 (jrnl-org#1897) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency poethepoet to v0.29.0 (jrnl-org#1925) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency rich to v13.8.1 (jrnl-org#1926) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update changelog [ci skip] * Add calendar heatmap display format (jrnl-org#1759) * Add calendar heatmap exporter Fix jrnl-org#743 * Lint fixes * More lint fixes * Surface total number of entries per month in heatmap * Refactoring * More refactoring * Resolve last lint error * Unbump version * Add calendar export test scaffolding * WIP: Test debugging + scaffolding * Remove broken tests * Remove args from .vscode/launch.json * Discard changes to tests/bdd/features/format.feature * Remove extraneous vscode files * move NestedDict to utils file * run formatter * fix import error * Address lints --------- Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com> Co-authored-by: Jonathan Wren <jonathan@nowandwren.com> * Update dependency cryptography to v43 (jrnl-org#1928) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency rich to v13.9.1 (jrnl-org#1931) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency tox to v4.21.0 (jrnl-org#1927) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update changelog [ci skip] * Add config to pa11y to workaround github actions issue (jrnl-org#1933) fixes jrnl-org#1932 * Add Python 3.13 support (jrnl-org#1930) * Allow Python 3.13 in pyproject * Add Python 3.13 to GitHub actions * Run `poetry update` * fix failing test * update poetry.lock * update poetry.lock again --------- Co-authored-by: Jonathan Wren <jonathan@nowandwren.com> * Update changelog [ci skip] * Update dependency cryptography to v43.0.3 (jrnl-org#1942) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency black to v24.10.0 (jrnl-org#1939) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency tox to v4.23.0 (jrnl-org#1935) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update changelog [ci skip] * Update dependency rich to v13.9.2 (jrnl-org#1937) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update dependency ruff to v0.7.0 (jrnl-org#1938) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update changelog [ci skip] * Update dependency parse-type to v0.6.4 (jrnl-org#1936) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update changelog [ci skip] * Update dependency xmltodict to v0.14.2 (jrnl-org#1940) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update changelog [ci skip] * Update dependency typed.js to v2.1.0 (jrnl-org#1861) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Update changelog [ci skip] * Update peter-evans/create-pull-request action to v7 (jrnl-org#1929) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Force brighter color with XML syntax highlighting (jrnl-org#1943) * Update changelog [ci skip] * Changelog cleanup (jrnl-org#1944) * Sort packages and and remove extraneous entries * Move docs accessibility issues to docs section * Increment version to v4.2-beta * Update changelog [ci skip] --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com> Co-authored-by: Jrnl Bot <bot@jrnl.sh> Co-authored-by: Aaron Lichtman <aaronlichtman@gmail.com> Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
I think this format is a lot more useful than the
termgraph
solution discussed in #743.Calendar Heatmap Exporter:
termgraph --calendar
:Checklist
for the same issue.