Skip to content

[Functional Requirements]: [Feature Request]: Automate deployment of python package to Pypi #68

Description

@github-actions

Summary

The feature aims to automate the version numbering and publishing process of a Python package to the PyPi package manager whenever changes are made to the main branch of the repository. This will streamline the release process and ensure that the latest version of the package is always available for users.

Motivation

Currently, the process of updating the version number and publishing the package to PyPi is manual, which can lead to inconsistencies and delays in releasing updates. Automating this process will not only save time but also reduce the risk of human error, ensuring that the package is always up-to-date with the latest changes.

Detailed Description

The feature will implement a Continuous Integration (CI) workflow that triggers on every commit to the main branch. The workflow will perform the following tasks:

  1. Version Number Update: Automatically increment the version number based on the type of changes made (e.g., major, minor, patch). This could be determined by analyzing commit messages or using a predefined versioning scheme (e.g., Semantic Versioning).

  2. Build the Package: Create a distributable package (e.g., .tar.gz or .whl) using tools like setuptools or poetry.

  3. Publish to PyPi: Use the twine library to securely upload the newly built package to the PyPi repository.

  4. Notification: Optionally, send a notification (e.g., via email or Slack) to inform the team that a new version has been published.

Specific Requirements:

  • The workflow should be defined in a YAML file (e.g., .github/workflows/publish.yml for GitHub Actions).
  • The versioning scheme should be configurable.
  • The workflow should handle errors gracefully and provide meaningful logs for debugging.
  • Ensure that only authorized users can trigger the workflow and publish to PyPi.

Acceptance Criteria

  • A CI workflow is created that triggers on every commit to the main branch.
  • The version number is automatically updated according to the defined versioning scheme.
  • The package is successfully built and published to PyPi without manual intervention.
  • Notifications are sent upon successful publishing of the package.
  • Comprehensive documentation is provided for setup and configuration.

Dependencies

  • A CI/CD platform (e.g., GitHub Actions, GitLab CI, Travis CI).
  • Tools for building and publishing Python packages (e.g., setuptools, twine).
  • Access to the PyPi repository with appropriate credentials.

Technical Considerations

  • Technologies: The feature will utilize GitHub Actions for CI/CD, setuptools for packaging, and twine for publishing to PyPi.
  • Challenges: Handling version conflicts, ensuring that the workflow runs only on the main branch, and managing credentials securely for PyPi access.
  • Risks: Potential for publishing incorrect versions if the versioning logic is not implemented correctly.

Additional Context

This feature aligns with best practices in software development by promoting automation and continuous delivery. It is particularly beneficial for teams that frequently update their packages and want to ensure that users have access to the latest features and fixes without manual intervention.

Attachments

  • Example YAML configuration for the CI workflow.
  • Flowchart illustrating the versioning and publishing process.

Parent Issue: #67

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions