DEV Community


Lab 9: Now the world can automate status codes!

hyperthd profile image Abdulbasid Guled ・3 min read

Of course, assuming anyone is able to download my package and run it as intended. Emphasis on should

Anyway, for our final lab, we're to finally publish our release 0.1 to the world. This marks a actual first step since this means that anyone can download our package and use it as we intended for it to be. Exciting, but also scary. First, to iron out the final changes.

Last lab, I mentioned about the whole not working for me. Well, I found out why in this lab. It was because a main function is required to not take in any arguments when specified in the file, something my main function did. Therefore, I had to update the argparse portion into it's own separate function and return the args processed from there so that I could use them in the main function.

Process Args Function

I also had to move my main module into the src folder as mentioned in the Pypi guide I followed. I soon realized that I had to deal with the annoying problem I circumvented once and for all; The program not finding the "url_class" module I made. The solution: Use a try/catch block to try and import the module. Definitely not the cleanest bit of code, but it got the job done. Shoutout to Tim for this bit that I found from reading his blog:

Importing file in try/catch

I pushed my changes to github, then proceeded with making the tag. This allowed me to create an official release. This was as simple as using git tag in order to do so.

Lastly, I had to make an account on the Pypi website in order to register my project there. I made one really quickly, then installed twine which was needed to push the package there. I then use this command:

python -m twine upload --repository pypi dist/*

This command did the trick and my package was successfully uploaded.

Testing my own module, I had to use another environment. Luckily, I have python installed on my laptop which I used previously when I took the python pro option courses available in the summer so I tried install there and...nothing. As it turns out, I forgot to include the required libraries inside my and so running the program as intended did not work. After some attempts to figure this problem out, and testing, everything worked like a charm. Probably my biggest accomplishment yet.

This just leaves one more thing left to do. I needed to update my docs, then ask someone to test out my repo. This was simple enough. Luckily, Tim was available to do just that after I was able to test out and confirm that his package worked as intended. I gave him the README and waited to see his results. Here's the end result:

UrlAutomationMachine Installation

UrlAutomationMachine Success

Outside of that python error message, which I should probably hotfix, the tool worked to perfection. This was incredible for myself as until this point, I was the only person that was able to use it. There's still alot more that I can do to improve this tool. The last 3 months working on this tool was something alright. Bringing it from where it was originally, to where it is right now. You can find my first blog post about my tool here.

I like to think that this was always intended to be the end result, especially with open source projects. Bringing an idea to life is part of the reason why I chose to work in software development in the first place. I'll leave my remarks for the course in a final blog post I'll make after my final post for release 0.4 is finished. Hopefully, I find myself writing more blogs like these in the follow-up course in the upcoming Winter semester. Only time will tell at that point. Until next time, stay tuned!


Editor guide