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

Examples for unstable appear first at GitHub #1156

Open
p-snft opened this issue Feb 17, 2025 · 4 comments
Open

Examples for unstable appear first at GitHub #1156

p-snft opened this issue Feb 17, 2025 · 4 comments

Comments

@p-snft
Copy link
Member

p-snft commented Feb 17, 2025

Ah I see! So my issue was that I was using examples which were for a newer version of OEMOF compared to the version of OEMOF I had installed?

Originally posted by @RobSisson in #1155 (comment)

@p-snft
Copy link
Member Author

p-snft commented Feb 17, 2025

One issue is that the example still tells (in the docstring) that it is for solph 0.5.x but it is for 0.6.x.

Now, I rely on feedback: Is it really caused by the wrong docstring or didn't you read it anyway? If so, should we put something like assure_solph_version("0.6") into the executable code that will fail with a proper error message if run?

Possible steps (some may be combined):

  1. Update docstrings to name correct version.
  2. Remove named version in docstring. (Update might be forgotten again).
  3. Tell/check version in executable code. (Will fail if incompatible.)
  4. Set default branch at GitHub to master. (Will present examples of released versions more prominent.)

Just that I don't forget. A simple implementation of a version check might work like this:

def assure_solph_version(version_string: str) -> None:
"""
Tests given version string against the version of the presently installed version of solph.
"""

    solph_version = solph.__version__[:3]
    if solph_version != version_string:
        raise (RuntimeError(f"Unsupported version of solph: {solph_version}"))

assure_solph_version("0.6")

@RobSisson
Copy link

I see, adding assure_solph_version would be really helpful!

I just cloned the default branch (which is dev) but had the stable version of OEMOF installed but retrospectively I should've been more scrupulous to check versions.

Perhaps, in addition to adding the assure_solph_version function we could improve the read-me when discussing examples a little so it reads something more like this?

Example Applications
The combination of specific modules (often including other packages) is called an application (app). For example, it can depict a concrete energy system model. You can find a large variety of helpful examples in the documentation. The examples show the optimisation of different energy systems and are supposed to help new users understand the framework's structure.

When using the example applications, be sure to use the correct version of the examples with the version of OEMOF you have installed.

Stable Branch Examples - requires OEMOF 0.5
Dev Branch Examples - required OEMOF 0.6

You are welcome to contribute your own examples via a pull request or by e-mailing us (see here for contact information).

And maybe adding a page in the documentation around this in more detail would be useful, including the set up for both stable and dev branches with the properly install and clone commands.

@RobSisson
Copy link

Also in terms of the other edits I made in the pull request, namely

Removed duplicated "investment_nonconvex": False, in test_nodes_with_none_exclusion_old_name and test_nodes_with_none_exclusion in test_processing.py
Added openpyxl to optional dependencies (required for dispatch.py)

Are they also versioning issues?

@p-snft
Copy link
Member Author

p-snft commented Feb 24, 2025

Also in terms of the other edits I made in the pull request, namely

Removed duplicated "investment_nonconvex": False, in test_nodes_with_none_exclusion_old_name and test_nodes_with_none_exclusion in test_processing.py
Added openpyxl to optional dependencies (required for dispatch.py)

Are they also versioning issues?

I didn't see any problems like these in a consistent v0.6 environment, so I think they are.

PS: We decided to have an AUA at the dev meeting. If you like to join, you can find it in the oemof calendar.

PPS: I shortly mentioned versions in the readme. Thanks for the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants