CDCgov / cfa-viral-lineage-model

Apache License 2.0
10 stars 0 forks source link

Clean up imports #48

Closed afmagee42 closed 3 months ago

afmagee42 commented 3 months ago

Our imports are in no particular consistent order, which is a bit confusing.

There should be a pre-commit setting we can toggle to enforce something consistent.

thanasibakis commented 3 months ago

Is that true? I've been running isort on files as we go, unless I missed something.

But I do agree it would be good to have a pre-commit setting to enforce something

afmagee42 commented 3 months ago

From linmod/models.py

import string
from itertools import product
from typing import Iterable

import numpy as np
import numpyro
import numpyro.distributions as dist
import polars as pl
from numpyro.diagnostics import summary
from numpyro.infer.mcmc import MCMC
from plotnine import aes, geom_line, ggplot, theme_bw

from .utils import expand_grid, pl_softmax
afmagee42 commented 3 months ago

This could entirely be my fault as I'm definitely used to pre-commit handling this for me and never having to think about it.

thanasibakis commented 3 months ago

Believe it or not, this is actually The Way :)

https://peps.python.org/pep-0008/#imports

(I make no comment here as to whether or not I like The Way)

afmagee42 commented 3 months ago

I guess I didn't realize the full ordering precedence differentiated standard library imports from other package ones.

Well, I think it's ugly but it's apparently working.