Skip to content

Commit

Permalink
Refactor codebase to apply selected ruff linting and formatting rules (
Browse files Browse the repository at this point in the history
…#311)

* add ruff linting and formatting rules

* basic ruff autofix

* update pyproject

* refactor utils.py

* refactoring modules for ruff linting

* Add ruff linting formatting and basic ruff autofixes (#305)

* add ruff linting and formatting rules

* basic ruff autofix

* lint / black

* bump version

---------

Co-authored-by: Niall Keleher <[email protected]>

* update readme (#308)

* update readme

* update readme

* fix typo

* more readme udpates

* update pyfixest.qmd

* only return md table in readme

* dont return rwolf output in readme

* attempt to print data frame

* add examples for rwolf

* add examples for rwolf

* fix small typos

* add bonferroni correction #309 (#310)

* add bonferroni correction #309

* Update rwolf and bonferroni docs

* update version to 0.15.4

* basic ruff autofix

* order imports

* basic ruff autofix

* Add ruff linting formatting and basic ruff autofixes (#305)

* add ruff linting and formatting rules

* basic ruff autofix

* lint / black

* bump version

---------

Co-authored-by: Niall Keleher <[email protected]>

* add black pre-commit hook

* refactoring modules for ruff linting

* add ruff to linting github action

* disable ruff on notebooks

* format FormulaParser

* temp - run tests on fix-linting-errors

* fix dataframe filtering, noqa: E712

* fix dropped_singleton_bool conditional

* remove extra debugging branch on CI

---------

Co-authored-by: Alexander Fischer <[email protected]>
  • Loading branch information
NKeleher and s3alfisc authored Feb 13, 2024
1 parent c9bcf84 commit 72cd684
Show file tree
Hide file tree
Showing 44 changed files with 965 additions and 812 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/black.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run Ruff
run: ruff check --output-format=github .
- name: Run Black
uses: psf/black@stable
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@ repos:
hooks:
- id: check-github-workflows
args: ["--verbose"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
- id: ruff
name: ruff

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
hooks:
- id: black
1 change: 1 addition & 0 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ quartodoc:
- did.estimation.did2s
- did.estimation.lpdid
- did.estimation.event_study
- multcomp.bonferroni
- multcomp.rwolf
- title: Estimation Classes
desc: |
Expand Down
7 changes: 3 additions & 4 deletions docs/pyfixest.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Economists](https://aeturrell.github.io/coding-for-economists/econmt-regression.
## Features

- OLS and IV Regression
- Poisson Regression
- Poisson Regression following the [pplmhdfe algorithm](https://journals.sagepub.com/doi/full/10.1177/1536867X20909691)
- Multiple Estimation Syntax
- Several Robust and Cluster Robust Variance-Covariance Types
- Wild Cluster Bootstrap Inference (via
Expand All @@ -40,6 +40,7 @@ Economists](https://aeturrell.github.io/coding-for-economists/econmt-regression.
estimator
- Basic Versions of the Local Projections estimator following
[Dube et al (2023)](https://www.nber.org/papers/w31184)
- Multiple Hypothesis Corrections following the Procedure by [Romano and Wolf](https://journals.sagepub.com/doi/pdf/10.1177/1536867X20976314)

## Installation

Expand All @@ -57,9 +58,7 @@ pip install git+https://github.com/s3alfisc/pyfixest.git

## News

`PyFixest` `0.13` adds support for the [local projections
Difference-in-Differences
Estimator](https://s3alfisc.github.io/pyfixest/difference-in-differences-estimation/).
`PyFixest` `0.15.2` adds support Romano-Wolf Corrected p-values via the `rwolf` function.

## Benchmarks

Expand Down
50 changes: 50 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# docs: justfile docs: https://just.systems/man/en/
default:
just --list --unsorted

# Clean environment
[confirm]
clean:
rm -rf .venv/

# Update dependencies in pyproject.toml
poetry-update:
poetry update

# Install development dependencies
install-dev:
poetry env use 3.11
poetry config virtualenvs.in-project true
poetry install

# Install R dependencies
install-r:
Rscript -e 'install.packages(c("broom", "clubSandwich", "did2s", "fixest", "wildrwolf"), repos="https://cran.rstudio.com")'

# Run pytest
tests:
poetry run pytest -n 4 --cov-report=term tests

# Build the package
build: tests
poetry build

# Build documentation and website
docs-build:
poetry run quartodoc build --verbose --config docs/_quarto.yml

# Render documentation and website
render: docs-build
poetry run quarto render docs

# Build the documentation and watch for changes
docs-watch:
poetry run poetry run quartodoc build --watch --verbose --config docs/_quarto.yml

# Preview the docs
preview:
poetry run quarto preview docs

# Clean docs build
docs-clean:
rm -rf docs/_build docs/api/api_card
158 changes: 82 additions & 76 deletions poetry.lock

Large diffs are not rendered by default.

Loading

0 comments on commit 72cd684

Please sign in to comment.