From 9f375c2d5ba0aa5b9435d0b945a18e8091c4a20a Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Fri, 13 Sep 2024 09:42:07 -0400 Subject: [PATCH 1/3] ci: add pypi-publish action to push to pypi --- .github/workflows/pypi-publish.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/pypi-publish.yml diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 0000000..0d70d1e --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -0,0 +1,24 @@ +--- +on: + release: + types: [published] +jobs: + pypi-publish: + name: upload release to PyPI + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: 'pip' + - name: Build package distributions + run: | + pip install build + python -m build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From 6ac6316de64bd6270121695eeca52b99b1e5959f Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Fri, 13 Sep 2024 09:44:04 -0400 Subject: [PATCH 2/3] chore: use commitizen to aid with releases --- .pre-commit-config.yaml | 5 ++ CONTRIBUTING.md | 107 ++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 5 ++ 3 files changed, 117 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c1c5fb8..59c5103 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,3 +45,8 @@ repos: args: - --fix - --exit-non-zero-on-fix + - repo: https://github.com/compilerla/conventional-pre-commit + rev: v3.4.0 + hooks: + - id: conventional-pre-commit + stages: [commit-msg] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..c3eb8cb --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,107 @@ +Contributing to Simple Github +============================= + +Thanks for your interest in simple-github! To participate in this community, please +review our [code of conduct][0]. + +[0]: https://github.com/mozilla-releng/simple-github/blob/main/CODE_OF_CONDUCT.md + +Clone the Repo +-------------- + +To contribute to simple-github, you'll need to clone the repository: + +``` +# first fork simple-github +git clone https://github.com//simple-github +cd simple-github +git remote add upstream https://github.com/mozilla-releng/simple-github +``` + +Setting Up the Environment +-------------------------- + +We use a tool called [uv][1] to manage simple-github and its dependencies. First, +follow the [installation instructions][2]. + +Then run: + +``` +uv sync +``` + +This does several things: + +1. Creates a virtualenv for the project in a ``.venv`` directory (if necessary). +2. Syncs the project's dependencies as pinned in ``uv.lock`` (if necessary). +3. Installs ``simple-github`` as an editable package (if necessary). + +Now you can prefix commands with `uv run` and they'll have access to this +environment. + +[1]: https://docs.astral.sh/uv/ +[2]: https://docs.astral.sh/uv/getting-started/installation/ + +Running Tests +------------- + +Tests are run with the [pytest][3] framework: + +``` +uv run pytest +``` + +[3]: https://docs.pytest.org + +Running Checks +-------------- + +Linters and formatters are run via [pre-commit][4]. To install the hooks, run: + +``` +pre-commit install -t pre-commit -t commit-msg +``` + +Now checks will automatically run on every commit. If you prefer to run checks +manually, you can use: + +``` +pre-commit run +``` + +Most of the checks we enforce are done with [ruff][5]. See +[pre-commit-config.yaml][6] for a full list of linters and formatters. + +[4]: https://pre-commit.com/ +[5]: https://docs.astral.sh/ruff/ +[6]: https://github.com/mozilla-releng/simple-github/blob/main/.pre-commit-config.yaml + +Releasing +--------- + +A tool called [commitizen][7] can optionally be used to assist with releasing +the package. First install it with: + +``` +uv tool install commitizen +``` + +Then create the version bump commit: + +``` +cz changelog +cz bump +git show +``` + +Create a pull request and get the commit merged into `main`. Once merged, make sure +your tag is pushed upstream: + +``` +git push upstream --tags +``` + +Finally, create a release in Github, choosing the tag that you just pushed. +This will trigger the `pypi-publish` workflow and upload the package to pypi. + +[7]: https://commitizen-tools.github.io/commitizen/ diff --git a/pyproject.toml b/pyproject.toml index 8c0c7ff..b19edca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,11 @@ dev-dependencies = [ "tox~=4.11", ] +[tool.commitizen] +bump_message = "chore: version bump $new_version" +changelog_incremental = true +version_provider = "pep621" + [tool.black] line-length = 88 From 1294fa1c62f2378bc4b751d39b8f994b69d94f69 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Fri, 13 Sep 2024 13:56:33 -0400 Subject: [PATCH 3/3] chore: version bump 2.0.0 --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7a49b3..5d6e263 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.0.0 (2024-09-13) + +### Feat + +- make `client.request` return response object rather than content + ## 1.0.0 (2023-12-13) ### Feat diff --git a/pyproject.toml b/pyproject.toml index b19edca..1003385 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "simple-github" description = "A simple Github client that only provides auth and access to the REST and GraphQL APIs." -version = "1.0.0" +version = "2.0.0" authors = [ { name = "Mozilla Release Engineering", email = "release+simple-github@mozilla.com"} ]