From b19e71c965943f427c70ad572308eafa3b917017 Mon Sep 17 00:00:00 2001 From: Javier Callico Date: Sun, 8 Feb 2026 14:40:30 -0500 Subject: [PATCH] Publishing Python package to PyPI (#29) * Add GitHub Actions workflow for publishing Python package to PyPI and update pyproject.toml with project metadata * Bump version to 1.0.0 in pyproject.toml --- .github/workflows/publish.yml | 51 +++++++++++++++++++++++++++++++++++ pyproject.toml | 38 ++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..27504ae --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,51 @@ +name: Publish Python 🐍 distribution to PyPI + +on: + release: + types: [published] + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install pypa/build + run: >- + python3 -m pip install build --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: Publish Python 🐍 distribution to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/imap-migration-tools + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 8de8053..05fe052 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,44 @@ # Ruff configuration for IMAP Migration Tools # https://docs.astral.sh/ruff/ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "imap-migration-tools" +version = "1.0.0" +authors = [ + { name="Javier Callico", email="jcallico@callicode.com" }, + { name="Nathan Moinvaziri", email="nathan@nathanm.com" } +] +description = "Tools for migrating IMAP emails" +readme = "README.md" +requires-python = ">=3.9" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] +dependencies = [ + "google-auth-oauthlib", + "msal", +] + +[project.urls] +"Homepage" = "https://github.com/jcallico/imap-migration-tools" +"Bug Tracker" = "https://github.com/jcallico/imap-migration-tools/issues" + +[project.scripts] +imap-backup = "backup_imap_emails:main" +imap-restore = "restore_imap_emails:main" +imap-migrate = "migrate_imap_emails:main" +imap-count = "count_imap_emails:main" +imap-compare = "compare_imap_folders:main" + +[tool.setuptools.package-dir] +"" = "src" + [tool.ruff] target-version = "py39" line-length = 120