-
Notifications
You must be signed in to change notification settings - Fork 17
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
misc fixes #159
misc fixes #159
Conversation
Fixes * Allow the HDF filename to be passed to main function instead of only io_manager instance. Having main only accept io_manager broke all ipython notebooks. * Removed "print(table)" from readUCI which I think was a debugging statement. IPython Notebook Fixes * Edited some of the ipython notebooks that tried to find an element time-series with an old name, for example tried to find "SURO" instead of the new name "SURO_sum". * Edited some of the ipython notebooks so that filenames were case sensitive. Deprecations * The append function is no longer available for DataFrames and changed to pd.concat form. * In pandas 3.0, to_hdf will require the "key" to be a keyword argument instead of a positional argument and made that change now to silence the deprecation message. Format * Removed trailing spaces from some files. * Fixed not a multiple of 4 spaces indentation in at least one file. * Renamed files with spaces in their names, replacing spaces with "_". Documentation * Additional edits to the README.rst. * Reshaped some docstrings into Numpy format.
I was sitting on these changes because I couldn't find solutions to two problems. So thought to put this in a pull request for review and maybe someone will be able to figure them out. Another reason to get this out there, is for the next two weeks or so I won't be able to work on this and I didn't want to slow progress down. "pytest" works to test the new PWATER and IWATER tests. They both pass. THE PROBLEMS:
|
pyproject.toml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timcera can we remove the ‘exclude’ line below since the includes are explicit? I think we can also drop the ‘where’ line too since ‘here’ is the default. Works great in my testing to be less explicit here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Now "import this" says explicit is better than implicit, just saying... 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am in complete agreement with the 'import this' philosophy, that's actually why I suggested removing all the extra over-constrained instructions with an explicit include, bc it leads to confusion to have lots of dead code in our packaging. no-ops should not exist in a pyproject.toml.
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
^this is the case against having extra params here, not for it 😅
subprocess.run(shlex.split("python3 -m build --wheel"), check=True) | ||
sdist = f"dist/{PKG_NAME}-{version}.tar.gz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this script run now? Sdist is still in the list below, so I’d expect it to throw. I think we should publish sdist, so I’d revert this line change and keep it in the twine iterator.
we should probably also rm all files in ‘dist’ similar to how we clear out ‘build’ too, right? If we are publishing from CI only, then this doesn’t matter, but if we are publishing from desktop then it matters a lot.
let’s make sure top level build and dist are in gitignore (I think they are) and do a full clean of those folders via this script before publishing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I'll remove sdist from the list. I probably keep the loop and revisit adding sdist later. I'll push a commit in a bit...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About removing all file in "dist". I don't automatically remove with my own packages and it hasn't proven to be a problem. After a while they might stack up and I remove by hand just to clean things up. This script is really just a convenience for the couple of developers that would publish to PyPI. Probably should find another directory for it to make it less visible? That is something that I thought could wait.
|
||
from HSP2.main import main | ||
from HSP2.mainDoE import main as mainDoE | ||
from HSP2.utilities import versions, flowtype | ||
from _version import __version__ | ||
|
||
__version__ = version("hsp2") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL importlib
judo. this is a nice solution.
I can make the shift to a "src/hsp2/..." package tonight that was talked about in #157. |
We should let @PaulDudaRESPEC catch up on merging some of these PR's and/or asking you or I to rebase our already open PRs before we go ahead and change literally every file in the project. Also @rburghol has significant WIP that we should consider helping to support integrating before making major refactoring changes. @PaulDudaRESPEC This is where an order of operations and/or roadmap with a todo list would help, otherwise we'll end up constantly overwriting each other and working on the same things in parallel. Also, we should temporarily disable the conda github action -- it never completes. |
Fine by me. |
@timcera is this PR otherwise ready to merge in your opinion? If so, i'll rebase mine on this one, and @PaulDudaRESPEC can work the backlog a bit so we can all get the benefit of the improvements you've made here. Thank you! |
Depends. Still have the two problems that I mentioned in the second comment. In terms of git repository management it might be best to get this one merged and then address those problems in a separate pull request. Up to @PaulDudaRESPEC on path forward. |
@timcera i agree, let’s merge this and move on of your only issues are in the ./tests dir. tests are probably due for a refactor anyway so that they work with pytest. @PaulDudaRESPEC looks like this is blessed by Tim and ready for review & merge into dev |
@timcera , I've got some helpful info to share... With regard to problem 1, Test05 only runs PERLND, not IMPLND or RCHRES, so I don't think that is a concern. As for problem 2, I see an issue with the recent changes to readUCI.py. At line 88 in fix_df, we've gone to using concat instead of append, but the new way of doing it with concat is not equivalent to the old append. In this case concat is adding a new column to the df, where append was adding a new row. I reproduced the error, changed it back to the old way, and the old way worked. I don't see what the appropriate fix is moving forward, but I think it will be helpful to point this out. |
I got Test10 to run to completion using this code by @timcera and it matches what I believe to be the correct output values, but not without fixing a few things down in OXRX_class.py. It seems previous versions didn't have a problem with sending undefined variable names into RQUAL if those variables were never used, but now I see it triggering an error. So I've modified OXRX_class.py and will commit my changes to develop where I explicitly declare these variables. |
…s with undefined variables, as noted in PR #159.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pin pandas<2.0 to defer refactoring all the df.append() calls. If this project installed clean as-is without pinning to <2.0, nothing can work since df.append()
has been removed.
df = df.append(Series(name=name1)) # add missing ids with NaNs | ||
if df.isna().any().any(): # replace NaNs with defaults | ||
df = pd.concat( | ||
[df, pd.Series(name=name1)], axis="columns" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong axis. old append does "Append rows of other to the end of caller," which is df.concat(other, axis='rows')
or just df.concat(other)
Fixes
IPython Notebook Fixes
Deprecations
Format
Documentation