DEV Community

Elisaassa
Elisaassa

Posted on

OSD Lab9

For Lab 9, I focused on packaging and releasing the Code-Formatter-Advisor project on PyPI, making it accessible for easy installation by others.

Choosing the Release Tool and Package Registry

For this project, I chose Python's standard package manager, PyPI (Python Package Index), as the release tool. PyPI is widely used for distributing Python packages and is accessible to most Python developers. You can find the release at Code-Formatter-Advisor on PyPI.

Creating the Release

The process of creating the release involved a few key steps:

  1. Preparing setup.py: I created a setup.py file to include metadata like the package name, version, author, and dependencies. This setup file is crucial as it tells PyPI how to build and install the package.

  2. Generating Distribution Files: Using the command python setup.py sdist bdist_wheel, I generated both source and wheel distribution files. These files were stored in the dist/ directory, ready for uploading.

  3. Uploading to PyPI: I used Twine to upload the package to PyPI: twine upload dist/*. During this step, I needed to use my PyPI credentials, including an API token. After uploading, my package was live on PyPI.

Lessons Learned

While working on this release, I learned the importance of configuring setup.py accurately, especially with correct dependency management. I encountered a few issues with encoding in the README.md file, but I resolved them by specifying the encoding in the setup.py.

An "aha!" moment for me was understanding how git tags work alongside releases. Tagging releases (git tag -a v1.0.0 -m "Initial release") helped me track versions effectively.

Alterations Made for the Release

I had to create and modify the setup.py to add package details and define dependencies. This included adding all necessary libraries and ensuring the README.md provided proper instructions for installing and using the package.

User Testing Feedback

For user testing, I asked a fellow developer to try installing my package from PyPI and follow the README instructions. They had minor issues understanding the virtual environment setup step, which I have clarified in the README. This experience highlighted the importance of clear and precise instructions for users who may not have the same technical background.

Using Code-Formatter-Advisor via PyPI

Users can now install Code-Formatter-Advisor directly from PyPI by running:

pip install code-formatter-advisor
Enter fullscreen mode Exit fullscreen mode

After installation, the command-line tool can be used as described in the updated README to analyze code and get formatting suggestions.

Code-Formatter-Advisor on PyPI provides an easy entry point for developers to leverage this tool in their projects.

Top comments (0)