Skip to content

Commit

Permalink
Improved packaging. Close #32.
Browse files Browse the repository at this point in the history
We moved every package informations into 'setup.cfg' and now
'setup.py' is only an entrypoint for setuptools. tox and pytest
configurations has been moved also into 'setup.cfg'.

Makefile has been updated and python-venv has been dropped in profit
of virtualenv to ease development.
  • Loading branch information
sveetch committed Oct 1, 2018
1 parent 4e5337d commit d92cd43
Show file tree
Hide file tree
Showing 11 changed files with 185 additions and 72 deletions.
2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

42 changes: 28 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,41 @@
# virtualenv
.venv

# Packaging
build
dist
*.egg-info

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# virtualenv
/venv
# Site media
/data/

# Distribution / packaging
.installed.cfg
dist/
*.egg-info
# Settings
local.py

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
.pytest_cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
.pytest_cache

# Various
boussole/dev_inspector.py
# Temp files
*~
.~lock*

# Swap files
*.sw[po]

# SASS
.sass-cache

# Exported strings & generated translation templates
*.pot

# Tests
.tox
2 changes: 1 addition & 1 deletion LICENCE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
OTHER DEALINGS IN THE SOFTWARE.
61 changes: 35 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,48 +1,57 @@
PYTHON=python3

PIP=venv/bin/python -m pip
FLAKE=venv/bin/flake8
PYTEST=venv/bin/py.test

.PHONY: help clean delpyc tests flake quality
PYTHON_INTERPRETER=python3
VENV_PATH=.venv
PIP=$(VENV_PATH)/bin/pip
FLAKE=$(VENV_PATH)/bin/flake8
PYTEST=$(VENV_PATH)/bin/pytest

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo
@echo " clean -- to clean local repository from all stuff created during development"
@echo " delpyc -- to remove all *.pyc files, this is recursive from the current directory"
@echo " flake -- to launch Flake8 checking on boussole code (not the tests)"
@echo " tests -- to launch tests using py.test"
@echo " quality -- to launch Flake8 checking and tests with py.test"
@echo " release -- to release new package on Pypi (WARNING)"
@echo " install -- to install this project with virtualenv and Pip"
@echo ""
@echo " clean -- to clean EVERYTHING"
@echo " clean-install -- to clean installation"
@echo " clean-pycache -- to remove all __pycache__, this is recursive from current directory"
@echo ""
@echo " flake -- to launch Flake8 checking"
@echo " tests -- to launch tests using Pytest"
@echo " quality -- to launch Flake8 checking and Pytest"
@echo

delpyc:
clean-pycache:
find . -type d -name "__pycache__"|xargs rm -Rf
find . -name "*\.pyc"|xargs rm -f
rm -Rf .pytest_cache
.PHONY: clean-pycache

clean-install:
rm -Rf $(VENV_PATH)
rm -Rf .tox
rm -Rf boussole.egg-info
.PHONY: clean-install

clean: delpyc
rm -Rf venv dist .tox boussole.egg-info .cache tests/__pycache__/
clean: clean-install clean-pycache
.PHONY: clean

venv:
$(PYTHON) -m venv venv
virtualenv -p $(PYTHON_INTERPRETER) $(VENV_PATH)
# This is required for those ones using ubuntu<16.04
$(PIP) install --upgrade pip
$(PIP) install --upgrade setuptools
.PHONY: venv

install: venv
$(PIP) install -e .

install-dev: install
$(PIP) install -r requirements/dev.txt
mkdir -p data
$(PIP) install -e .[dev]
.PHONY: install

flake:
$(FLAKE) --show-source boussole
.PHONY: flake

tests:
$(PYTEST) -vv tests
$(PYTEST) -vv --exitfirst tests/
.PHONY: tests

quality: tests flake

release:
python setup.py sdist
python setup.py sdist upload
.PHONY: quality
25 changes: 24 additions & 1 deletion boussole/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# -*- coding: utf-8 -*-
"""Commandline interface to build Sass projects using libsass-python"""
__version__ = '1.3.0'
from __future__ import absolute_import, unicode_literals

import os
from setuptools.config import read_configuration

import pkg_resources

PROJECT_DIR = os.path.join(os.path.dirname(__file__), "..")


def _extract_version(package_name):
"""
Get package version from installed distribution or configuration file if not
installed
"""
try:
return pkg_resources.get_distribution(package_name).version
except pkg_resources.DistributionNotFound:
_conf = read_configuration(os.path.join(PROJECT_DIR, "setup.cfg"))
return _conf["metadata"]["version"]


__version__ = _extract_version("boussole")
9 changes: 9 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
Changelog
=========

Version 1.4.0 - 2018/10/01
--------------------------

**Improved packaging**

We moved every package informations into ``setup.cfg`` and now ``setup.py`` is only an entrypoint for setuptools. tox and pytest configurations has been moved also into ``setup.cfg``.

Makefile has been updated and python-venv has been dropped in profit of virtualenv to ease development.

Version 1.3.0 - 2018/09/30
--------------------------

Expand Down
10 changes: 4 additions & 6 deletions docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,20 @@ Boussole is developed with:
* Respecting flake and pip8 rules using `Flake8`_;
* `Sphinx`_ for documentation with enabled `Napoleon`_ extension (using only the *Google style*);

Every requirement is available in file ``requirements/dev.txt``.

Install for development
***********************

First ensure you have `pip`_ and ``python-venv`` package installed then type: ::
First ensure you have `pip`_ and `virtualenv`_ package installed then type: ::

git clone https://github.com/sveetch/boussole.git
cd boussole
make install-dev
make install

Boussole will be installed in editable mode from the last commit on master branch.

When it's done, you will be able to check for boussole version, just type: ::

venv/bin/boussole version
.venv/bin/boussole version

Unittests
---------
Expand Down Expand Up @@ -67,4 +65,4 @@ When environnement is activated, you can use following command from ``docs/`` di

make livehtml

And go on ``http://127.0.0.1:8002/``.
And go on ``http://127.0.0.1:8002/``.
4 changes: 0 additions & 4 deletions requirements/dev.txt

This file was deleted.

3 changes: 0 additions & 3 deletions requirements/tests.txt

This file was deleted.

88 changes: 84 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,86 @@
[aliases]
test=pytest
;;
;; Boussole package
;;
[metadata]
name = boussole
version =1.4.0
description = Commandline interface to build Sass projects using libsass-python
long_description = file:README.rst
long_description_content_type = text/x-rst
author = David Thenon
author_email = [email protected]
url = https://github.com/sveetch/boussole
license = MIT
keywords = Scss, Sass, Libsass, watchdog
classifiers =
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Development Status :: 5 - Production/Stable
Environment :: Console
Programming Language :: Python
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3.5
Intended Audience :: Developers
Topic :: Internet
Topic :: Software Development :: Compilers
Topic :: Software Development :: Libraries :: Python Modules

[options]
include_package_data = True
install_requires =
six
click>=5.1,<6.0
pathtools
watchdog
libsass>=0.14.5
pyaml
colorama
colorlog
packages = find:
zip_safe = True

[options.extras_require]
dev =
flake8
pytest
sphinx
sphinx-rtd-theme
sphinx-autobuild

[options.packages.find]
where = .
exclude=
docs
tests

[wheel]
universal = 1

;;
;; Third-party packages configuration
;;
[flake8]
max-line-length = 80
exclude =
.git,
.venv,
build,
venv,
__pycache__,

[tool:pytest]
testpaths = tests
python_files = *.py
addopts = -vv
python_files =
*.py
testpaths =
tests

[tox:tox]
minversion = 3.4.0
envlist = py27, py35

[testenv]

commands =
pip install -e .[dev]
pytest -vv tests
11 changes: 0 additions & 11 deletions tox.ini

This file was deleted.

0 comments on commit d92cd43

Please sign in to comment.