guibranco / BancosBrasileiros

🇧🇷 :bank: :clipboard: Brazilian banks list
https://guibranco.github.io/BancosBrasileiros/
The Unlicense
431 stars 162 forks source link

Add PIP/PyPI support with gitauto model #430

Closed gitauto-ai[bot] closed 1 month ago

gitauto-ai[bot] commented 2 months ago

Original issue: #229

What is the feature

This feature adds support for publishing the project to PIP/PyPI, allowing users to easily install and manage the package using Python's package manager.

Why we need the feature

Publishing the project to PIP/PyPI will significantly increase its accessibility and ease of use for Python developers. It will allow users to install the package with a simple pip install command, manage dependencies more effectively, and integrate the package into their existing Python projects seamlessly.

How to implement and why

  1. Create setup.py:

    • This file is essential for packaging the project. It will include metadata about the project such as name, version, author, and dependencies.
    • Example:

      from setuptools import setup, find_packages
      
      setup(
       name='bancos_brasileiros',
       version='0.1.0',
       author='Author Name',
       author_email='author@example.com',
       description='A description of the project',
       long_description=open('README.md').read(),
       long_description_content_type='text/markdown',
       url='https://github.com/username/repo',
       packages=find_packages(),
       classifiers=[
           'Programming Language :: Python :: 3',
           'License :: OSI Approved :: MIT License',
           'Operating System :: OS Independent',
       ],
       python_requires='>=3.6',
      )
  2. Update README.md:

    • Add installation instructions using PIP.
    • Example:

      ## Installation
      
      You can install the package using pip:
      
      ```bash
      pip install bancos_brasileiros
  3. Create a .pypirc file:

    • This file will store your PyPI credentials for uploading the package.
    • Example:

      [distutils]
      index-servers =
       pypi
      
      [pypi]
      username = your-username
      password = your-password
  4. Build the package:

    • Use setuptools to build the package.
    • Command:
      python setup.py sdist bdist_wheel
  5. Upload the package to PyPI:

    • Use twine to upload the package.
    • Command:
      twine upload dist/*
  6. Automate the process:

    • Optionally, add a GitHub Action workflow to automate the build and upload process on new releases.
    • Example workflow (.github/workflows/publish.yml):

      name: Publish to PyPI
      
      on:
      release:
       types: [created]
      
      jobs:
      build:
       runs-on: ubuntu-latest
      
       steps:
       - uses: actions/checkout@v2
       - name: Set up Python
         uses: actions/setup-python@v2
         with:
           python-version: 3.x
       - name: Install dependencies
         run: pip install setuptools wheel twine
       - name: Build package
         run: python setup.py sdist bdist_wheel
       - name: Publish package
         env:
           TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
           TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
         run: twine upload dist/*

By following these steps, we can ensure that the project is properly packaged and published to PIP/PyPI, making it easily accessible to the Python community.

Test these changes locally

git checkout -b gitauto/issue-#229-146e322f-c041-4556-a1c9-bba0a7a08291
git pull origin gitauto/issue-#229-146e322f-c041-4556-a1c9-bba0a7a08291
gstraccini[bot] commented 1 month ago

This pull request is ready ✅ for merge/squash.

gstraccini[bot] commented 1 month ago

This pull request is ready ✅ for merge/squash.

sonarcloud[bot] commented 1 month ago

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud