DEV Community

Hyunjin Shin (Jin)
Hyunjin Shin (Jin)

Posted on

OSD600 - Lab09

Link to the package that I released

Description

This post is about lab 09 for OSD600 course at Seneca College. This week, we learned how to package our project and release it to public. And also we learned about git tag

Reflection

- Q1. Which release tool and package registry did you choose? Provide links to everything you mention.

I used Poetry. In the first week, I started my project without package manager. Since it was my first python project, I didn't know that python has package managers. Then, I learned that there is package manager similar to npm, and recreated my project. This package manager also provides a way to release the project easily.


- Q2. What was the process for creating a release? Be detailed so that other developers could read your blog and get some idea how to do the same.

Step 1. Create PyPI account and generate api key for PyPI publish

Step 2. Set up the API_KEY in config.toml file for poetry.
Poetry config.toml for mac is located in ~/Library/Application Support/pypoetry

[pypi]
username = "__token__"
password = "pypi-<your-token>"
Enter fullscreen mode Exit fullscreen mode

you may need to set up the key as following:

poetry config pypi-token.pypi <your-token>
Enter fullscreen mode Exit fullscreen mode

Step 3. Build your poetry project in the root dir of your project

poetry build
Enter fullscreen mode Exit fullscreen mode

Step 4. Run the following commend to publish it

poetry publish
Enter fullscreen mode Exit fullscreen mode

- Q3. What did you learn while doing your release? Did you have any "aha!" moments or get stuck?

Poetry Package manager is so easy and kind that I didn't have a huge problem with publishing it. However, I had some problem using the tool that I published. I downloaded the tool with the following command

pip3 install code-mage
codemage test.js -s
Enter fullscreen mode Exit fullscreen mode

Some of the features didn't work although it worked when I ran it from my project directory using poetry run codemage command. I think when it builds the project for release, it mangles file structure or doesn't include some files. There was one function that reads version info from pyproject.toml file. It correctly reads when I use it in project directory. However, it didn't work in my published version. So I had to change the logic.


- Q4. How much did you have to alter your code, files, build, etc. to use the chosen package format and registry?

Fortunately, I started with package manager, I didn't have to change a lot. I only fixed some logics or some functions that only works in local environment(e.g. cloning the repo and running it).


- Q5. How did the User Testing session with your partner go? Describe what it was like, where they got stuck, and how you corrected the problems.

I asked my seneca colleague. She was very confused by the Doc. She said it would be really tough or impossible to use the tool just by reading the Doc. I made a lot of changes in my Doc and made it as kind and easy as I can. I think I subconsciously assumed that they would know the steps that I didn't write about in the Doc such as how to make .toml file, the syntax of .toml file. And also, I didn't consider the users have different environment; some users use Linux, Some use Window, and Some use Mac. So I added instructions for different environments.


- Q6. How do users install and use your project now that it has been released? Provide links and some instructions.

Code-Mage.

This is the published version of my tool. User first needs to have Python 3.12 or later version installed on their machine.

And then, users can downloade the tool using the following comands.

pip install code-mage # Window user
pip3 install code-mage # Mac user
Enter fullscreen mode Exit fullscreen mode

Then, they need to create their api_key at openrouter Or Groq

They can set up their key with commands as follows:

export GROQ_API_KEY=your-api-key
export OPENROUTER_API_KEY=your-api-key
Enter fullscreen mode Exit fullscreen mode

or they can create .toml file in their home directory. They can set other options in the file.

vi ~/.codemage-config.toml
Enter fullscreen mode Exit fullscreen mode

Then, add the following environment settings in the file:

# the double quotes for string values are necessary.

model="groq" # if you wish to use OPEN ROUTER you can just delete this line
GROQ_API_KEY="<YOUR-GROQ-API-KEY>"
OPENROUTER_API_KEY="<YOUR-OPEN-ROUTER-API-KEY>"
language="java" # you can use any of the supported languages
stream=false # if you wish to get the output streamed, set it `true`
token_usage=false # if you wish to get token_usage info, set it `true`
output="result" # type any name for the output file without the extension
Enter fullscreen mode Exit fullscreen mode

Now, they can use the tool.

codemage -v
codemage -h
codemage test.js # assume there as test.js file in your current dir.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)