Skip to content

refactor: introduce naming conventions#1028

Merged
lkstrp merged 13 commits intoPyPSA:masterfrom
lkstrp:naming
Sep 26, 2024
Merged

refactor: introduce naming conventions#1028
lkstrp merged 13 commits intoPyPSA:masterfrom
lkstrp:naming

Conversation

@lkstrp
Copy link
Copy Markdown
Member

@lkstrp lkstrp commented Sep 9, 2024

Start to introduce common naming convention. This one changes all network (and related, like _parent) to n.

Since most of it is network object internal anyway, the API changes are pretty minor. But if the decorator is used, it's also backwards compatible with a DeprecationWarning.

If you agree and this is what you have in mind for a common naming conventions, next up is:

  • network -> n
  • sub_n, sn, sub -> sub_network
  • subnetwork (docs) -> sub-network
  • snapshots -> sns & snapshots in api
  • Component (class) -> c
  • component name (str), cls_name, class_name -> c_name
  • component list name (str), list_name -> c_list_name
  • variables representing attributes like p, q, p_nom -> attr
  • dataframe -> df
  • df -> static
  • pnl, varying, series etc -> dynamic

Feel free to add more

@FabianHofmann
Copy link
Copy Markdown
Contributor

love it ❤️

I always have the feeling that series is a bit confusing in context of pandas. I think I would prefer dynamic/varying instead

@fneum
Copy link
Copy Markdown
Member

fneum commented Sep 9, 2024

Yes, please! Agree with @FabianHofmann about “varying”

@lkstrp lkstrp changed the title refactor: naming convention network -> n refactor: introduce naming conventions Sep 10, 2024
@lkstrp
Copy link
Copy Markdown
Member Author

lkstrp commented Sep 25, 2024

@fneum @FabianHofmann
Again, quite a few changes, but nothing that touches too much API/functionality.

  • I have not yet changed the components. Would fix that in one go when we also point the component class to n.components (see Add active attribute to components #1038) in another pr.
  • n.df and n.pnl are not deprecated (yet), they are just aliases for the new names.
  • I will double check with pypsa-eur, but otherwise this is good to go.

@lkstrp lkstrp mentioned this pull request Sep 25, 2024
5 tasks
@lkstrp lkstrp merged commit cee5987 into PyPSA:master Sep 26, 2024
@lkstrp lkstrp deleted the naming branch September 26, 2024 12:39
cpschau pushed a commit to cpschau/PyPSA that referenced this pull request Sep 27, 2024
* refactor: naming convention `network` -> `n`

* refactor: naming `sub_network` and `sub-network`

* refactor: naming `df` -> `static`

* refactor: naming `dataframe` -> `df`

* refactor: naming `pnl` -> `dynamic`

* ignore linopy in type checking

* docs: add release notes

* fix: pre-commit

* make dataclasses more robust

* fix: missed pnl

* fix docs

* add some more deprecation decorators

* fix type ignore
lkstrp added a commit that referenced this pull request Oct 1, 2024
* draft generator constraint

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* extension by p_sum_min and p_sum_max

* refactor: introduce naming conventions (#1028)

* refactor: naming convention `network` -> `n`

* refactor: naming `sub_network` and `sub-network`

* refactor: naming `df` -> `static`

* refactor: naming `dataframe` -> `df`

* refactor: naming `pnl` -> `dynamic`

* ignore linopy in type checking

* docs: add release notes

* fix: pre-commit

* make dataclasses more robust

* fix: missed pnl

* fix docs

* add some more deprecation decorators

* fix type ignore

* add 4 kA high-temperature low-sag (HTLS) line type (#1046)

* add 4 kA high-temperature low-sag (HTLS) line type

Based on data from JAO Static Grid Model.

* Updated description in the user-guide: components.rst.

---------

Co-authored-by: bobbyxng <[email protected]>

* changed attribute name from p_sum to e_sum; added consistency check; added docstrings

* rename constraint function; add tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

Co-authored-by: Lukas Trippe <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add test with snapshots

* docstring and indexing

* resolve comments

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Lukas Trippe <[email protected]>
Co-authored-by: Tom Brown <[email protected]>
Co-authored-by: bobbyxng <[email protected]>
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.

3 participants