Skip to content
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

Try using setup.cfg declarative metadata #403

Merged
merged 15 commits into from
Oct 31, 2020
12 changes: 8 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
rev: pylint-2.6.0
hooks:
- id: pylint
exclude: ^docs/conf\.py$
files: ^nbqa/
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
Expand All @@ -39,18 +39,18 @@ repos:
rev: 5.1.1
hooks:
- id: pydocstyle
exclude: ^docs/
files: ^nbqa/
- repo: https://github.com/econchick/interrogate
rev: 1.3.1
hooks:
- id: interrogate
args: [-v, --fail-under=100]
exclude: ^docs/|__init__\.py$
files: ^nbqa/
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.790
hooks:
- id: mypy
exclude: ^docs/
files: ^nbqa/
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.3
hooks:
Expand All @@ -71,3 +71,7 @@ repos:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.15.1
hooks:
- id: setup-cfg-fmt
38 changes: 0 additions & 38 deletions MANIFEST.in

This file was deleted.

12 changes: 6 additions & 6 deletions nbqa/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from shlex import split
from typing import Any, Callable, ClassVar, Dict, List, Mapping, NamedTuple, Optional

import toml
from pkg_resources import resource_filename

from nbqa.cmdline import CLIArgs


Expand All @@ -18,12 +21,9 @@ class _ConfigSections(NamedTuple): # pylint: disable=R0903
CONFIG_SECTIONS = _ConfigSections()


DEFAULT_CONFIG: Mapping[str, Mapping] = {
"addopts": {"isort": ["--treat-comment-as-code", "# %%"]},
"ignore_cells": {},
"mutate": {},
"config": {},
}
DEFAULT_CONFIG: Mapping[str, Mapping] = toml.load(
resource_filename("nbqa.config_files", "default_config.toml")
)


class Configs:
Expand Down
1 change: 1 addition & 0 deletions nbqa/config_files/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Configuration files."""
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 8 additions & 0 deletions nbqa/config_files/default_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[addopts]
isort = ["--treat-comment-as-code", "# %%"]

[config]

[mutate]

[ignore_cells]
45 changes: 45 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
[metadata]
name = nbqa
version = 0.3.6
description = Run any standard Python code quality tool on a Jupyter Notebook
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/nbQA-dev/nbQA
author = Marco Gorelli, Girish Pasupathy
MarcoGorelli marked this conversation as resolved.
Show resolved Hide resolved
license = MIT
license_file = LICENSE
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Natural Language :: English
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9

[options]
packages = find:
py_modules = nbqa
install_requires =
toml
importlib_metadata;python_version < '3.8'
python_requires = >=3.6

[options.entry_points]
console_scripts =
nbqa = nbqa.__main__:main

[options.package_data]
nbqa =
config_files/default_config.toml

[options.packages.find]
exclude =
tests*

[bdist_wheel]
universal = True

[bumpversion]
current_version = 0.3.6

s-weigand marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
52 changes: 2 additions & 50 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,3 @@
#!/usr/bin/env python
from setuptools import setup

"""The setup script."""
from pathlib import Path

from setuptools import find_packages, setup

readme = Path("README.md").read_text(encoding="utf8")

requirements = ["toml", "importlib_metadata; python_version < '3.8'"]

setup_requirements = []

test_requirements = []

extra_requirements = {
"toolchain": ["black", "mypy", "isort", "pyupgrade", "flake8", "pylint"]
}

setup(
author="Marco Gorelli, Girish Pasupathy",
python_requires=">=3.6",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
description="Run any Python code quality tool on a Jupyter Notebook!",
entry_points={"console_scripts": ["nbqa=nbqa.__main__:main"]},
install_requires=requirements,
license="MIT license",
long_description=readme,
long_description_content_type="text/markdown",
include_package_data=True,
keywords="nbqa",
name="nbqa",
packages=find_packages(include=["nbqa", "nbqa.*"]),
setup_requires=setup_requirements,
test_suite="tests",
tests_require=test_requirements,
extras_require=extra_requirements,
url="https://github.com/nbQA-dev/nbQA",
version="0.3.6",
zip_safe=False,
)
setup()