Skip to content

Commit

Permalink
Merge branch 'master' into merge-largeint-and-range
Browse files Browse the repository at this point in the history
  • Loading branch information
onerandomusername committed Feb 26, 2023
2 parents 25f6663 + e7db034 commit e31a082
Show file tree
Hide file tree
Showing 72 changed files with 1,134 additions and 737 deletions.
73 changes: 0 additions & 73 deletions .flake8

This file was deleted.

4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

- [ ] If code changes were made, then they have been tested
- [ ] I have updated the documentation to reflect the changes
- [ ] I have formatted the code properly by running `task lint`
- [ ] I have type-checked the code by running `task pyright`
- [ ] I have formatted the code properly by running `pdm lint`
- [ ] I have type-checked the code by running `pdm pyright`
- [ ] This PR fixes an issue
- [ ] This PR adds something new (e.g. new method or parameters)
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
Expand Down
52 changes: 20 additions & 32 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,11 @@ inputs:
description: The python version to install
required: true
cache-dependency-path:
description: The path(s) to use for pip caching, defaults to requirements + setup
description: The path(s) to use for pip caching, defaults to setup + pdm
required: false
default: |
requirements/
requirements.txt
setup.py
pyproject.toml
dependencies:
description: Other python dependencies to install
required: false
nox-setup:
description: |
The dependencies to install using `nox -s setup`.
Automatically installs nox as well.
Use `*` to install all dependencies.
required: false
setup.py
outputs:
python-version:
description: The python version that was installed.
Expand All @@ -31,36 +20,35 @@ outputs:
runs:
using: composite
steps:
- name: Set up python ${{ inputs.python-version }}
- name: Set up pdm with python ${{ inputs.python-version }}
id: setup-python
uses: actions/setup-python@v4
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ inputs.python-version }}
cache: "pip"
version: "2.4.6"
cache: false
cache-dependency-path: ${{ inputs.cache-dependency-path }}
enable-pep582: false # Disable PEP 582 package loading globally

- name: Update pip, wheel, setuptools
- name: Disable PDM version check
shell: bash
run: python -m pip install -U pip wheel setuptools
run: |
pdm config check_update false
- name: Install dependencies
if: inputs.nox-setup || inputs.dependencies
env:
NOX_SETUP: ${{ inputs.nox-setup }}
DEPS: ${{ inputs.dependencies }}
- name: Ignore saved pythons
shell: bash
run: |
[ -n "$NOX_SETUP" ] && DEPS="$DEPS nox"
python -m pip install $DEPS
echo "PDM_IGNORE_SAVED_PYTHON=1" >> $GITHUB_ENV
if [ "*" == "$NOX_SETUP" ]; then
nox -s setup
elif [ -n "$NOX_SETUP" ]; then
nox -s setup -- $NOX_SETUP
fi
- name: Update pip, wheel, setuptools
shell: bash
run: python -m pip install -U pip wheel setuptools

- name: Install nox
shell: bash
run: pip install nox

- name: Set python version
id: python-version
shell: bash
run: |
echo "python-version=$(python -c 'import sys; print(".".join(map(str,sys.version_info[:2])))')" >> $GITHUB_OUTPUT
run: echo "python-version=$(python -c 'import sys; print(".".join(map(str,sys.version_info[:2])))')" >> $GITHUB_OUTPUT
6 changes: 4 additions & 2 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ jobs:
uses: ./.github/actions/setup-env
with:
python-version: '3.9'
nox-setup: "tools"

- name: Install dependencies
run: pdm install -dG tools

- name: Check for presence of a Change Log fragment (only pull requests)
# NOTE: The pull request' base branch needs to be fetched so towncrier
# is able to compare the current branch with the base branch.
run: |
if ! towncrier check --compare-with origin/${BASE_BRANCH}; then
if ! pdm run towncrier check --compare-with origin/${BASE_BRANCH}; then
echo "::error::Please see https://github.com/DisnakeDev/disnake/blob/master/changelog/README.rst for details on how to create a changelog entry." >&2
exit 1
fi
Expand Down
52 changes: 20 additions & 32 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,9 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up environment
uses: ./.github/actions/setup-env
with:
python-version: 3.8
nox-setup: "dev tools"

- name: Run pre-commit
id: pre-commit
uses: pre-commit/[email protected]
env:
SKIP: 'flake8'

# Run flake8 and have it format the linting errors in the format of
# the GitHub Workflow command to register error annotations. This
# means that our flake8 output is automatically added as an error
# annotation to both the run result and in the "Files" tab of a
# pull request.
#
# Format used:
# ::error file={filename},line={line},col={col}::{message}
- name: Run flake8
id: flake8
if: always() && (steps.pre-commit.outcome == 'success' || steps.pre-commit.outcome == 'failure')
run: "flake8 \
--format='::error file=%(path)s,line=%(row)d,col=%(col)d::\
[flake8] %(code)s: %(text)s'"

docs:
# unlike the other workflows, we are using version 20.04 here as
Expand All @@ -69,7 +46,6 @@ jobs:
uses: ./.github/actions/setup-env
with:
python-version: 3.8
nox-setup: "docs"

- name: Run sphinx-build
run: nox -s docs -- --keep-going -W -w $GITHUB_STEP_SUMMARY
Expand All @@ -89,9 +65,17 @@ jobs:
- name: Set up environment
id: setup-env
uses: ./.github/actions/setup-env
env:
PDM_USE_VENV: true
PDM_VENV_IN_PROJECT: true
with:
python-version: ${{ matrix.python-version }}
nox-setup: "*"

- name: Install dependencies out of venv
run: |
pdm export --pyproject --without-hashes -d -G speed -G docs -G voice -o requirements.txt
pip install -r requirements.txt
pip install .
- name: Set pyright version
run: |
Expand All @@ -100,6 +84,7 @@ jobs:
- name: Run pyright (Linux)
uses: jakebailey/[email protected]
id: pyright-linux
with:
version: ${{ env.PYRIGHT_VERSION }}
python-version: ${{ steps.setup-env.outputs.python-version }}
Expand All @@ -109,7 +94,7 @@ jobs:

- name: Run pyright (Windows)
uses: jakebailey/[email protected]
if: ${{ success() || failure() }} # run regardless of previous step's result
if: always() && (steps.pyright-linux.outcome == 'success' || steps.pyright-linux.outcome == 'failure')
with:
version: ${{ env.PYRIGHT_VERSION }}
python-version: ${{ steps.setup-env.outputs.python-version }}
Expand All @@ -127,7 +112,6 @@ jobs:
uses: ./.github/actions/setup-env
with:
python-version: 3.8
nox-setup: tools

- name: Run slotscheck
if: (success() || failure()) && steps.setup.outcome == 'success'
Expand Down Expand Up @@ -178,7 +162,9 @@ jobs:
uses: ./.github/actions/setup-env
with:
python-version: ${{ matrix.python-version }}
dependencies: nox coveralls==3.3.1 coverage[toml]~=6.3.2

- name: Install dependencies
run: pdm install -dG test # needed for coverage

- name: Test package install
run: |
Expand All @@ -198,7 +184,7 @@ jobs:
if: always() && (steps.run_tests.outcome == 'success' || steps.run_tests.outcome == 'failure')
run: |
echo "$GITHUB_STEP_SUMMARY_HEADER" | sed "s/#name#/Coverage Summary/" >> $GITHUB_STEP_SUMMARY
python -m coverage report | tee -a $GITHUB_STEP_SUMMARY
pdm run coverage report | tee -a $GITHUB_STEP_SUMMARY
echo "$GITHUB_STEP_SUMMARY_FOOTER" >> $GITHUB_STEP_SUMMARY
Expand All @@ -215,7 +201,9 @@ jobs:
COVERALLS_FLAG_NAME: coverage-${{ runner.os }}-python-${{ matrix.python-version }}
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: github
run: python -m coveralls
run: |
python -m pip install coveralls==3.3.1 'coverage[toml]~=6.5'
python -m coveralls
coveralls-finish:
name: Indicate completion to coveralls.io
Expand All @@ -234,15 +222,15 @@ jobs:
python-version: 3.8
cache-dependency-path: |
.github/workflows/lint-test.yml
dependencies: coveralls==3.3.1
- name: Coveralls Finished
continue-on-error: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
run: |
python3 -m coveralls --finish
python -m pip install coveralls==3.3.1
python -m coveralls --finish
# thanks to aiohttp for this part of the workflow
check: # This job does nothing and is only used for the branch protection
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ venvs/
.idea
.coverage*
coverage.xml
__pypackages__/
.pdm.toml
pdm.lock

!test_bot/locale/*.json
13 changes: 4 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ repos:
args: [--negate]
types: [text]
exclude_types: [json, pofile]
exclude: 'changelog/|py.typed|disnake/bin/COPYING|.github/PULL_REQUEST_TEMPLATE.md|LICENSE|MANIFEST.in|requirements/|requirements.txt'
exclude: 'changelog/|py.typed|disnake/bin/COPYING|.github/PULL_REQUEST_TEMPLATE.md|LICENSE|MANIFEST.in'

- repo: https://github.com/pycqa/isort
rev: 5.12.0
Expand All @@ -55,12 +55,7 @@ repos:
- id: black
name: "run black in all files"

- repo: local
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.252
hooks:
- id: flake8
name: flake8
description: "Lint all of our code"
entry: flake8
language: system
types: [python]
require_serial: true
- id: ruff
Loading

0 comments on commit e31a082

Please sign in to comment.