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

Add a pyam.iiasa.platforms() function #829

Merged

Conversation

danielhuppmann
Copy link
Member

@danielhuppmann danielhuppmann commented Mar 4, 2024

Please confirm that this PR has done the following:

  • Tests Added
  • Documentation Added
  • Name of contributors Added to AUTHORS.rst
  • Description in RELEASE_NOTES.md Added

Description of PR

This PR adds a method pyam.iiasa.list_platforms() as a shorthand for the ixmp4 function down in the config hierarchy, producing an output like:

IIASA platform      Access    Notice

public-test         public    This is a public ixmp4 test instance hosted by the ... 
ecemf               private   
genie               public    This is a development instance for the GENIE knowle... 
ssp-extensions      public    
ecemf-internal      private   

5 total 

I modified this from the corresponding method in ixmp4 showing name, access level and notice (instead of dsn), because this seems more relevant for a Python-API-user.

@meksor, if you agree, I can implement the corresponding change in ixmp4?

Update

Renamed the function to pyam.iiasa.connections() to avoid naming conflict with the ixmp4 method.

@danielhuppmann danielhuppmann self-assigned this Mar 4, 2024
Copy link

codecov bot commented Mar 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.8%. Comparing base (666d49c) to head (5d65095).

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #829   +/-   ##
=====================================
  Coverage   94.8%   94.8%           
=====================================
  Files         64      64           
  Lines       6125    6144   +19     
=====================================
+ Hits        5810    5829   +19     
  Misses       315     315           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@meksor
Copy link

meksor commented Mar 4, 2024

Hm it would be useful to see if one is connecting via rest or sqlalchemy, maybe just showing the protocol part of the dsn?
Something like dsn.split('://')[0]

@danielhuppmann
Copy link
Member Author

Hm it would be useful to see if one is connecting via rest or sqlalchemy, maybe just showing the protocol part of the dsn?

My suggestion only refers to the attributes when connecting via the manager - the toml would still have the dsn.

@danielhuppmann danielhuppmann marked this pull request as ready for review March 4, 2024 14:27
Copy link
Contributor

@phackstock phackstock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge from my side, just two small comments

pyam/iiasa.py Show resolved Hide resolved
pyam/iiasa.py Show resolved Hide resolved
@danielhuppmann danielhuppmann changed the title Add a pyam.iiasa.list_platforms() function Add a pyam.iiasa.platforms() function Mar 4, 2024
@meksor
Copy link

meksor commented Mar 4, 2024

Ah I see, alright convinced!

@danielhuppmann danielhuppmann merged commit dc17880 into IAMconsortium:main Mar 5, 2024
14 checks passed
@danielhuppmann danielhuppmann deleted the iiasa/list-platforms branch March 5, 2024 07:44
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