Skip to content

Commit

Permalink
Merge pull request #30 from cisagov/improvements/pull_in_upstream_and…
Browse files Browse the repository at this point in the history
…_run_isort

Pull in Upstream and Run pre-commit
  • Loading branch information
mcdonnnj authored Jan 6, 2020
2 parents ba0827c + db2a01a commit 2fcac8e
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[settings]
combine_star=true
force_sort_within_sections=true

import_heading_stdlib=Standard Python Libraries
import_heading_thirdparty=Third-Party Libraries
import_heading_firstparty=cisagov Libraries

# Should be auto-populated by seed-isort-config hook
known_third_party=docopt,pkg_resources,pytest,setuptools
# These must be manually set to correctly separate them from third party libraries
known_first_party=example
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ repos:
rev: 19.10b0
hooks:
- id: black
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.3
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
# pick the isort version you'd like to use from
# https://github.com/pre-commit/mirrors-isort/releases
rev: v4.3.21
hooks:
- id: isort
- repo: https://github.com/ansible/ansible-lint.git
rev: v4.1.1a5
hooks:
Expand Down
19 changes: 16 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
- https://blog.ionelmc.ro/2014/05/25/python-packaging/#the-structure
"""

# Standard Python Libraries
from glob import glob
from os.path import splitext, basename
from os.path import basename, splitext

from setuptools import setup, find_packages
# Third-Party Libraries
from setuptools import find_packages, setup


def readme():
Expand Down Expand Up @@ -68,7 +70,18 @@ def package_vars(version_file):
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")],
include_package_data=True,
install_requires=["docopt", "setuptools"],
extras_require={"test": ["pre-commit", "pytest", "pytest-cov", "coveralls"]},
extras_require={
"test": [
"pre-commit",
"coveralls",
# coveralls does not currently support coverage 5.0
# https://github.com/coveralls-clients/coveralls-python/issues/203
# is the issue for this on the coveralls project
"coverage < 5.0",
"pytest-cov",
"pytest",
]
},
# Conveniently allows one to run the CLI tool as `example`
entry_points={"console_scripts": ["example = example.example:main"]},
)
2 changes: 1 addition & 1 deletion src/example/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""The example library."""
from .example import example_div
from ._version import __version__ # noqa: F401
from .example import example_div

__all__ = ["example_div"]
2 changes: 2 additions & 0 deletions src/example/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
"warning", "error", and "critical". [default: warning]
"""

# Standard Python Libraries
import logging
import os
import sys

# Third-Party Libraries
import docopt
import pkg_resources

Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
https://docs.pytest.org/en/latest/writing_plugins.html#conftest-py-plugins
"""
# Third-Party Libraries
import pytest


Expand Down
3 changes: 3 additions & 0 deletions tests/test_example.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env pytest -vs
"""Tests for example."""

# Standard Python Libraries
import logging
import os
import sys
from unittest.mock import patch

# Third-Party Libraries
import pytest

# cisagov Libraries
import example

div_params = [
Expand Down

0 comments on commit 2fcac8e

Please sign in to comment.