Skip to content

Commit cacdc29

Browse files
committed
[1.4.0] Project and package refactoring
* Drop 'six' usage; * Drop 'django-braces' usage; * Migrate to 'setup.cfg' for package configuration; * Cover every supported Django versions with tox; * Updated demo project with sandbox; * Add documentation on ReadTheDoc; * Update 'icon_map.scss' template to include a Sass map for available icons, close #11;
1 parent 8c69501 commit cacdc29

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1266
-607
lines changed

.gitignore

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,40 @@
11
# virtualenv
2-
/venv
2+
.venv
33

4-
#egg's specific
4+
# Packaging
5+
build
6+
dist
57
*.egg-info
68

7-
#defaults
8-
/dist
9-
*.pyc
10-
*.pyo
9+
# Byte-compiled / optimized / DLL files
10+
__pycache__/
11+
*.py[cod]
1112

12-
#tests
13-
.tox
13+
# Unit test / coverage reports
14+
htmlcov/
15+
.coverage
1416
.cache
15-
__pycache__
17+
.pytest_cache
18+
nosetests.xml
19+
coverage.xml
20+
.tox
21+
22+
# Site media and builded statics
23+
/data/
24+
/sandbox/static
25+
26+
# VS Code
27+
.vscode
28+
29+
# Mac Os
30+
.DS_Store
31+
32+
# Temp files
33+
*~
34+
.~lock*
35+
36+
# Swap files
37+
*.sw[po]
1638

17-
#django
18-
project_test/db.sqlite3
19-
project_test/project/settings/local.py
20-
project_test/project/static
39+
# Logging files
40+
*.log

.readthedocs.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Build documentation in the docs/ directory with Sphinx
9+
sphinx:
10+
configuration: docs/conf.py
11+
12+
# Optionally set the version of Python and requirements required to build your docs
13+
python:
14+
version: 3.6
15+
install:
16+
- requirements: docs/requirements.txt

LICENCE.txt

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
Copyright (c) 2015 David Thenon.
1+
MIT License
22

3-
Permission is hereby granted, free of charge, to any person
4-
obtaining a copy of this software and associated documentation
5-
files (the "Software"), to deal in the Software without
6-
restriction, including without limitation the rights to use,
7-
copy, modify, merge, publish, distribute, sublicense, and/or sell
8-
copies of the Software, and to permit persons to whom the
9-
Software is furnished to do so, subject to the following
10-
conditions:
3+
Copyright (c) 2020, David Thenon
114

12-
The above copyright notice and this permission notice shall be
13-
included in all copies or substantial portions of the Software.
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
1411

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22-
OTHER DEALINGS IN THE SOFTWARE.
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ recursive-include icomoon/static *
77
recursive-include icomoon/locale *
88
recursive-include icomoon/test_fixtures *
99

10-
recursive-exclude project_test *
11-
recursive-exclude project_test .cache
12-
recursive-exclude project_test __pycache__
13-
recursive-exclude project_test *.pyc
10+
recursive-exclude tests *
11+
recursive-exclude sandbox *
12+
recursive-exclude * __pycache__
13+
recursive-exclude * *.py[co]

Makefile

Lines changed: 94 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,113 @@
1-
PYTHON=python3
2-
3-
PIP=venv/bin/python -m pip
4-
FLAKE=venv/bin/flake8
5-
PYTEST=venv/bin/py.test
6-
DJANGOMANAGER=venv/bin/python project_test/manage.py
7-
8-
.PHONY: help clean delpyc install install-dev tests flake quality runserver
1+
PYTHON_INTERPRETER=python3
2+
VENV_PATH=.venv
3+
PACKAGE_NAME=django-icomoon
4+
PACKAGE_SLUG=`echo $(PACKAGE_NAME) | tr '-' '_'`
5+
APPLICATION_NAME=icomoon
6+
PIP=$(VENV_PATH)/bin/pip
7+
FLAKE=$(VENV_PATH)/bin/flake8
8+
PYTEST=$(VENV_PATH)/bin/pytest
9+
TWINE=$(VENV_PATH)/bin/twine
10+
DJANGO_MANAGE=$(VENV_PATH)/bin/python sandbox/manage.py
11+
SPHINX_RELOAD=$(VENV_PATH)/bin/python sphinx_reload.py
912

1013
help:
1114
@echo "Please use \`make <target>' where <target> is one of"
1215
@echo
13-
@echo " delpyc -- to remove all *.pyc files, this is recursive from the current directory"
14-
@echo " clean -- to clean local repository from all stuff created during development"
15-
@echo
16-
@echo " install -- to install as develop package"
17-
@echo " install-dev -- to install as develop package with every for development"
18-
@echo
19-
@echo " flake -- to launch Flake8 checking on boussole code (not the tests)"
20-
@echo " tests -- to launch tests using py.test"
21-
@echo " quality -- to launch Flake8 checking and tests with py.test"
22-
@echo
23-
@echo " runserver -- to launch a Django instance on 0.0.0.0:8001"
16+
@echo " install -- to install this project with virtualenv and Pip"
17+
@echo ""
18+
@echo " clean -- to clean EVERYTHING (Warning)"
19+
@echo " clean-pycache -- to remove all __pycache__, this is recursive from current directory"
20+
@echo " clean-statics -- to clean static stuff from sandbox"
21+
@echo " clean-install -- to clean Python side installation"
22+
@echo ""
23+
@echo " run -- to run Django development server"
24+
@echo " migrate -- to apply demo database migrations"
25+
@echo " superuser -- to create a superuser for Django admin"
26+
@echo " icomoon -- to deploy an icon font map on demo from an Icomoon snapshot (icomoon.zip)"
27+
@echo ""
28+
@echo " livedocs -- to run livereload server to rebuild documentation on source changes"
29+
@echo ""
30+
@echo " flake -- to launch Flake8 checking"
31+
@echo " tests -- to launch base test suite using Pytest"
32+
@echo " quality -- to launch Flake8 checking and every tests suites"
33+
@echo ""
34+
@echo " release -- to release package for latest version on PyPi (once release has been pushed to repository)"
2435
@echo
2536

26-
delpyc:
37+
clean-pycache:
38+
rm -Rf .pytest_cache
39+
find . -type d -name "__pycache__"|xargs rm -Rf
2740
find . -name "*\.pyc"|xargs rm -f
41+
.PHONY: clean-pycache
42+
43+
clean-statics:
44+
rm -Rf sandbox/static
45+
.PHONY: clean-statics
2846

29-
clean: delpyc
30-
rm -Rf venv dist .tox django_icomoon.egg-info .cache project_test/.cache/ project_test/__pycache__/ project_test/tests/__pycache__/
47+
clean-install:
48+
rm -Rf $(VENV_PATH)
49+
rm -Rf $(PACKAGE_SLUG).egg-info
50+
.PHONY: clean-install
51+
52+
clean: clean-install clean-pycache clean-statics
53+
.PHONY: clean
3154

3255
venv:
33-
$(PYTHON) -m venv venv
56+
virtualenv -p $(PYTHON_INTERPRETER) $(VENV_PATH)
57+
# This is required for those ones using old distribution
58+
$(PIP) install --upgrade pip
59+
$(PIP) install --upgrade setuptools
60+
.PHONY: venv
61+
62+
create-var-dirs:
63+
@mkdir -p data/db
64+
@mkdir -p data/static/css
65+
@mkdir -p sandbox/media
66+
@mkdir -p sandbox/static/css
67+
.PHONY: create-var-dirs
68+
69+
migrate:
70+
@DJANGO_SECRET_KEY=$(DEMO_DJANGO_SECRET_KEY) \
71+
$(DJANGO_MANAGE) migrate
72+
.PHONY: migrate
73+
74+
superuser:
75+
@DJANGO_SECRET_KEY=$(DEMO_DJANGO_SECRET_KEY) \
76+
$(DJANGO_MANAGE) createsuperuser
77+
.PHONY: superuser
78+
79+
install: venv create-var-dirs
80+
$(PIP) install -e .[dev]
81+
${MAKE} migrate
82+
.PHONY: install
83+
84+
run:
85+
@DJANGO_SECRET_KEY=$(DEMO_DJANGO_SECRET_KEY) \
86+
$(DJANGO_MANAGE) runserver 0.0.0.0:8001
87+
.PHONY: run
3488

35-
install: venv
36-
$(PIP) install -e .
89+
icomoon:
90+
$(DJANGO_MANAGE) icomoon_deploy
91+
.PHONY: icomoon
3792

38-
install-dev: install
39-
$(PIP) install -r requirements/dev.txt
93+
livedocs:
94+
$(SPHINX_RELOAD)
95+
.PHONY: livedocs
4096

4197
flake:
42-
$(FLAKE) --show-source icomoon
98+
$(FLAKE) --show-source $(APPLICATION_NAME)
99+
$(FLAKE) --show-source tests
100+
.PHONY: flake
43101

44102
tests:
45-
$(PYTEST) -vv project_test/
103+
$(PYTEST) -vv tests/
104+
.PHONY: tests
46105

47106
quality: tests flake
107+
.PHONY: quality
48108

49-
runserver:
50-
@if [ ! -e project_test/db.sqlite3 ]; then $(DJANGOMANAGER) migrate --settings=project.settings.development; fi;
51-
$(DJANGOMANAGER) runserver 0.0.0.0:8001 --settings=project.settings.development
109+
release:
110+
rm -Rf dist
111+
$(VENV_PATH)/bin/python setup.py sdist
112+
$(TWINE) upload dist/*
113+
.PHONY: release

0 commit comments

Comments
 (0)