Skip to content

Commit

Permalink
Merge pull request jamescooke#7 from jamescooke/alpha
Browse files Browse the repository at this point in the history
Prep v0.1.0 as an alpha release
  • Loading branch information
jamescooke authored Apr 13, 2018
2 parents 0a81b27 + de973d3 commit 230fd93
Show file tree
Hide file tree
Showing 18 changed files with 146 additions and 27 deletions.
3 changes: 0 additions & 3 deletions .style.yapf

This file was deleted.

19 changes: 19 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Changelog
=========

All notable changes to this project will be documented in this file.

The format is based on `Keep a Changelog
<http://keepachangelog.com/en/1.0.0/>`_ and this project adheres to `Semantic
Versioning <http://semver.org/spec/v2.0.0.html>`_.


Unreleased_
-----------

0.1.0 - 2018/04/13
------------------

Initial alpha release.

.. _Unreleased: https://github.com/constructpm/pysyncgateway/compare/v0.1.0...HEAD
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include LICENSE
include README.rst
36 changes: 33 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
lint_files=setup.py flake8_aaa tests
rst_files=README.rst CHANGELOG.rst

venv:
virtualenv venv --python=python3
Expand All @@ -9,11 +10,13 @@ venv/bin/pip-sync: venv

.PHONY: dev
dev: venv venv/bin/pip-sync
venv/bin/pip install -U "pip<10"
venv/bin/pip-sync requirements/dev.txt

.PHONY: build
build:
venv/bin/python setup.py build
.PHONY: tox
tox:
tox


.PHONY: lint
lint:
Expand All @@ -24,6 +27,10 @@ lint:
if [ "$$(wc -l isort.out)" != "0 isort.out" ]; then cat isort.out; exit 1; fi
@echo "=== yapf ==="
yapf --recursive --diff $(lint_files)
@echo "=== rst ==="
restructuredtext-lint $(rst_files)
@echo "=== setup.py ==="
python setup.py check --metadata --strict

.PHONY: fixlint
fixlint:
Expand All @@ -32,7 +39,30 @@ fixlint:
@echo "=== fixing yapf ==="
yapf --recursive --in-place $(lint_files)


# --- Building / Publishing ---

.PHONY: clean
clean:
rm -rf dist build .tox .pytest_cache flake8_aaa.egg-info
find . -name '*.pyc' -delete

.PHONY: sdist
sdist: clean tox
python setup.py sdist

.PHONY: bdist_wheel
bdist_wheel: clean tox
python setup.py bdist_wheel

.PHONY: testpypi
testpypi: clean sdist bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/*

.PHONY: pypi
pypi: clean sdist bdist_wheel
twine upload dist/*

.PHONY: tag
tag:
git tag -a $$(python -c 'from flake8_aaa.__about__ import __version__; print("v{}".format(__version__))')
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ Python tests against the rules of the `Arrange Act Assert pattern
<http://jamescooke.info/arrange-act-assert-pattern-for-python-developers.html>`_
of testing.

Resources
---------

* `Changelog <CHANGELOG.rst>`_


Docs
====

(to be extracted to RTD)


Test discovery
--------------
Expand Down
11 changes: 11 additions & 0 deletions flake8_aaa/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from __future__ import absolute_import, print_function, unicode_literals

__short_name__ = 'aaa'
__name__ = 'flake8-{}'.format(__short_name__)
__version__ = '0.1.0'

__author__ = 'James Cooke'
__copyright__ = '2018, {}'.format(__author__)

__description__ = 'Flake8 plugin that checks Pytest tests follow the Arrange Act Assert pattern'
__email__ = '[email protected]'
5 changes: 3 additions & 2 deletions flake8_aaa/checker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import astroid
import asttokens

from .__about__ import __short_name__, __version__
from .function import Function
from .helpers import find_test_functions, is_test_file

Expand All @@ -13,8 +14,8 @@ class Checker:
tree (astroid.Module): Astroid tree loaded from file.
"""

name = 'aaa'
version = '0.1'
name = __short_name__
version = __version__

def __init__(self, tree, filename):
"""
Expand Down
5 changes: 3 additions & 2 deletions flake8_aaa/helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os

import astroid
import py


def is_test_file(filename):
Expand All @@ -23,7 +24,7 @@ def is_test_file(filename):
>>> is_test_file('./test_helpers.py')
True
"""
return py.path.local(filename).basename.startswith('test_')
return os.path.basename(filename).startswith('test_')


def find_test_functions(tree):
Expand Down
2 changes: 0 additions & 2 deletions requirements/base.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
astroid>=1.6
asttokens>=1.1.10
flake8>=3
py>=1.5
six>=1.11.0
3 changes: 1 addition & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ asttokens==1.1.10
flake8==3.5.0
lazy-object-proxy==1.3.1 # via astroid
mccabe==0.6.1 # via flake8
py==1.5.2
pycodestyle==2.3.1 # via flake8
pyflakes==1.6.0 # via flake8
six==1.11.0
six==1.11.0 # via astroid, asttokens
wrapt==1.10.11 # via astroid
1 change: 1 addition & 0 deletions requirements/dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
ipdb
ipython
pip-tools
twine
11 changes: 11 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
astroid==1.6.2
asttokens==1.1.10
attrs==17.4.0
certifi==2018.1.18 # via requests
chardet==3.0.4 # via requests
click==6.7 # via pip-tools
decorator==4.2.1 # via ipython, traitlets
docutils==0.14
first==2.0.1 # via pip-tools
flake8==3.5.0
idna==2.6 # via requests
ipdb==0.11
ipython-genutils==0.2.0 # via traitlets
ipython==6.2.1
Expand All @@ -22,6 +26,7 @@ parso==0.1.1 # via jedi
pexpect==4.4.0 # via ipython
pickleshare==0.7.4 # via ipython
pip-tools==1.11.0
pkginfo==1.4.2 # via twine
pluggy==0.6.0
prompt-toolkit==1.0.15 # via ipython
ptyprocess==0.5.2 # via pexpect
Expand All @@ -31,10 +36,16 @@ pyflakes==1.6.0
pygments==2.2.0 # via ipython
pytest-flake8dir==1.2.0
pytest==3.4.1
requests-toolbelt==0.8.0 # via twine
requests==2.18.4 # via requests-toolbelt, twine
restructuredtext-lint==1.1.3
simplegeneric==0.8.1 # via ipython
six==1.11.0
tox==2.9.1
tqdm==4.22.0 # via twine
traitlets==4.3.2 # via ipython
twine==1.11.0
urllib3==1.22 # via requests
virtualenv==15.1.0
wcwidth==0.1.7 # via prompt-toolkit
wrapt==1.10.11
Expand Down
2 changes: 2 additions & 0 deletions requirements/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ flake8
isort
pytest
pytest-flake8dir
restructuredtext-lint
six
tox
yapf
4 changes: 3 additions & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
astroid==1.6.2
asttokens==1.1.10
attrs==17.4.0 # via pytest
docutils==0.14 # via restructuredtext-lint
flake8==3.5.0
isort==4.3.4
lazy-object-proxy==1.3.1
mccabe==0.6.1
pluggy==0.6.0 # via pytest, tox
py==1.5.2
py==1.5.2 # via pytest, tox
pycodestyle==2.3.1
pyflakes==1.6.0
pytest-flake8dir==1.2.0
pytest==3.4.1
restructuredtext-lint==1.1.3
six==1.11.0
tox==2.9.1
virtualenv==15.1.0 # via tox
Expand Down
9 changes: 8 additions & 1 deletion .isort.cfg → setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
[settings]
[isort]
include_trailing_comma=True
known_first_party=flake8_aaa
line_length=120
multi_line_output=3
not_skip=__init__.py

[flake8]
max-line-length = 120

[yapf]
dedent_closing_brackets = true
column_limit = 120
41 changes: 34 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
from __future__ import unicode_literals

import setuptools
import os

setuptools.setup(
name='flake8-aaa',
from setuptools import setup

basedir = os.path.dirname(__file__)


def readme():
with open(os.path.join(basedir, 'README.rst')) as f:
return f.read()


about = {}
with open(os.path.join(basedir, 'flake8_aaa', '__about__.py')) as f:
exec(f.read(), about)

setup(
# --- META ---
description='Flake8 plugin to check the style of Python tests to 3A standard',
name=about['__name__'],
version=about['__version__'],
description=about['__description__'],
license='MIT',
version='0.0.0',
long_description=readme(),
author='James Cooke',
author_email='[email protected]',
url='https://github.com/jamescooke/flake8-aaa',

# --- Python ---
packages=['flake8_aaa'],
Expand All @@ -17,12 +34,22 @@
'astroid >= 1.6',
'asttokens >= 1.1.10',
'flake8 >= 3',
'py >= 1.5',
'six >= 1.11.0',
],
entry_points={
'flake8.extension': [
'AAA = flake8_aaa:Checker',
],
},
classifiers=[
'Development Status :: 3 - Alpha',
'Framework :: Flake8',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python',
],
zip_safe=False,
)
4 changes: 3 additions & 1 deletion tests/test_run.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Integration tests that flake8 runs and checks using this plugin

from flake8_aaa.__about__ import __version__


def test_installed(flake8dir):
result = flake8dir.run_flake8(extra_args=['--version'])

assert 'aaa: 0.1' in result.out
assert 'aaa: {}'.format(__version__) in result.out


def test(flake8dir):
Expand Down
4 changes: 1 addition & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# lint = run all linting

[tox]
envlist = py{27,36}-{install,test,lint}
envlist = py{27,36}-{install,test},py36-lint
[testenv]
deps =
test,lint: -rrequirements/test.txt
Expand All @@ -12,5 +12,3 @@ commands =
test: pytest
lint: make lint
whitelist_externals = make
[flake8]
max-line-length = 120

0 comments on commit 230fd93

Please sign in to comment.