As we are are nearing the end of our journey, DocBot was my tool as part of the Open Source class, As tasked in lab 9, we were informed to pack and release our tool, for everyone to use to the internet. First i thought it was an easy job, i was complete wrong and it took me extra time than submission to finish the activity. I will discuss everything in the blog what actually happened and how i managed to complete it. It was a roller-coaster.
How did i start the work
Me being a absolute beginner in packing and shipping it to code repos in my case PyPI. I had no clue how to make the file organization what extra files to add, luckily we have youtube and i found two excellent videos which did the explanation for me, which i will link here, amazing videos.
This guys helped me to restructure my code to make sure all the packages gets' imported correctly, even though video was there i struggled a lot, it was a lot of trial and error which consumed a lot of time finally fixing all the path and imports.
The final file structure looks like this :
DocBot/ # Root project directory
├── app/ # Main application folder
│ ├── docbot_app/ # Python package
│ │ ├── __init__.py # Marks this folder as a package
│ │ ├── src/ # Source files for the app
│ │ │ ├── __init__.py
│ │ │ ├── api.py # Handles Groq API integration
│ │ │ ├── arg_parser.py # Parses CLI arguments
│ │ │ ├── file_handler.py # Manages file input/output
│ │ │ ├── DocBot.py # Main CLI application logic
│ │ ├── tests/ # Directory for tests
│ │ │ ├── __init__.py
│ │ │ ├── test_api.py # Tests for api.py
│ │ │ ├── test_arg_parser.py # Tests for argument parsing
│ │ │ ├── test_file_handler.py # Tests for file handling
│ ├── __init__.py # Makes app a package
├── README.md # Project documentation
├── setup.py # Installation and packaging script
├── .env # (Optional) Environment variables for development
├── LICENSE # License file
So after making sure everything is done, next part was building it, which required a file called setup.py
, which had more dependency to install one was wheel
a file which is needed to distribute the build and another one included twine
which was a new tool for me !, This helps as to upload our tool to PYPI, making it available via pip
.
Everything was smooth until i realised, i didn't implementing anything to make to work in CLI, after installing it via pip
. That also took me me a very long time to figure out, as it was always giving me some error's of module missing, after fixing this docbot-ai was finally ready to be send to PYPI.
Then uploading via twine was so smooth, first i was testing it in PyPi Test site and everything was working smoothly. After ensuring everything was working fine, i updated my README.md
to add all the new addition and guidelines to how to use the tool.
Action time
I added the new README.MD
, changed the version to V1.0.1 build the tool and published it, along with tag and release in GitHub. Finally everything was done and DocBot is alive !
Conclusion
This lab taught me a lot, mainly file restructuring and organization, which consumed a lot of time for me. It also helped me learn about more tools like wheel
, PYPI tokens, building python apps, twine
etc. It was fun yet challenging to complete this task.
Top comments (0)