Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Add setup.py to enable installation as idaes_examples namespace package #127

Closed
wants to merge 1 commit into from

Conversation

lbianchi-lbl
Copy link
Contributor

Resolves #126

Summary/Motivation

  • This PR adds a setup.py file making it possible to install this repository as a "proper" Python package
  • The main motivation behind this is being able to access files that are common to multiple examples/notebooks in a robust and consistent manner
  • In the current implementation:
    • Packages are located in pkg (to minimize conflicts/ambiguity with the existing src directory)
    • Only the hda and methanol Python files have been transferred (this choice was arbitrary and mostly done as a first pass for this draft)

To install

It should be enough to run pip install --editable . from the root of the repository (in addition to the other setup/installation steps). Note that this can conflict with existing examples directories obtained through idaes get-examples --local but I'm not sure how exactly this might manifest.

Open questions/before merging

  • Discuss package structure/import paths, e.g. if we want to use from idaes_examples.common.hda.flowsheet import ... or from idaes_examples.hda.flowsheet import ... or some other alternativve
  • Ensure that all the files required by the PRs that need this capability are included here
  • Update the corresponding import paths in the affected notebooks
  • Update CI workflows
  • Update README and other documentation

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@lbianchi-lbl lbianchi-lbl added the Priority:High High Priority Issue or PR label Aug 22, 2022
@lbianchi-lbl lbianchi-lbl self-assigned this Aug 22, 2022
Copy link
Contributor

@bpaul4 bpaul4 left a comment

Choose a reason for hiding this comment

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

I pulled this branch locally and installed the new package, and the methanol notebook works well with the updated import paths. Great work, @lbianchi-lbl ! I'm happy to push my local changes that implement the needed methanol notebook updates.

There are newer versions of the HDA notebooks that fix some deprecation and other warnings, and improved versions of the HDA property packages in #124, I can assist with cleanup and updating files where needed. My suggestion is to put the HDA files back and only move the methanol ones in this initial draft to avoid conflicts.

@ksbeattie
Copy link
Member

Replaced by #137

@ksbeattie ksbeattie closed this Sep 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Priority:High High Priority Issue or PR
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Enable site-packages installation to allow sharing Python modules with common functionality
3 participants