Skip to content
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

Consider adopting a code autoformatter #379

Open
astrojuanlu opened this issue Mar 27, 2023 · 0 comments
Open

Consider adopting a code autoformatter #379

astrojuanlu opened this issue Mar 27, 2023 · 0 comments

Comments

@astrojuanlu
Copy link

One of the most idiosyncratic features, at first sight, of the skforecast codebase is the liberal use of whitespace, see for example:

with pytest.raises(TypeError, match = err_msg):
backtesting_forecaster(
forecaster = forecaster,
y = y,
steps = 3,
metric = 'mean_absolute_error',
initial_train_size = initial_train_size,
refit = False,
fixed_train_size = False,
exog = None,
interval = None,
n_boot = 500,
random_state = 123,
in_sample_residuals = True,
verbose = False
)

Nowadays there's a trend of using automatic code formatters, like Black, which apply a uniform code style automatically.

It's important to note that the point of these tools is to save time for developers by completely giving up formatting solutions. This has pros and cons:

  • Pros: You don't have to make decisions about code formatting ever again.
  • Cons: You don't get to decide the code formatting ever again 🙃

There are intermediate solutions that are not so opinionated, like yapf, that allow some configuration. But still, it's unlikely that you can configure the automated tool to do exactly what you'd want in all cases.

I personally find tools like Black quite liberating, by freeing me from tweaking the style of my code even if sometimes I don't quite like the result. However, I'd also understand if the skforecast maintainers decide to not adopt one.

To give you an idea of what this would mean, here's the result of applying black . to skforecast:

> git diff --stat | tail -n1
 164 files changed, 24374 insertions(+), 17492 deletions(-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant