Skip to content

Commit

Permalink
Remove hack for excluding dev versions
Browse files Browse the repository at this point in the history
The latest version of the build containers are buster based and have a
newer version of `git` that include the `--exclude` option.

Also, update README to use markdown.
  • Loading branch information
awiddersheim committed Sep 2, 2019
1 parent 2c12683 commit d4190b3
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 116 deletions.
52 changes: 11 additions & 41 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
environment:
TOXENV: py37

flake8: &tox-template
flake8:
docker:
- image: circleci/python:3
environment:
Expand All @@ -57,13 +57,6 @@ jobs:
- run: pip install --user tox
- run: /home/circleci/.local/bin/tox

check_readme:
<<: *tox-template
docker:
- image: circleci/python:3
environment:
TOXENV: check_readme

build:
docker:
- image: circleci/python:3
Expand All @@ -81,43 +74,29 @@ jobs:
paths:
- dist

deploy_pypi:
deploy:
docker:
- image: circleci/python:3
environment:
TOXENV: deploy_pypi
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run: pip install --user tox
- run: /home/circleci/.local/bin/tox -- '/tmp/workspace/dist/*'

deploy_github:
docker:
- image: circleci/python:3
environment:
TOXENV: deploy_github
TOXENV: deploy
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run: pip install --user tox
- run: |
export GITHUB_RELEASE_CICD_REPO=$(python setup.py --name)
export GITHUB_RELEASE_CICD_CREATE_TAG="v$(python setup.py --version)"
export GITHUB_RELEASE_CICD_CREATE_MESSAGE=$(git show --no-patch --pretty=format:"%s%n%b" ${CIRCLE_SHA1})
export GITHUB_RELEASE_CICD_CREATE_TARGET=${CIRCLE_SHA1}
/home/circleci/.local/bin/tox -- --assets '/tmp/workspace/dist/*'
export GITHUB_RELEASE_CICD_REPO="$(python setup.py --name)"
export GITHUB_RELEASE_CICD_CREATE_NAME="$(python setup.py --version)"
export GITHUB_RELEASE_CICD_CREATE_TAG="v${GITHUB_RELEASE_CICD_CREATE_NAME}"
export GITHUB_RELEASE_CICD_CREATE_MESSAGE="$([ -z "${CIRCLE_TAG}" ] && git show --no-patch --pretty=format:%s%n%n%b ${CIRCLE_SHA1} || git tag --list --format="%(contents)" ${CIRCLE_TAG})"
export GITHUB_RELEASE_CICD_CREATE_PRERELEASE="$([ -z "${CIRCLE_TAG}" ] && echo true || echo false)"
export GITHUB_RELEASE_CICD_CREATE_TARGET="${CIRCLE_SHA1}"
/home/circleci/.local/bin/tox -- '/tmp/workspace/dist/*'
workflows:
version: 2
test-and-build:
jobs:
- check_readme:
filters:
tags:
only: /^v.*/
- flake8:
filters:
tags:
Expand All @@ -144,7 +123,6 @@ workflows:
only: /^v.*/
- build:
requires:
- check_readme
- flake8
- python27
- python34
Expand All @@ -154,17 +132,9 @@ workflows:
filters:
tags:
only: /^v.*/
- deploy_pypi:
requires:
- build
filters:
tags:
only: /^v.*/
- deploy_github:
- deploy:
requires:
- build
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Flake8 Single Line Import Plugin

A Flake8 plugin that requires single line imports.

[![PyPI version](https://img.shields.io/pypi/v/flake8-import-single.svg)]( https://pypi.org/project/flake8-import-single)
[![Python Versions](https://img.shields.io/pypi/pyversions/flake8-import-single.svg)](https://pypi.org/project/flake8-import-single)
[![Build Status](https://img.shields.io/circleci/project/github/awiddersheim/flake8-import-single/master.svg)](https://circleci.com/gh/awiddersheim/flake8-import-single)
[![License](https://img.shields.io/pypi/l/flake8-import-single.svg)](https://github.com/awiddersheim/flake8-import-single/blob/master/LICENSE)

## Introduction

The following will result in an error:

```
from foo import bar, baz
```

It should be rewritten as:

```
from foo import bar
from foo import baz
```

## Installation

```
$ pip install flake8-import-single
$ pip install --upgrade flake8-import-single
```

## Plugin for Flake8

```
$ flake8 --version
3.5.0 (flake8-import-single: 0.1.2, mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.6.0)
```

## Thanks

Much thanks goes out to [flake8-print][flake8-print] as the basis for
this plugin.

[flake8-print]: https://github.com/JBKahn/flake8-print
54 changes: 0 additions & 54 deletions README.rst

This file was deleted.

7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def local_scheme(version):
from pkg_resources import iter_entry_points

# NOTE(awiddersheim): Modify default behaviour slighlty by not
# NOTE(awiddersheim): Modify default behaviour slightly by not
# adding any local scheme to a clean `master` branch.
if version.branch == 'master' and not version.dirty:
return ''
Expand All @@ -19,14 +19,14 @@ def local_scheme(version):
return item.load()(version)


with io.open('README.rst', encoding='utf-8') as f:
with io.open('README.md', encoding='utf-8') as f:
long_description = f.read()


setup(
name='flake8-import-single',
use_scm_version={
'git_describe_command': 'git describe --dirty --tags --long --match "v*.*" --exclude "*.dev*"',
'git_describe_command': 'git describe --dirty --tags --long --match "v*.*" --exclude "*.dev*" --first-parent',
'local_scheme': local_scheme,
'write_to': 'flake8_import_single/version.py',
},
Expand All @@ -38,6 +38,7 @@ def local_scheme(version):
url='https://github.com/awiddersheim/flake8-import-single',
description='Flake8 plugin that requires single line imports',
long_description=long_description,
long_description_content_type='text/markdown',
packages=find_packages(exclude=['tests', 'tests.*']),
install_requires=[
'flake8',
Expand Down
30 changes: 12 additions & 18 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,24 @@ passenv = FLAKE8_*
extras = dev
commands = flake8 {posargs}

[testenv:check_readme]
basepython = python3
skip_install = true
deps = docutils
commands = python setup.py check {posargs} -r -m -s

[testenv:build]
basepython = python3
skip_install = true
deps =
wheel
setuptools
commands = python setup.py {posargs} sdist bdist_wheel
twine
commands =
python setup.py {posargs} sdist bdist_wheel
twine check {posargs:dist/*}

[testenv:deploy_pypi]
[testenv:deploy]
basepython = python3
skip_install = true
passenv = TWINE_*
deps = twine
commands = twine upload --skip-existing {posargs:dist/*}

[testenv:deploy_github]
basepython = python3
skip_install = true
passenv = GITHUB_*
deps = github-release-cicd
commands = github_release_cicd create {posargs:--assets dist/*}
passenv = GITHUB_* TWINE_*
deps =
github-release-cicd
twine
commands =
twine upload --skip-existing {posargs:dist/*}
github_release_cicd create --assets {posargs:dist/*}

0 comments on commit d4190b3

Please sign in to comment.