refactor(csr): use pandas/xarray-style verbs for CSRLinearExpression and Grid methods
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 38/100
Línea de trabajo
Start with linopy/csr.py and inspect the methods on CSRLinearExpression and Grid, then trace their callers and existing tests. The issue leaves naming choices open, especially for with_const and the boundary with the public LinearExpression API. Done means an agreed naming scheme is applied consistently, with behavior unchanged and relevant tests passing.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
[!NOTE]
The following content was generated by AI.
Describe the feature you'd like to see
linopy/csr.py names the methods of CSRLinearExpression and Grid as past participles (summed, renamed, reindexed, ...). They return a new frozen object, never mutate. pandas and xarray use plain verbs for the same copy-returning operations (df.rename, da.reindex, fillna, ...), so the CSR layer diverges from the convention of the ecosystem linopy builds on.
Proposal: rename them to pandas/xarray-style verbs. Pure refactor, no behavior change.
| current | proposed |
|---|---|
CSRLinearExpression.summed(dims) |
sum(dims) |
aggregated(grid, rows) |
aggregate(grid, rows) |
renamed(names) |
rename(names) |
reindexed(grid, fill) |
reindex(grid, fill) |
filled(value) |
fillna(value) |
taken(rows, grid) |
take(rows, grid) |
added(other) |
add(other) |
scaled(factor) |
mul(factor) |
contracted(...) |
dot(...) |
pruned() |
prune() |
with_const(const) |
assign_const(const) (or keep) |
Grid.renamed / reordered / conformed / combined |
rename / transpose / conform / combine |
# today
expr._csr.aggregated(grid, rows).filled(0.0)
expr._csr.scaled(-1.0)
# proposed
expr._csr.aggregate(grid, rows).fillna(0.0)
expr._csr.mul(-1.0)
Trade-off to decide: LinearExpression already exposes the xarray verbs publicly. After the rename, expr.sum() and expr._csr.sum() share a name but differ in signature and semantics (e.g. the CSR sum takes a grid-level dim list and keeps explicit zero coefficients). The current participles keep the internal sparse layer visibly separate from the public dense API. The _csr attribute and the CSRLinearExpression type arguably mark that boundary well enough on their own.
- Lenguaje dominante
- Python
- Estrellas
- 260
- Forks
- 89
- Merge medio
- 1 d 1 h
- PR fusionados (30 d)
- 24
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PyPSA/linopy
-
bug solver interface
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
enhancement sparse
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
refactor sparse
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Meta: separate dense and sparse stores from the expression and constraint frontendPosiblemente ocupada @Rishabhkanhaiya la tomó hace 11 días. Abiertodiscussion refactor sparse
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
PyPSA/linopy#1019 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Xpress missing _license_probe: licensed_solvers includes xpress with an out-of-date licence, breaking local testsPosiblemente ocupada @FabianHofmann la tomó hace 20 días. Abiertobug solver interface
Dificultad 4/5 3-5 días Aptitud para principiantes 58/100
Los mantenedores suelen responder en 1 día
Todos los issues de PyPSA/linopy
Issues similares
-
comp/cli P3 type/security
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
NousResearch/hermes-agent#141420 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
vendor-pitch
Dificultad 2/5 1-3 horas Aptitud para principiantes 87/100
Los mantenedores suelen responder en 1 día
-
bug llm p2
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
amd/gaia#5379 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
New tool: ZIPZAX Python Notebook StudioPosiblemente ocupada @github-actions la tomó hoy. Abiertosubmission triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
kausalflow/tools#226 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100