Skip to content

chore: blacken with 19.10b0 to match shared templates #386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 51 additions & 81 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,94 +1,64 @@
#########################################
# Editor temporary/working/backup files #
.#*
*\#*\#
[#]*#
*~
*$
*.bak
*flymake*
*.kdev4
*.log
*.swp
*.pdb
.project
.pydevproject
.settings
.idea
.vagrant
.noseids
.ipynb_checkpoints
.tags
.pytest_cache
.testmon*
.vscode/
.env

# Docs #
########
docs/source/_build
*.py[cod]
*.sw[op]

# Coverage #
############
.coverage
coverage.xml
coverage_html_report
.pytest_cache

# Compiled source #
###################
*.a
*.com
*.class
*.dll
*.exe
*.pxi
*.o
*.py[ocd]
# C extensions
*.so
.build_cache_dir
MANIFEST
__pycache__

# Python files #
################
# setup.py working directory
build
# setup.py dist directory
dist
# Egg metadata
# Packages
*.egg
*.egg-info
dist
build
eggs
.eggs
.pypirc
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__

# tox testing tool
.tox
# rope
.ropeproject
# wheel files
*.whl
**/wheelhouse/*
pip-wheel-metadata
# Installer logs
pip-log.txt

# coverage
# Unit test / coverage reports
.coverage
.testmondata
.pytest_cache
.nox
.cache
.pytest_cache


# OS generated files #
######################
.directory
.gdb_history
# Mac
.DS_Store
ehthumbs.db
Icon?
Thumbs.db

# caches #
.cache
# JetBrains
.idea

# VS Code
.vscode

# emacs
*~

# Built documentation
docs/_build
docs/source/_build
bigquery/docs/generated
docs.metadata

# Virtual environment
env/

# Test logs
coverage.xml
*sponge_log.xml

# System test environment variables.
system_tests/local_test_setup

# Credentials #
###############
bigquery_credentials.dat
ci/service_account.json
# Make sure a generated file isn't accidentally committed.
pylintrc
pylintrc.test
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
8 changes: 0 additions & 8 deletions .stickler.yml

This file was deleted.

15 changes: 0 additions & 15 deletions codecov.yml

This file was deleted.

17 changes: 9 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@

# General information about the project.
project = u"pandas-gbq"
copyright = u"2017-{}, PyData Development Team".format(
datetime.datetime.now().year
)
copyright = u"2017-{}, PyData Development Team".format(datetime.datetime.now().year)
author = u"PyData Development Team"

# The version info for the project you're documenting, acts as replacement for
Expand Down Expand Up @@ -102,8 +100,13 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
exclude_patterns = [
"_build",
"**/.nox/**/*",
"samples/AUTHORING_GUIDE.md",
"samples/CONTRIBUTING.md",
"samples/snippets/README.rst",
]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand Down Expand Up @@ -335,9 +338,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, "pandas-gbq", u"pandas-gbq Documentation", [author], 1)
]
man_pages = [(master_doc, "pandas-gbq", u"pandas-gbq Documentation", [author], 1)]

# If true, show URL addresses after external links.
#
Expand Down
63 changes: 43 additions & 20 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,48 @@
import nox


supported_pythons = ["3.7", "3.8"]
system_test_pythons = ["3.7", "3.8"]
latest_python = "3.8"
BLACK_VERSION = "black==19.10b0"
BLACK_PATHS = ["docs", "pandas_gbq", "tests", "noxfile.py", "setup.py"]

# Use a consistent version of black so CI is deterministic.
# Should match Stickler: https://stickler-ci.com/docs#black
black_package = "black==20.8b1"
DEFAULT_PYTHON_VERSION = "3.8"
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9"]


@nox.session(python=latest_python)
# Error if a python version is missing
nox.options.error_on_missing_interpreters = True


@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint(session):
session.install(black_package, "flake8")
session.run("flake8", "pandas_gbq")
session.run("flake8", "tests")
session.run("black", "--check", ".")
"""Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues.
"""
session.install("flake8", BLACK_VERSION)
session.run(
"black", "--check", *BLACK_PATHS,
)
session.run("flake8", "pandas_gbq", "tests")


@nox.session(python=latest_python)
@nox.session(python=DEFAULT_PYTHON_VERSION)
def blacken(session):
session.install(black_package)
session.run("black", ".")
"""Run black. Format code to uniform standard."""
session.install(BLACK_VERSION)
session.run(
"black", *BLACK_PATHS,
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint_setup_py(session):
"""Verify that setup.py is valid (including RST check)."""
session.install("docutils", "pygments")
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")

@nox.session(python=supported_pythons)

@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
def unit(session):
session.install("pytest", "pytest-cov")
session.install(
Expand All @@ -56,18 +74,23 @@ def unit(session):
"--cov=tests.unit",
"--cov-report",
"xml:/tmp/pytest-cov.xml",
*session.posargs
*session.posargs,
)


@nox.session(python=latest_python)
@nox.session(python=DEFAULT_PYTHON_VERSION)
def cover(session):
"""Run the final coverage report.
This outputs the coverage report aggregating coverage from the unit
test runs (not system test runs), and then erases coverage data.
"""
session.install("coverage", "pytest-cov")
session.run("coverage", "report", "--show-missing", "--fail-under=73")

session.run("coverage", "erase")


@nox.session(python=latest_python)
@nox.session(python=DEFAULT_PYTHON_VERSION)
def docs(session):
"""Build the docs."""

Expand All @@ -89,7 +112,7 @@ def docs(session):
)


@nox.session(python=system_test_pythons)
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
def system(session):
session.install("pytest", "pytest-cov")
session.install(
Expand All @@ -111,5 +134,5 @@ def system(session):
os.path.join(".", "tests", "system"),
os.path.join(".", "samples", "tests"),
"-v",
*additional_args
*additional_args,
)
Loading