Skip to content

Introduction to packages#72

Merged
arm61 merged 10 commits intopythoninchemistry:masterfrom
glass-w:packages-intro
Jun 16, 2020
Merged

Introduction to packages#72
arm61 merged 10 commits intopythoninchemistry:masterfrom
glass-w:packages-intro

Conversation

@glass-w
Copy link
Copy Markdown

@glass-w glass-w commented Jun 12, 2020

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
Copy link
Copy Markdown
Contributor

arm61 commented Jun 15, 2020

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:

  • "unweildy" -> "unwieldy"
  • "elements.py" -> "print_things.py"
  • Include an example of _ syntax in imports cause it isn't immediately clear how it would be used.

@glass-w
Copy link
Copy Markdown
Author

glass-w commented Jun 15, 2020

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
Copy link
Copy Markdown
Contributor

arm61 commented Jun 15, 2020

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
Copy link
Copy Markdown
Author

glass-w commented Jun 15, 2020

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.

@arm61 arm61 mentioned this pull request Jun 15, 2020
@glass-w
Copy link
Copy Markdown
Author

glass-w commented Jun 15, 2020

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

@arm61
Copy link
Copy Markdown
Contributor

arm61 commented Jun 15, 2020

Comments:

packages.ipynb

custom_modules.ipynb

  • add an example usage of the _ in import
  • I would maybe, instead of getting into mentioning the PYTHONPATH and potentially getting into that hellscape, say that if you install with a package manager you can import these packages and packages in the CWD, then link to the later (custom packages)[https://pythoninchemistry.org/intro_python_chemists/advanced/custom_packages.html] section.

@glass-w
Copy link
Copy Markdown
Author

glass-w commented Jun 15, 2020

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

packages.ipynb

custom_modules.ipynb

  • Added example use of _ usage and updated print_things.py module.
  • Removed reference to PYTHONPATH and linked to custom packages.

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

@glass-w
Copy link
Copy Markdown
Author

glass-w commented Jun 15, 2020

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
Copy link
Copy Markdown
Contributor

arm61 commented Jun 16, 2020

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 arm61 merged commit 482fb4b into pythoninchemistry:master Jun 16, 2020
@arm61
Copy link
Copy Markdown
Contributor

arm61 commented Jun 16, 2020

I will merge now, looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants