Skip to content

Commit

Permalink
Merge pull request #41 from coveord/chore/merge
Browse files Browse the repository at this point in the history
merged remote back with origin
  • Loading branch information
jonapich authored Feb 5, 2024
2 parents 7abf2dc + 16d21a7 commit a499953
Show file tree
Hide file tree
Showing 1,245 changed files with 25,411 additions and 21,221 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# These are supported funding model platforms

github: [sfdye, s-t-e-v-e-n-k]
github: [sfdye, s-t-e-v-e-n-k, enricomi]
32 changes: 32 additions & 0 deletions .github/workflows/_build-pkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build package

on:
workflow_call:
inputs:
artifact-name:
description: "Name of an artifact"
type: "string"
required: false
default: "package"

jobs:
build-pkg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install dependencies
run: pip install -U build twine
- name: Build 📦 package
run: python -m build
- name: Check 📦 package
run: twine check dist/*

- uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact-name }}
path: dist
44 changes: 36 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
name: CI
on:
push:
branches: master
branches:
- main
- release-v*
pull_request:
merge_group:

jobs:

build:
uses: "./.github/workflows/_build-pkg.yml"
with:
artifact-name: package

test:
runs-on: ubuntu-latest
name: test (Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
name: test (Python ${{ matrix.python-version }} on ${{ matrix.os-label }})
strategy:
fail-fast: false
matrix:
# keep it sync with tox.ini [gh-actions] section
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
os: ["ubuntu-latest"]
os-label: ["Ubuntu"]
include:
- {python-version: "3.8", os: "windows-latest", os-label: "Windows"}
- {python-version: "3.8", os: "macos-latest", os-label: "macOS"}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"
- name: Install tox
Expand All @@ -23,13 +40,24 @@ jobs:
- name: Run tests
run: tox
- name: Upload coverage to Codecov
uses: codecov/[email protected]
uses: codecov/codecov-action@v3

test_success:
# this aggregates success state of all jobs listed in `needs`
# this is the only required check to pass CI
name: "Test success"
runs-on: ubuntu-latest
needs: [test]
steps:
- name: "Noop"
run: true
shell: bash

draft:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
needs: test_success
if: github.ref == 'refs/heads/main'
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

48 changes: 48 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Lint
on:
push:
branches:
- main
- release-v*
pull_request:
merge_group:

jobs:
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r requirements/types.txt
- uses: liskin/gh-problem-matcher-wrap@v2
with:
action: add
linters: mypy
- run: mypy --show-column-numbers github tests

pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/[email protected]

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8"

- run: pip install -r requirements/docs.txt
- run: pip install -e .
- run: sphinx-build doc build
32 changes: 18 additions & 14 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
name: Publish to PyPI
on:
push:
tags:
- "*"
tags: ["*"] # this will run full workflow including publish to PyPI
workflow_dispatch:

jobs:
build:
uses: "./.github/workflows/_build-pkg.yml"
with:
artifact-name: package

publish:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/download-artifact@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
name: package
path: dist
- name: Install twine
run: pip install -q twine
- name: Publish 📦 to PyPI
# only run this for tags
if: startsWith(github.event.ref, 'refs/tags/')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
run: twine upload dist/*
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
# Copyright 2016 Peter Buckley <[email protected]> #
# Copyright 2017 Chris McBride <[email protected]> #
# Copyright 2017 Colin Hoglund <[email protected]> #
# Copyright 2018 Vinay Hegde <[email protected]> #
# Copyright 2018 sfdye <[email protected]> #
# Copyright 2020 Steve Kowalik <[email protected]> #
# Copyright 2020 Wan Liuyang <[email protected]> #
# Copyright 2023 Enrico Minack <[email protected]> #
# Copyright 2023 Sol Redfern <[email protected]> #
# #
# This file is part of PyGithub. #
# http://pygithub.readthedocs.io/ #
Expand Down
8 changes: 0 additions & 8 deletions .isort.cfg

This file was deleted.

55 changes: 32 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
default_language_version:
python: python3

repos:
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-symlinks
- id: destroyed-symlinks
- id: mixed-line-ending
args:
- "--fix=lf"

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
- id: pyupgrade
args: ["--py37-plus"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.7
hooks:
- id: flake8
- id: ruff
args:
- "--fix"
- "--fixable=ALL"
- "--exit-non-zero-on-fix"

- repo: https://github.com/codespell-project/codespell
rev: v2.2.1
rev: v2.2.6
hooks:
- id: codespell
exclude: tests/
args:
- --ignore-words-list="bloaded,nto,pullrequest,pullrequests,thi,tim,wan,Wan,chang,Chang"
- --quiet-level=2
- repo: https://github.com/asottile/pyupgrade
rev: v3.1.0
additional_dependencies: [tomli]

- repo: https://github.com/psf/black
rev: 23.12.0
hooks:
- id: pyupgrade
args:
- --py37-plus
- id: black
8 changes: 6 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
# Required
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.8"

sphinx:
configuration: doc/conf.py

python:
version: 3.8
install:
- method: pip
path: .
- requirements: requirements.txt
- requirements: requirements/docs.txt
24 changes: 13 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ Ideally, changes should be made in logical commits and tests added to improve th

## Coding style

PyGithub adopts the black coding style and uses isort to sort imports.
PyGithub adopts the black coding style.

To manually format the code:
```
```bash
tox -e lint
```

Expand Down Expand Up @@ -74,7 +74,7 @@ def get_protected_branch(self):

First you need to install the test dependencies:
```bash
pip install -r test-requirements.txt
pip install -r requirements/test.txt
```

Then you can run the tests through `pytest`.
Expand All @@ -84,11 +84,13 @@ If you add a new test, for example `Issue139.testCompletion`, you have to run `p
Check them and commit them as well.
You will need a `GithubCredentials.py` file at the root of the project with the following contents:

```
```python
login = "my_login"
password = "my_password" # Can be left empty if not used
oauth_token = "my_token" # Can be left empty if not used
jwt = "my_json_web_token" # Can be left empty if not used
password = "my_password" # Can be left empty if not used
oauth_token = "my_token" # Can be left empty if not used
jwt = "my_json_web_token" # Can be left empty if not used
app_id = "my_app_id" # Can be left empty if not used
app_private_key = "my_app_private_key" # Can be left empty if not used
```

If you use 2 factor authentication on your Github account, tests that require a login/password authentication will fail.
Expand All @@ -98,26 +100,26 @@ Similarly, you can use `pytest Issue139.testCompletion --record --auth_with_jwt`

To run manual tests with external scripts that use the PyGithub package, you can install your development version with:

```
```bash
pip install --editable path/to/project
```

You may also want to investigate `tox` to run tests:

```
```bash
pip install tox
tox -epy310
```

## Build documentation locally

```
```bash
pip install -r requirements.txt
sphinx-build doc build
```

If you use tox:

```
```bash
tox -edocs
```
Loading

0 comments on commit a499953

Please sign in to comment.