This document contains the shared notes activities, some direct identifiers have been removed.
What programming language(s) are you normally working with (add an o for your answer):
What does testing your code mean for you? How do you test?
:::info
Exercise Local-1: Set up the example and test, run it and break it to see what happens :::
Questions about the exercise:
in my case the test didn't pass
Done in shell (content removed after issue was fixed). 1. I passed the first 3 tests. But I could not catch up with the rest of the exercises because I had to travel. I'll try to continue during lunch break. :-) 2. Update: I successfully ran the tests (3 passed, 1 failure & 2 passed). QUESTION: what is better, conda or .venv? So, I am trying to re-run the tests in Colab now, both with conda and .venv. [Off topic: why am I thinking of running the tests on qBraid now?] --> Existential question: is it better to learn shell coding or else, and why? PS: I am using Duck.ai as assistant now (it's a nice surprise), and interestingly it understands its own failures and is kind of good at ´self-reasoning´. I am trying to refine my prompt engineering skills and train it to understand both chain-of-thoughts (human-user limitations and model limitations/failures), but I am not very satisfied to be honest. It would be cool to kind of see who learns faster, me or the model/s. Wild, innit? I hope the lecturers won't get shocked. My approach could be useful for educational purposes for newbies or stuff. CAN SOMEONE PLEASE TELL ME IF I WAS SUPPOSED TO DO FURTHER TESTS? Sorry for disrupting. By the way, if AI models will become good enough to teach people how to learn programming, will all lecturers be soon jobless? :-) Kidding. I like to add some suspence/thrill at times.
pytest -v example.py)pytest -v example.py
bash: pytest: command not found...
Failed to search for file: GDBus.Error:org.freedesktop.DBus.Error.NameHasNoOwner: Could not activate remote peer.
conda activate coderefinery, and thenpytest -v example.py works?
nothing works unfortunately, whites files not found
failed to search for file: GDBus.Error:org.freedesktop.DBus.Error.NameHasNoOwner: Could not activate remote peer.
conda activate coderefinery, do you see (coderefinery) on the next line? (does the env gets activated?) Also try running ls example.py, check that you can read the file and it looks okay, please.I suspect that something is wrong/missing with the conda environment. You could just try running test without the envrironment (python3 -m pytest -v example.py). Otherwise, check that the 'coderefinery' environment exists, deactivate, activate again maybe? Sorry, a bit hard to help with this without seeing your machine... If you have a local IT person, I would ask them for help with this :)
Are you on Linux/Mac? If so, did you do the 'source'? (https://coderefinery.github.io/installation/conda/#activating-the-software-environment)
ok, i will do, thanks
I used a Colab notebook, added %%writefile example.py at the start, then next cell !pytest -v example.py and test gave a pass OK. Colab maybe not the ideal environement for this, but can't do better now. Is the result realiable?..
Which would be the best/ideal environment please? I also was thinking about Colab and simply Shell.
so this comes from my environment, not from anywhere else: I assume this is the descripton of the colab env: platform linux -- Python 3.13.15, pytest-8.4.2, pluggy-1.6.0 -- /usr/bin/python3 // cachedir: .pytest_cache rootdir: /content plugins: anyio-4.15.1, typeguard-4.6.0, // langsmith-0.12.5
Yes, all the output is the specifications of the google colab cloud environment (your session)
I tried to define floats in Python, but did not find a way, like in C/C++, is there a way at all?
float()). If you are defining it as the input of a function, you could explicitely declare the type (I think it is called type annotation), but this is not needed.what is this? "Design-2 / Solution: # What does this last test tell us? assert count_word_occurrence_in_string('AAAAA', 'AAA') == 1" > because AAAA does not include whole word (space)AAA(space)? shouldn't that be == 0?
:::info
-> https://coderefinery.github.io/testing/test-design/#pure-and-impure-functions
Design-1 - 5 , try whichever exercise you are interested in , you can also try 7-10, but they are a little more complex :)
Design 6 will be demonstrated after the break
:::
Your questions here:
With the test examples is it possible to add some fortran examples?
What is the github actions tab for? I haven't seen or worked with it before
:::info
Try out exercise CI-1- Create and use a workflow on GitHub or a pipeline on GitLab
:::
Questions continued:
We will continue with modular code development after a one hour break. Please let us know how this session felt for you, by adding a o for your answer below.
This automated testing session was:
too fast:o too slow: right speed:oo too slow sometimes, too fast other times:ooo too advanced: o too basic: right level:o I will use what I learned in this session:ooo I would recommend this session to others:oo I would not recommend this session to others:o
Anything else you would like to say about this session:
:::info
Look at the starting point and think about what you would do to improve the code.
If you want you can clone the code: https://github.com/coderefinery/modular-type-along-exercise
:::
Your questions here:
We have to start testing this notebook?
Where are the notes from earlier today? They seem to have disappeared. +1
Too fast, I just cannot keep the pace on github. Would be lovely to have a documentation of how the lecturer is moving on github. I did not understand anything. What are we doing? We were supposed to clone or fork the repository. But I totally lost all the next steps. And I don't know how to connect github to Coderefinery either.+1 Now I am somewhere on crisp, my God (I am looking for the Coderefinery thing on github but I didn't manage to literally see what the lecturer did). +1
The same to me, very quick +1
Please, explain what we are goingh to do, we check in the local directory that test are working, should we do it in the repository?
What is the AIM?
There is np clear aims, steps +1
The script shall be run on shell or shall we opt for the github repository option. And if the latter, how do we proceed with integrating it with Coderefinery etc? I give up. I will ask an AI assistant to help me have both options set up. I don't know even how to start. It's pointless to follow the rest at this point. After trying to clone the repository you gave us, I ended up here somehow:
. Can you please help me understand the Coderefinery whatsoever integration on Github once we clone the repository? --> I got it, the Coderefinery option is not available (for me). Thanks.
Is this correct?
Follow along locally or watch. If you would like to run the exercise on your own computer, clone the example repository:Weather analysis exercise repository. In a terminal, run:
git clone https://github.com/coderefinery/weather-analysis-exercise.git
cd weather-analysis-exercise
conda activate coderefinery
As far as I understood, the best approach is to work locally (I just panicked because I did not understand that the Coderefinery option on Github was available just to the lecturer - How can we get access to this integration btw?). I actually was able to get the plots on Colab as well after all. (Colab could be useful since it combines Gemini - although I do not trust that much Gemini for coding yet).
Please do not give up. Lean back and watch what the instructors are doing. In general the idea is that we have an example code and want to make it more modular. There are many ways to do that so the instructors are chosing steps and implementing them on stream. Right now they are working in a python file and work on introducing functions to not write duplicate code for different inputs
To follow along with the history : https://github.com/coderefinery/weather-analysis-exercise/tree/main
:::warning Sorry, we lost some of the notes, please ask again if something is unclear below :heart: But please know that this is also the ideal time to lean back and watch. You can try by yourself outside of the workshop and we are happy to help with any issued that are coming up also then via support@coderefinery.org :::
Read more about encapsulation
:::success In the morning we covered automated testing and modular code development in the afternoon. Modulare code development lesson is the place where everything learned in the workshop comes together. If it went all a bit to fast, please know that we have the recordings available on YouTube in a bit (and you can re-watch on twitch still for 7 days). Feel free to come back to it and try yourself also outside of the workshop; contact support@coderefinery.org if you have any open questions. One possibe solution on making the code more modular can also be found here: https://coderefinery.github.io/modular-type-along/solution/
You can find all links from the concluding remarks here: https://github.com/coderefinery/workshop-outro :::
o) for all that apply):too fast:o too slow: right speed:oooo too slow sometimes, too fast other times:o too advanced:ooo too basic: right level:oo I will use what I learned today:ooo I would recommend today to others:oo I would not recommend today to others:o
maybe better to inform beforehand that we need some background knowledge about working with git repo and bash command
Free courses and certifications for modularity?
Just: Thanks a lot :D
Excellent work all - you made me learn a lot! Thanks a million!!!
I need to get an affiliation finally! Adopt me! :)
welldone everyone
Just a note for the lecturers: I could not attend most of the previous sessions except yesterday and today. It means, I will have to wait until all the sessions will be uploaded on YT basically. I had multiple webinars and courses overlapping, and other circumstances that made it impossible to properly follow the entire course. So, to conclude, I don't consider the speed of this lecture inappropriate nor the level of the webinar unreachable. (Do I remember correctly? All sessions will be uploaded on YT?)
Great work all - in some cases I would prefer the online discussion option, as sometimes you just drop out during the 6 days and takes a lot of time to try the excercises by your own, or a help line (Zoom or Teams channel that you might be able to call would be helpful.) You would more easily get back to do the real thing. Thank you all.
I'll propose some further improvement/s to the code after all (via github). Please provide feedback. :-)