pythoninchemistry / intro_python_chemists

An open-source, online textbook introducing Python programming to chemistry students
https://pythoninchemistry.org/intro_python_chemists
BSD 3-Clause "New" or "Revised" License
24 stars 6 forks source link

Introduction to packages #72

Closed glass-w closed 4 years ago

glass-w commented 4 years ago

Makes a start on a general introduction to python packages and modules, addressing #14. Currently in good practice section but could be moved to basics.

arm61 commented 4 years ago

Hey @WG150,

It seems to me that as things stand, this is covering #15 more than #14. Are you still going to add the non-custom packages stuff. In my head, pip install numpy and import numpy as np comes before custom modules.

Anyway some comments on what we have here:

glass-w commented 4 years ago

Thanks for the comments @arm61

It seems to me that as things stand, this is covering #15 more than #14. Are you still going to add the non-custom packages stuff.

Yeah I think you're right, would it be worth combining #14 and #15 into one section or is it best to keep them separate? For the non-custom stuff: I have written a section on custom modules but do you mean covering packages not available on pypi?

In my head, pip install numpy and import numpy as np comes before custom modules

Good point, I can move things around so that these are introduced at the start. Also, is it worth covering Conda?

arm61 commented 4 years ago

I think keeping things separate makes more sense, I think that small accessible sections makes for easier reading. However, I do think that #15 should follow directly on from #14.

14 should cover installing and importing common packages (numpy, scipy, etc.) while #15 is you have written a .py file, here is how to use it in a notebook or another script (which is basically what you have in this PR).

My only worry with covering conda is that is muddies the water a bit, there is probably benefit to saying "pip is the most common way to install packages, however other methods such as conda exist" then link out to some documentation on conda. I am happy to have my mind changed on that though!

glass-w commented 4 years ago

Ok that sounds good to me, I've now pretty much covered #15 in this PR so I'll just make a new PR for that and change the content for this one addressing #14 (sorry for the confusion).

I agree about Conda, I think a short sentence or two to make the reader aware and pointing them to resources etc would be best.

glass-w commented 4 years ago

I've combined both #14 and #15 into this PR

arm61 commented 4 years ago

Comments:

packages.ipynb

custom_modules.ipynb

glass-w commented 4 years ago

@arm61 thanks, here's what I've done:

packages.ipynb

custom_modules.ipynb

I think it's almost ready now, let me know what you think.

glass-w commented 4 years ago

Incidentally I hardly use import scipy as sp, I tend to just use the modules directly. It'd be interesting to see what other users think / do?!

arm61 commented 4 years ago

I don't think I have ever import scipy or import scipy as sp, I am the same as you, e.g. from scipy import stats.

arm61 commented 4 years ago

I will merge now, looks good!