-
Notifications
You must be signed in to change notification settings - Fork 43
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
Second attempt for easily accessible dependencies #1961
Second attempt for easily accessible dependencies #1961
Conversation
ready for testing on OSX |
@Caddy-Jones: can you please take a look on these warnings apparently causing Jenkins build failure. Note that you need to checkout new branch becuse of (re)reverting...
|
module_versions_dict = {'python': sys.version, 'SasView': sas.sasview.__version__} | ||
unattainable_modules = [] | ||
# Generate a list of standard modules by looking at the local python library | ||
standard_lib = [path.stem.split('.')[0] for path in pathlib.Path(pathlib.__file__).parent.absolute().glob('*')] |
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.
You can combine the standard lib packages, the builtin packages and sas into a single set. This simplifies the test in the loop:
standard_path = pathlib.Path(pathlib.__file__).parent.absolute()
standard_lib = {path.stem.split('.')[0] for path in standard_path.glob('*')}
standard_lib.update(sys.builtin_module_names)
standard_lib.add('sas') # include 'sas' as standard lib
Note that this will not do what you want in the shipped application because pathlib may be in a zip file instead of on the disk. It may even fail in the application since pathlib.__file__
might not be defined. This is why I suggested hard-coding the list rather than building it on the fly.
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.
Hi, so I've included your standard_path code in a try except block, with a hard coded list of bultin modules in the event that pathlib.file causes an error.
Could someone check if pathlib.file does indedd fail in the shipped application, as I would not know how to check.
If it does fail, then the list of builtin modules will probably have to be checked each time the python version SasView uses is updated.
May be worth having this list in an external file, making the job of updating the list easier?
installed_modules = {'python': sys.version} | ||
|
||
# Get python modules installed locally | ||
installed_modules_json = json.loads(subprocess.check_output("pip list -l --format=json")) |
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.
Fails for installed application.
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.
Pip fails?
Hi @wpotrzebowski, The errors appear to come from the titles I used in the docstrings, causing “WARNING: Unexpected section title.” I used the NumPy/SciPy Docstring format for the docstings in the PackageGatherer class. Is there a different docstring standard used by SasView? |
Coding standards for docstrings are here. We don't suggest (or follow) any particular style and there is wide variation across the project. So long as it works with sphinx it's okay. Instead of underlined |
Is there any way to add a new branch to this pull request for the code changes? If not i can set up a new PR |
@Caddy-Jones I think the easiest is to checkout this branch |
…ndencies' into easily_accessible_dependencies_2
Easily accessible dependencies 2
logging.error(f"{x} when attempting to access {mod} version using .version") | ||
pass | ||
else: | ||
continue |
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.
Same comment as above re: exception handling.
And to repeat, this will probably not do what you want.
Example
>>> h5py.version
<module 'h5py.version' from '/Users/pkienzle/conda/envs/py38/lib/python3.8/site-packages/h5py/version.py'>
Though in this case h5py.__version__
exists so you won't get here.
If you insist on keeping this clause at least check if isinstance(package.version, str)
.
Hi @pkienzle . Thanks for your feedback, the reason i included the .version check is because some modules, do not have a version attribute, and instead .version returns the version number. But i will include a check to see if the version number is a string or a float. |
…ndencies' into easily_accessible_dependencies_2
Responding to feedback
…ndencies' into easily_accessible_dependencies_2
Removing .version check
@wpotrzebowski will take a look on it |
ready for testing on OSX |
@Caddy-Jones you may consider fixing this one before we merge: |
Hi @wpotrzebowski , is there a way to test that the docstring is formated correctly? |
@Caddy-Jones I've just tested it by running docs build locally and looking for warnings (you can '-w' oprtion to build_sphinx.py to output warnings to file). |
Hi @wpotrzebowski , where am i supposed to run build_sphinx.py from, i keep getting errors with the script unable to find sasmodels. |
@Caddy-Jones you should be able to do python setup.py build docs from the sasview top level. Otherwise, look in \docs\sphinx-docs. But you have to build the sasmodels docs first. Go to sasmodels\doc and make clean html. |
Hi guys, I just cannot recreate the results @wpotrzebowski has gotten, can you give me the command line input you used please |
@Caddy-Jones I've pulled your branch and built the docs locally and I'm seeing the exact same doc error that @wpotrzebowski reports. I'm running Sphinx 1.8.4 (according to pip list). But nothing I've tried so far has fixed the error! :-( |
Apologies but I can’t seem to generate the sphinx documentation, anything I try gives me an error. Could somebody give me a step by step explanation of how to generate the documents, or point me to the location of such a thing. For example trying to do any make command gives me
setup.py build docs Isn’t an option for sasmodels, and doesn’t give me the results wojeck had for sasview, instead i get an error:
|
@Caddy-Jones : Go to your sasmodels repo. cd doc. make clean html. If make gives you an error then presumably you don't have it installed? Once the sasmodels docs are built, cd to your sasview branch and python setup.py build docs. The sasview doc build copies the built sasmodels docs to the sasview\docs\sphinx-docs\build folder. If all has worked you should then be able to cd \html and open index.html and navigate around the docs. If you're using an Anaconda environment, remember you have to activate the environment before doing any of this! :-) |
Thanks @smk78 , turns out make wasn't installed and there was an issue with my conda environment which prevented me from installing it. I've fixed the issue with the docstring so there hopefully should be no further issues |
Yes, I've just pulled your branch and re-made the docs and they pass compilation now. Good! |
ready for testing on OSX |
Follow up on #1903 that broke build and was reverted