-
Notifications
You must be signed in to change notification settings - Fork 83
Snapshot tests plots #1113
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
Open
s3alfisc
wants to merge
9
commits into
master
Choose a base branch
from
snapshot-tests-plots
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+33,660
−363
Open
Snapshot tests plots #1113
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
68b0d00
move from internal etable, dtable, make_table to maketables package
s3alfisc 7138d24
further adjustments
s3alfisc eb46ced
adjust table-layout
s3alfisc ad9357c
fix type errors
s3alfisc 8bb6132
cleanups
s3alfisc 9e6e1cd
snapshot tests for etable
s3alfisc 9fb5c8d
snapshot tests for tables and plots
s3alfisc 4864b31
Merge master into i-stateful
s3alfisc 09cef7e
run pre-commit
s3alfisc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| name: Snapshot Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - 'pyfixest/report/**' | ||
| - 'pyfixest/estimation/decomposition.py' | ||
| - 'tests/test_etable_snapshot.py' | ||
| - 'tests/test_plots_snapshot.py' | ||
| - 'tests/__snapshots__/**' | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - 'pyfixest/report/**' | ||
| - 'pyfixest/estimation/decomposition.py' | ||
| - 'tests/test_etable_snapshot.py' | ||
| - 'tests/test_plots_snapshot.py' | ||
| - 'tests/__snapshots__/**' | ||
| schedule: | ||
| # Run weekly on Mondays at 6:00 UTC to catch dependency-induced regressions | ||
| - cron: '0 6 * * 1' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| snapshot-test: | ||
| name: "Snapshot Tests" | ||
| runs-on: macos-14 # ARM-based macOS | ||
| continue-on-error: true # Warn only - does not block merge | ||
| steps: | ||
| - name: Checkout source | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Setup pixi | ||
| uses: prefix-dev/setup-pixi@v0.8.3 | ||
| with: | ||
| pixi-version: v0.41.4 | ||
| cache: true | ||
|
|
||
| - name: Compile Rust extension | ||
| run: | | ||
| pixi run -e snapshot maturin-develop | ||
|
|
||
| - name: Run snapshot tests | ||
| id: snapshot_tests | ||
| run: | | ||
| pixi run -e snapshot snapshot-test | ||
|
|
||
| - name: Report snapshot status | ||
| if: failure() | ||
| run: | | ||
| echo "::warning::Snapshot tests failed. Run 'pixi run -e snapshot snapshot-update' locally to update snapshots if the changes are intentional." | ||
|
|
||
| - name: Upload snapshot artifacts on failure | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: snapshot-failures | ||
| path: tests/__snapshots__/ | ||
| retention-days: 7 | ||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,6 +14,13 @@ Starting with pyfixest 0.41.0 (currently in development), the table functionalit | |||||
| The `pf.etable()` API remains unchanged. `pf.dtable()` is deprecated (use `DTable()` directly) and `pf.make_table()` has been removed (use `maketables.MTable()` directly). | ||||||
| ::: | ||||||
|
|
||||||
| Pyfixest comes with functions to generate publication-ready tables. Regression tables are generated with `pf.etable()`, which can output different formats, for instance using the [Great Tables](https://posit-dev.github.io/great-tables/articles/intro.html) package or generating formatted LaTex Tables using [booktabs](https://ctan.org/pkg/booktabs?lang=en). Descriptive statistics tables can be created with `DTable()` and custom tables with `maketables.MTable()`. | ||||||
| ::: {.callout-note} | ||||||
| ## Migration Notice | ||||||
| Starting with pyfixest 0.41.0 (currently in development), the table functionality is powered by [maketables](https://py-econometrics.github.io/maketables/). | ||||||
| The `pf.etable()` API remains unchanged. `pf.dtable()` is deprecated (use `DTable()` directly) and `pf.make_table()` has been removed (use `maketables.MTable()` directly). | ||||||
| ::: | ||||||
|
|
||||||
| Pyfixest comes with functions to generate publication-ready tables. Regression tables are generated with `pf.etable()`, which can output different formats, for instance using the [Great Tables](https://posit-dev.github.io/great-tables/articles/intro.html) package or generating formatted LaTex Tables using [booktabs](https://ctan.org/pkg/booktabs?lang=en). Descriptive statistics tables can be created with `DTable()` and custom tables with `maketables.MTable()`. | ||||||
|
|
||||||
| To begin, we load some libraries and fit a set of regression models. | ||||||
|
|
@@ -24,6 +31,8 @@ import pandas as pd | |||||
| import pylatex as pl # for the latex table; note: not a dependency of pyfixest - needs manual installation | ||||||
| from maketables import DTable | ||||||
| from great_tables import loc, style # great_tables is used by maketables internally | ||||||
| from maketables import DTable | ||||||
| from great_tables import loc, style # great_tables is used by maketables internally | ||||||
| from IPython.display import FileLink, display | ||||||
|
|
||||||
| import pyfixest as pf | ||||||
|
|
@@ -120,10 +129,12 @@ pf.etable( | |||||
| ) | ||||||
| ``` | ||||||
|
|
||||||
| To obtain latex output use `type = "tex"`. If you want to save the table as a tex file, you can use the `file_name=` argument to specify the respective path where it should be saved. Etable will use latex packages `booktabs`, `threeparttable`, `makecell`, and `tabularx` for the table layout, so don't forget to include these packages in your latex document. | ||||||
| To obtain latex output use `type = "tex"`. If you want to save the table as a tex file, you can use the `file_name=` argument to specify the respective path where it should be saved. Etable will use latex packages `booktabs`, `threeparttable`, `makecell`, and `tabularx` for the table layout, so don't forget to include these packages in your latex document. | ||||||
|
|
||||||
| ```{python} | ||||||
| # LaTex output (include latex packages booktabs, threeparttable, makecell, and tabularx in your document): | ||||||
| # LaTex output (include latex packages booktabs, threeparttable, makecell, and tabularx in your document): | ||||||
| tab = pf.etable( | ||||||
| [fit1, fit2, fit3, fit4, fit5, fit6], | ||||||
| signif_code=[0.01, 0.05, 0.1], | ||||||
|
|
@@ -145,6 +156,7 @@ def make_pdf(tab, file): | |||||
| doc.packages.append(pl.Package("threeparttable")) | ||||||
| doc.packages.append(pl.Package("makecell")) | ||||||
| doc.packages.append(pl.Package("tabularx")) | ||||||
| doc.packages.append(pl.Package("tabularx")) | ||||||
|
|
||||||
| with ( | ||||||
| doc.create(pl.Section("A PyFixest LateX Table")), | ||||||
|
|
@@ -342,17 +354,20 @@ format: | |||||
|
|
||||||
| ::: {.callout-warning} | ||||||
| ## Deprecation Notice | ||||||
| `pf.dtable()` will be deprecated in the future. Please use `DTable` from the `maketables` package. | ||||||
| `pf.dtable()` will be deprecated in the future. Please use from the `maketables` package. | ||||||
|
||||||
| `pf.dtable()` will be deprecated in the future. Please use from the `maketables` package. | |
| `pf.dtable()` will be deprecated in the future. Please use `DTable()` from the `maketables` package. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Snapshot tests that don't block merges may allow visual regressions to slip through. Consider making these blocking once stabilized.