Skip to content

Commit

Permalink
Merge pull request #46 from pavdmyt/switch-to-poetry
Browse files Browse the repository at this point in the history
Switch to poetry
  • Loading branch information
pavdmyt authored May 8, 2020
2 parents d1ad636 + 9dc0560 commit fe14dc5
Show file tree
Hide file tree
Showing 24 changed files with 963 additions and 271 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,3 @@ venv.bak/

# mypy
.mypy_cache/

# My
Pipfile.lock
47 changes: 14 additions & 33 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,27 @@
sudo: false
language: python
dist: bionic
cache: pip
env:
- PYTHONHASHSEED=0
install:
- make travis-setup
python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
# PyPy versions
- "pypy2"
- "pypy3"
script:
- make ci

jobs:
include:
- stage: test
script:
- make ci
python: '2.7'
- stage: test
script:
- make ci
python: '3.4'
- stage: test
script:
- make ci
python: '3.5'
- stage: test
script:
- make ci
python: '3.6'
- stage: test
script:
- make ci
python: '3.7'
dist: xenial
sudo: true
- stage: test
script:
- make ci
python: 'pypy'
- stage: test
script:
- make ci
python: 'pypy3'
- stage: coverage
python:
- 2.7
- 3.6
- "3.6"
script:
- make coverage
after_success:
Expand Down
11 changes: 11 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Release History
===============

0.17.0 / 2020-05-08
-------------------

* Migrate to ``poetry`` for dependencies management, building and publishing project
* Add tests for Python 3.8
* Deprecate support for Python 3.4
* Run tests under Ubuntu 18.04
* Update dev dependencies to the most recent ones (compatible with Python 2.7)
* Remove Tox from the project (use CI for tests under different versions of Python)


0.16.0 / 2020-01-11
-------------------

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Pavlo Dmytrenko
Copyright (c) 2020 Pavlo Dmytrenko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

85 changes: 40 additions & 45 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,33 @@ NO_COLOR=\033[0m
.PHONY: build

name='yaspin'
version=`python -c 'import yaspin; print(yaspin.__version__)'`

# Use $$ if running awk inside make
# https://lists.freebsd.org/pipermail/freebsd-questions/2012-September/244810.html
version := $(shell poetry version | awk '{ print $$2 }')
pypi_usr := $(shell grep username ~/.pypirc | awk -F"= " '{ print $$2 }')
pypi_pwd := $(shell grep password ~/.pypirc | awk -F"= " '{ print $$2 }')

flake:
@echo "$(OK_COLOR)==> Linting code ...$(NO_COLOR)"
@flake8 .
@poetry run flake8 .

# pylint should be available as external tool
#
# No way to add it as tool.poetry.dev-dependencies,
# since versions "^1.9" have known security vulnerabilities, affecting versions
# <2.5.0 (as reported by pyup.io). At the same time v2.0.0 deprecates Py2 support.
lint:
@echo "$(OK_COLOR)==> Linting code ...$(NO_COLOR)"
@pylint setup.py $(name)/ -rn -f colorized --ignore termcolor.py

isort-all:
isort -rc --atomic --verbose setup.py $(name)/
@poetry run isort -rc --atomic --verbose setup.py $(name)/

# black should be available as external tool
#
# No way to add it as tool.poetry.dev-dependencies,
# since it conflicts with any Py <3.6
black-fmt:
black --line-length 79 --exclude "termcolor.py" \
./yaspin ./tests ./examples ./setup.py
Expand All @@ -34,41 +48,38 @@ clean-pyc:

test: clean-pyc flake
@echo "$(OK_COLOR)==> Runnings tests ...$(NO_COLOR)"
@py.test -n auto
@poetry run py.test -n auto

ci:
# pipenv run py.test -n auto
#
# Temporary solution; till fix for https://github.com/pypa/pipenv/issues/3313
# is not released at PyPI
py.test -n auto
poetry run py.test -n auto

coverage: clean-pyc
@echo "$(OK_COLOR)==> Calculating coverage...$(NO_COLOR)"
# @pipenv run py.test --cov-report term --cov-report html --cov $(name) tests/
#
# Temporary solution; till fix for https://github.com/pypa/pipenv/issues/3313
# is not released at PyPI
@py.test --cov-report term --cov-report html --cov $(name) tests/
@poetry run py.test --cov-report term --cov-report html --cov $(name) tests/
@echo "open file://`pwd`/htmlcov/index.html"

rm-build:
@rm -rf build dist .egg $(name).egg-info

# requires docutils and pygments to be installed
# -s stands for strict (raises errors instead of warnings)
# https://github.com/pypa/readme_renderer#check-description-locally
# https://github.com/pypa/twine#twine-check
#
# pylint should be available as external tool
#
# No way to add it as tool.poetry.dev-dependencies,
# since versions "<2" have known security vulnerabilities
# (as reported by pyup.io). At the same time v2.0.0 deprecates Py2 support.
check-rst:
@python setup.py check --restructuredtext -s
@echo "$(OK_COLOR)==> Checking RST will render...$(NO_COLOR)"
@twine check dist/*

build: rm-build
@echo "$(OK_COLOR)==> Building...$(NO_COLOR)"
@python setup.py sdist
@python setup.py bdist_wheel --universal
@poetry build

publish: flake check-rst rm-build
publish: flake build check-rst
@echo "$(OK_COLOR)==> Publishing...$(NO_COLOR)"
@python setup.py sdist upload -r pypi
@python setup.py bdist_wheel --universal upload -r pypi
@poetry publish -u $(pypi_usr) -p $(pypi_pwd)

tag:
@echo "$(OK_COLOR)==> Creating tag $(version) ...$(NO_COLOR)"
Expand All @@ -77,30 +88,14 @@ tag:
@git push origin "v$(version)"

bump:
@bumpversion \
--commit \
--current-version $(version) patch \
./$(name)/__version__.py \
--allow-dirty
@poetry version patch

bump-minor:
@bumpversion \
--commit \
--current-version $(version) minor \
./$(name)/__version__.py \
--allow-dirty
@poetry version minor

travis-setup:
# pip install pipenv --upgrade
# pipenv install pytest~=3.6.3 --skip-lock
# pipenv install pytest-xdist~=1.22.2 --skip-lock
# pipenv install pytest-cov~=2.5.1 --skip-lock
# pipenv install python-coveralls~=2.9.1 --skip-lock
#
# Temporary solution; till fix for https://github.com/pypa/pipenv/issues/3313
# is not released at PyPI
pip install pytest~=3.6.3
pip install pytest-xdist~=1.22.2
pip install pytest-cov~=2.5.1
pip install pyyaml==5.1.2 # python-coveralls dep; recently dropped py34 support
pip install python-coveralls~=2.9.1
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
poetry install

export-requirements:
@poetry export -f requirements.txt --dev > requirements.txt
25 changes: 0 additions & 25 deletions Pipfile

This file was deleted.

7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Features
--------

- No external dependencies
- Runs at all major **CPython** versions (*2.7*, *3.4*, *3.5*, *3.6*, *3.7*), **PyPy** and **PyPy3**
- Runs at all major **CPython** versions (*2.7*, *3.5*, *3.6*, *3.7*, *3.8*), **PyPy** and **PyPy3**
- Supports all (60+) spinners from `cli-spinners`_
- Supports all *colors*, *highlights*, *attributes* and their mixes from `termcolor`_ library
- Easy to combine with other command-line libraries, e.g. `prompt-toolkit`_
Expand Down Expand Up @@ -370,7 +370,10 @@ Install dev dependencies:

.. code-block:: bash
pipenv install --dev
poetry install
# if you don't have poetry installed:
pip install -r requirements.txt
Lint code:
Expand Down
Loading

0 comments on commit fe14dc5

Please sign in to comment.