Skip to content

Remove legacy code#129

Merged
spossann merged 30 commits into
develfrom
53-delete-all-legacy-code
Nov 24, 2025
Merged

Remove legacy code#129
spossann merged 30 commits into
develfrom
53-delete-all-legacy-code

Conversation

@max-models

@max-models max-models commented Nov 17, 2025

Copy link
Copy Markdown
Member

Solves the following issue(s):

This PR deletes 30% of Struphy 🔥

Closes #53

Before:

github.com/AlDanial/cloc v 2.07  T=1.60 s (305.3 files/s, 153523.9 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Python                         320          39591          44599         149587
YAML                            54            447            278           4116
reStructuredText                81           1565           1354           2000
Markdown                         6            242              0            661
INI                              3             36              0            212
TOML                             1             12              5            172
Dockerfile                       5             40             61            163
Jupyter Notebook                 1              0            158             79
Bourne Shell                     8             47            176             72
make                             3             25             38             61
Text                             3              0              0             34
DOS Batch                        1              8              1             26
CSS                              2              3              3              9
HTML                             1              0              0              4
-------------------------------------------------------------------------------
SUM:                           489          42016          46673         157196
-------------------------------------------------------------------------------

After:

github.com/AlDanial/cloc v 2.07  T=1.08 s (400.6 files/s, 173606.2 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Python                         263          31506          36248         106950
YAML                            54            447            278           4116
reStructuredText                81           1565           1354           2000
Markdown                         6            242              0            661
INI                              3             36              0            212
TOML                             1             12              5            172
Dockerfile                       5             40             61            163
Jupyter Notebook                 1              0            158             79
Bourne Shell                     7             43            176             61
make                             3             25             38             61
Text                             3              0              0             34
DOS Batch                        1              8              1             26
CSS                              2              3              3              9
HTML                             1              0              0              4
-------------------------------------------------------------------------------
SUM:                           431          33927          38322         114548
-------------------------------------------------------------------------------

Core changes:

  • Remove src/struphy/eigenvalue_solvers/
  • Remove testing of legacy code

Note: I tried to only remove the legacy struphy related lines in the tests, this means that there are still many lines remaining where psydac arrays are created, but not compared to anything.

@max-models max-models linked an issue Nov 17, 2025 that may be closed by this pull request
@max-models

Copy link
Copy Markdown
Member Author

What is your opinion on this? Should we remove the legacy code or not? @spossann

@spossann

Copy link
Copy Markdown
Member

What is your opinion on this? Should we remove the legacy code or not? @spossann

Remove!

@max-models

Copy link
Copy Markdown
Member Author

What is your opinion on this? Should we remove the legacy code or not? @spossann

Remove!

And for the unit tests comparing results with the legacy code, do we simply remove the comparisons? For example:

assert xp.allclose(val1, val_legacy_1)
assert xp.allclose(val2, val_legacy_2)
assert xp.allclose(val3, val_legacy_3)

@spossann

Copy link
Copy Markdown
Member

What is your opinion on this? Should we remove the legacy code or not? @spossann

Remove!

And for the unit tests comparing results with the legacy code, do we simply remove the comparisons? For example:

assert xp.allclose(val1, val_legacy_1)
assert xp.allclose(val2, val_legacy_2)
assert xp.allclose(val3, val_legacy_3)

Yes, let's see if we can come up with better tests than comparing to legacy, or if we even can remove some tests. We can have an overview from the diff once legacy (and asserts such as above) are removed.

@max-models

Copy link
Copy Markdown
Member Author

What is your opinion on this? Should we remove the legacy code or not? @spossann

Remove!

And for the unit tests comparing results with the legacy code, do we simply remove the comparisons? For example:

assert xp.allclose(val1, val_legacy_1)
assert xp.allclose(val2, val_legacy_2)
assert xp.allclose(val3, val_legacy_3)

Yes, let's see if we can come up with better tests than comparing to legacy, or if we even can remove some tests. We can have an overview from the diff once legacy (and asserts such as above) are removed.

Is everything in src/struphy/eigenvalue_solvers legacy?

@spossann

Copy link
Copy Markdown
Member

What is your opinion on this? Should we remove the legacy code or not? @spossann

Remove!

And for the unit tests comparing results with the legacy code, do we simply remove the comparisons? For example:

assert xp.allclose(val1, val_legacy_1)
assert xp.allclose(val2, val_legacy_2)
assert xp.allclose(val3, val_legacy_3)

Yes, let's see if we can come up with better tests than comparing to legacy, or if we even can remove some tests. We can have an overview from the diff once legacy (and asserts such as above) are removed.

Is everything in src/struphy/eigenvalue_solvers legacy?

yes

@spossann

spossann commented Nov 22, 2025

Copy link
Copy Markdown
Member

It seems he cache keys are not found: https://github.com/struphy-hub/struphy/actions/runs/19594704808/job/56117778007?pr=129eems

There are indeed cache access redtrictions. Mainly, cache is for a specific branch only. However, the main branch and the parent branch are also searched.

https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache

@max-models

Copy link
Copy Markdown
Member Author

Are PolarExtractionBlocksC1, PolarSplines_C0_2D, PolarSplines_C1_2D, and PolarSplines in src/struphy/polar/extraction_operators.py deprecated?

PolarExtractionBlocksC1 is used in the Derham class: https://github.com/struphy-hub/struphy/blob/devel/src/struphy/feec/psydac_derham.py#L406-L410

@spossann

Copy link
Copy Markdown
Member

Are PolarExtractionBlocksC1, PolarSplines_C0_2D, PolarSplines_C1_2D, and PolarSplines in src/struphy/polar/extraction_operators.py deprecated?

PolarExtractionBlocksC1 is used in the Derham class: https://github.com/struphy-hub/struphy/blob/devel/src/struphy/feec/psydac_derham.py#L406-L410

No, struphy/polar is not legacy code.

@max-models

Copy link
Copy Markdown
Member Author

Are PolarExtractionBlocksC1, PolarSplines_C0_2D, PolarSplines_C1_2D, and PolarSplines in src/struphy/polar/extraction_operators.py deprecated?
PolarExtractionBlocksC1 is used in the Derham class: https://github.com/struphy-hub/struphy/blob/devel/src/struphy/feec/psydac_derham.py#L406-L410

No, struphy/polar is not legacy code.

Ok, but they have a dependency of grad_1d_matrix, which is found in eigenvalue_solvers/:

def grad_1d_matrix(spl_kind, NbaseN):

I can restore derivatives.py

@spossann

Copy link
Copy Markdown
Member

All caches from devel are now available. Pipelines should be 20 to 30x faster 🙂

https://github.com/struphy-hub/struphy/actions/caches

@max-models

max-models commented Nov 22, 2025

Copy link
Copy Markdown
Member Author

All caches from devel are now available. Pipelines should be 20 to 30x faster 🙂

https://github.com/struphy-hub/struphy/actions/caches

Nice! This job didn't find any caches https://github.com/struphy-hub/struphy/actions/runs/19597024059/job/56122994683 So we can just restart it afterwards and it should be much faster.

Edit: Much faster now!

@max-models max-models marked this pull request as ready for review November 22, 2025 15:52
@max-models max-models requested a review from spossann November 22, 2025 15:52
@spossann spossann merged commit 93ed3fb into devel Nov 24, 2025
9 checks passed
@spossann spossann deleted the 53-delete-all-legacy-code branch November 24, 2025 20:34
@max-models

Copy link
Copy Markdown
Member Author

@spossann This feels so nice, right?

@spossann

Copy link
Copy Markdown
Member

@spossann This feels so nice, right?

Indeed!

max-models added a commit that referenced this pull request Mar 20, 2026
**Solves the following issue(s):**

This PR deletes 30% of Struphy 🔥

Closes #53 


[Before](https://github.com/struphy-hub/struphy/actions/runs/19582267477/job/56082877544):

```
github.com/AlDanial/cloc v 2.07  T=1.60 s (305.3 files/s, 153523.9 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Python                         320          39591          44599         149587
YAML                            54            447            278           4116
reStructuredText                81           1565           1354           2000
Markdown                         6            242              0            661
INI                              3             36              0            212
TOML                             1             12              5            172
Dockerfile                       5             40             61            163
Jupyter Notebook                 1              0            158             79
Bourne Shell                     8             47            176             72
make                             3             25             38             61
Text                             3              0              0             34
DOS Batch                        1              8              1             26
CSS                              2              3              3              9
HTML                             1              0              0              4
-------------------------------------------------------------------------------
SUM:                           489          42016          46673         157196
-------------------------------------------------------------------------------
```

After:

```
github.com/AlDanial/cloc v 2.07  T=1.08 s (400.6 files/s, 173606.2 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Python                         263          31506          36248         106950
YAML                            54            447            278           4116
reStructuredText                81           1565           1354           2000
Markdown                         6            242              0            661
INI                              3             36              0            212
TOML                             1             12              5            172
Dockerfile                       5             40             61            163
Jupyter Notebook                 1              0            158             79
Bourne Shell                     7             43            176             61
make                             3             25             38             61
Text                             3              0              0             34
DOS Batch                        1              8              1             26
CSS                              2              3              3              9
HTML                             1              0              0              4
-------------------------------------------------------------------------------
SUM:                           431          33927          38322         114548
-------------------------------------------------------------------------------
```

**Core changes:**

- [x] Remove `src/struphy/eigenvalue_solvers/`
- [x] Remove testing of legacy code

Note: I tried to only remove the legacy struphy related lines in the
tests, this means that there are still many lines remaining where psydac
arrays are created, but not compared to anything.

---------

Co-authored-by: Stefan Possanner <stefan.possanner@ipp.mpg.de>
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

Successfully merging this pull request may close these issues.

Delete all legacy code

2 participants