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

Rename 'report', 'util' + miscellaneous clean-ups #500

Merged
merged 37 commits into from Nov 21, 2023
Merged

Conversation

khaeru
Copy link
Member

@khaeru khaeru commented Nov 14, 2023

  • Use preferred module names per message-ix-models and genno:
  • Provide .util.DeprecatedPathFinder to support imports from the previous locations and raise deprecation warnings.
  • Improve documentation:
    • Address >100 Sphinx "nitpicks"—missing or unresolveable references, typos, errors, etc.; mainly in old code, identified with make SPHINXOPTS="-n" html.
    • Add .. automodule:: ixmp for the top-level module; this allows other projects to link to :mod:'ixmp' directly via intersphinx.
    • Add a documentation page for the command-line interface.
    • Update documentation links to genno.Computer and genno.operator.
  • Close Adjust for mypy --no-implicit-optional #465.
  • Close error in read_sol_from_gdx #98.

Items related to TODOs and FIXMEs in message_ix, message-ix-models, and message_data:

  • Add the reporting operators from_url(), get_ts(), and remove_ts() (currently in message-ix-models).
  • Close Add indexed_by= arg to Scenario.par_list() etc. #402.
  • Add a CLI command "ixmp platform copy"; currently sits downstream in message_data.model.transport.cli here.
  • Update JDBCBackend to handle some work-arounds that currently sit downstream:

Miscellaneous housekeeping:

How to review

  • Read the generated docs:
    • Ensure the migration notes are clear.
    • Look for missing links or content.
  • Note the CI checks all pass.
  • Run downstream (message_ix, message-ix-models, message_data) test suites; confirm tests pass and appropriate warnings are raised.

PR checklist

  • Continuous integration checks all ✅
  • Add or expand tests; coverage checks both ✅
  • Add, expand, or update documentation.
  • Update release notes.

@khaeru khaeru added enh New features & functionality docs Documentation, tutorials, etc. reporting Post-processing of model results labels Nov 14, 2023
@khaeru khaeru added this to the 3.8 milestone Nov 14, 2023
@khaeru khaeru self-assigned this Nov 14, 2023
- Rename .report.computations → .report.operator.
- Adjust some usage/references.
- Warn about imports from deprecated/old module names.
- Preserve backwards-compatible imports downstream.
- Consistent with the rest of the message_ix stack.
- Add to DeprecatedPathFinder.
- Adjust references to satisfy mypy.
- :class:`Foo` → :class:`.Foo`.
- Don't use vague names ("array").
- Type with Literal[...] to make fixed values explicit.
- Expand testing.__all__.
- Patch outdated references in RELEASE_NOTES for usability.
- Update Sphinx configuration:
  - napoleon_process_types to handle "optional", literals.
  - napoleon_type_aliases.
  - nitpick_ignore_regex.
  - rst_prolog - add :py:`…` role
  - intersphinx_mapping - add 5 packages.
- Miscellaneous others.
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

Merging #500 (a8819d1) into main (f419427) will increase coverage by 0.3%.
The diff coverage is 100.0%.

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #500     +/-   ##
=======================================
+ Coverage   98.5%   98.8%   +0.3%     
=======================================
  Files         42      44      +2     
  Lines       4554    4747    +193     
=======================================
+ Hits        4489    4694    +205     
+ Misses        65      53     -12     
Files Coverage Δ
ixmp/__init__.py 100.0% <100.0%> (ø)
ixmp/_config.py 96.7% <100.0%> (ø)
ixmp/backend/__init__.py 100.0% <ø> (ø)
ixmp/backend/base.py 100.0% <100.0%> (ø)
ixmp/backend/io.py 98.5% <100.0%> (ø)
ixmp/backend/jdbc.py 97.2% <100.0%> (+1.9%) ⬆️
ixmp/cli.py 100.0% <100.0%> (ø)
ixmp/core/platform.py 98.9% <100.0%> (ø)
ixmp/core/scenario.py 98.3% <100.0%> (+0.4%) ⬆️
ixmp/core/timeseries.py 98.7% <100.0%> (ø)
... and 21 more

@khaeru khaeru linked an issue Nov 14, 2023 that may be closed by this pull request
ixmp_source insists on particular idx_sets/idx_names for some
MsgScenario items, for instance COST_NODAL. But
MsgScenario.initializeVar() fails to initialize the item if *any*
idx_sets/idx_names are given—even the correct ones.

This change allows Scenario.init_var() to accept the correct values. In
this case it silently discards matching values. If non-matching values
are given, it raises a Python (rather than Java) exception.
- Add Scenario.item_list(), Scenario.has_item().
- Use these to provide Scenario.*_list(), Scenario.has_*().
@khaeru khaeru changed the title Rename 'report', 'util'; update docs Rename 'report', 'util' + miscellaneous clean-ups Nov 16, 2023
Use protect_rename_dims fixture.
- This avoids other modules getting a module-specific global also named
  RENAME_DIMS, that may be out of sync with the common one.
- Preserves behaviour downstream in message_ix and message-ix-models.
- Absolute imports ("from ixmp.report import common") MUST be used; a
  relative "from . import common" does not work.
- Checking and sanitizing user input is the task of the front-end.
- Consolidate Scenario.init_*() methods, parallel to has_*, *_list.
khaeru added a commit to iiasa/message_ix that referenced this pull request Nov 17, 2023
@khaeru khaeru mentioned this pull request Nov 17, 2023
4 tasks
khaeru added a commit to iiasa/message_ix that referenced this pull request Nov 17, 2023
khaeru added a commit to iiasa/message_ix that referenced this pull request Nov 17, 2023
khaeru added a commit to iiasa/message_ix that referenced this pull request Nov 17, 2023
- Add a context-manager form of .jdbc._raise_jexception.
@khaeru khaeru merged commit 6cab755 into main Nov 21, 2023
18 checks passed
khaeru added a commit to iiasa/message-ix-models that referenced this pull request Nov 22, 2023
- Import RENAME_DIMS through a function that provides backwards
compatibility.
- Use MESSAGE.items and MACRO.items; remove redefinitions.
- Simplify simulate_qty() to accept a list of dimensions directly.
khaeru added a commit to iiasa/message-ix-models that referenced this pull request Nov 22, 2023
- Import RENAME_DIMS through a function that provides backwards
compatibility.
- Use MESSAGE.items and MACRO.items; remove redefinitions.
- Simplify simulate_qty() to accept a list of dimensions directly.
khaeru added a commit to iiasa/message-ix-models that referenced this pull request Nov 22, 2023
- Import RENAME_DIMS through a function that provides backwards
compatibility.
- Use MESSAGE.items and MACRO.items; remove redefinitions.
- Simplify simulate_qty() to accept a list of dimensions directly.
khaeru added a commit to iiasa/message-ix-models that referenced this pull request Nov 22, 2023
- Import RENAME_DIMS through a function that provides backwards
compatibility.
- Use MESSAGE.items and MACRO.items; remove redefinitions.
- Simplify simulate_qty() to accept a list of dimensions directly.
khaeru added a commit to iiasa/message-ix-models that referenced this pull request Nov 23, 2023
- Import RENAME_DIMS through a function that provides backwards
compatibility.
- Use MESSAGE.items and MACRO.items; remove redefinitions.
- Simplify simulate_qty() to accept a list of dimensions directly.
@glatterf42 glatterf42 deleted the enh/report-2023-W45 branch December 14, 2023 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation, tutorials, etc. enh New features & functionality reporting Post-processing of model results
Projects
None yet
1 participant