python project management - #43
Conversation
GreatEmerald
left a comment
There was a problem hiding this comment.
Thanks, some points to revise here. I couldn't see all the changes due to the newlines change, which should be reverted anyway (see below).
| This is why, at least in Bash and R, it is recommended to first look at the built-in documentation, instead of trying to look it up online. | ||
| In addition, online sources sometimes provide a workaround but not a real solution to the problem. | ||
| And, of course, some of the solutions may be outright wrong and not work for you. | ||
| Whichever online source you use, you need to be critical about the information you find on the internet. Some of the information you find may refer to older versions of the software than what you are using, resulting in a mismatch. This is why, at least in Bash and R, it is recommended to first look at the built-in documentation, instead of trying to look it up online. In addition, online sources sometimes provide a workaround but not a real solution to the problem. And, of course, some of the solutions may be outright wrong and not work for you. |
There was a problem hiding this comment.
This is the wrong style of formatting. We want each sentence on a new line. Otherwise looking at git diffs is a matter of finding a needle in a haystack...
| But how do we know *how* and *what* to write in the first place? Even the most experienced programmers run into these questions, so it's important to know how to find answers to them. | ||
|
|
||
| There are many places where help can be found on the internet. So in case the documentation is not sufficient for what you are trying to achieve, a search engine like Google is your best friend. Most likely by searching the right keywords relating to your problem, the search engine will direct you to online documentation, a tutorial, or to some discussions on [Stack Exchange](https://stackexchange.com/). It is quite likely that the problem you are trying to figure out has already been answered before, and using these resources you should be able to solve your particular problem as well. | ||
| There are many places where help can be found on the internet. So in case the documentation is not sufficient for what you are trying to achieve, a search engine like Google is your best friend. Most likely by searching the right keywords relating to your problem, the search engine will direct you to online documentation, a tutorial, or to some discussions on [Stack Exchange](https://stackexchange.com/). Nowadays search engines even use return preliminary AI generated answers. It is quite likely that the problem you are trying to figure out has already been answered before, and using these resources you should be able to solve your particular problem as well. |
There was a problem hiding this comment.
| There are many places where help can be found on the internet. So in case the documentation is not sufficient for what you are trying to achieve, a search engine like Google is your best friend. Most likely by searching the right keywords relating to your problem, the search engine will direct you to online documentation, a tutorial, or to some discussions on [Stack Exchange](https://stackexchange.com/). Nowadays search engines even use return preliminary AI generated answers. It is quite likely that the problem you are trying to figure out has already been answered before, and using these resources you should be able to solve your particular problem as well. | |
| There are many places where help can be found on the internet. So in case the documentation is not sufficient for what you are trying to achieve, a search engine like Google is your best friend. Most likely by searching the right keywords relating to your problem, the search engine will direct you to online documentation, a tutorial, or to some discussions on [Stack Exchange](https://stackexchange.com/). Nowadays, search engines often even provide you with preliminary AI generated answers. It is quite likely that the problem you are trying to figure out has already been answered before, and using these resources you should be able to solve your particular problem as well. |
| Some of the code completion tools: | ||
|
|
||
| * [GitHub Copilot](https://github.com/features/copilot) - GitHub AI, you get more free credit if you get the Education Pack from GitHub. Integrated into most IDEs. | ||
| * [GitHub Copilot](https://github.com/features/copilot) - GitHub AI, you get more free credit if you get the Education Pack from GitHub. Integrated into most IDEs. |
There was a problem hiding this comment.
Why the extra space at the end?
| RStudio is cross-platform and open-source. | ||
| It comes in two types: *RStudio Desktop* is a regular desktop app, and *RStudio Server* is meant for running on a remote server, to which you can connect through your web browser. | ||
| Interestingly enough, the desktop version is in fact just *RStudio Server* running locally, with an integrated web browser based on *Google Chrome*. | ||
| Posit recently released a new IDE called positron. Although posit does not say it definitively and they will keep maintaining RStudio, new features will be [primarily implemented](https://positron.posit.co/faqs.html) in Positron |
There was a problem hiding this comment.
We need to expand this quite a lot more, and reduce RStudio info. We should already think about how this will look like next year, so we don't need to update it again.
| * As we will be working with multiple languages throughout this course, we will keep things organized by placing scripts in a directory per language. | ||
| * For R and Bash we will use the directories `R/` and `Bash/`. These directories should contain functions you have defined as part of your project. | ||
| * In python functions are stored in a directory with a name relevant to the project. For example when working on flood mapping, you would put functions in a directory called `floodmapping`. For smaller projects (< 5) functions, all functions can go in 1 script. For bigger projects functions are stored in multiple files, split by functionality. More on python project organization see the [Hitchhiker's guide to Python](https://docs.python-guide.org/writing/structure/#structure-of-code-is-key). | ||
| * Functions should be as generic as possible and are imported and called by the `main` script. In R you would write `source(R/myFunction.R)`, in python you would write `from floodmapping import *` |
There was a problem hiding this comment.
Is that really what we want to teach students here? I would think it's better to say that in Python you would do import floodmapping (optionally as fm) and then use floodmapping.myFunction().
|
|
||
| # Import functions | ||
| import Python.download as download | ||
| # The "as download" part is used to scode functions. In this example, we can distinghuish our own implemented download functions from other functions called download_data |
There was a problem hiding this comment.
This comment is not very clear.
No description provided.