Skip to content

Commit

Permalink
Clean up makefile, setup.py, and add docs req
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphiee22 committed Jun 4, 2019
1 parent ac7a9fa commit 2e24170
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 36 deletions.
58 changes: 28 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: clean clean-test clean-pyc clean-build docs help
.DEFAULT_GOAL := help
.PHONY: help clean clean-pyc release dist

define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
Expand All @@ -24,67 +24,65 @@ export PRINT_HELP_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"

help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "release - package and upload a release"
@echo "dist - package"

clean: clean-build clean-pyc clean-test

clean-build: ## remove build artifacts
clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
rm -fr dist-packages-cache/
rm -fr dist-packages-temp/
rm -fr *.egg-info
rm -fr .eggs
rm -fr .cache

clean-pyc: ## remove Python file artifacts
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-docs:
$(MAKE) -C docs clean

clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/

lint: ## check style with flake8
flake8 morango tests
lint:
flake8 morango

test: ## run tests quickly with the default Python

python setup.py test
test:
pytest tests/testapp/tests/

test-all: ## run tests on every Python version with tox
test-all:
tox

coverage: ## check code coverage quickly with the default Python

coverage run --source morango setup.py test

coverage report -m
coverage html
$(BROWSER) htmlcov/index.html

docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/morango.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ morango
$(MAKE) -C docs clean
docs: clean-docs
$(MAKE) -C docs html

browserdocs: docs
$(BROWSER) docs/_build/html/index.html

servedocs: docs ## compile the docs watching for changes
servedocs: browserdocs ## compile the docs watching for changes
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .

release:
ls -l dist/
read "\nDo you want to upload everything in dist/*?\n\n CTRL+C to exit."
twine upload -s dist/*

dist: clean ## builds source and wheel package
python setup.py sdist
dist: clean
python setup.py sdist --format=gztar
python setup.py bdist_wheel
ls -l dist

install: clean ## install the package to the active Python's site-packages
python setup.py install
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Morango

[![image](https://img.shields.io/travis/learningequality/morango.svg)](https://travis-ci.org/learningequality/morango)

[![image](http://codecov.io/github/learningequality/morango/coverage.svg?branch=master)](http://codecov.io/github/learningequality/morango?branch=master)

[![image](https://readthedocs.org/projects/morango/badge/?version=latest)](http://morango.readthedocs.org/en/latest/)

Pure Python Django DB replication engine.

- Free software: MIT license
- Documentation: <https://morango.readthedocs.io>.
6 changes: 6 additions & 0 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-r base.txt

# These are for building the docs
sphinx==1.7.6
sphinx-rtd-theme==0.4.3
m2r==0.2.1
12 changes: 7 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from __future__ import print_function
from __future__ import unicode_literals

import io
import os

try: # for pip >= 10
Expand All @@ -15,8 +16,7 @@

import morango

with open('README.rst') as readme_file:
readme = readme_file.read()
readme = io.open("README.md", mode="r", encoding="utf-8").read()

req_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "requirements.txt")
reqs = parse_requirements(req_file, session=False)
Expand All @@ -26,7 +26,8 @@
name='morango',
version=morango.__version__,
description="Pure Python sqlite-based Django DB replication engine.",
long_description=readme + '\n\n',
long_description=readme,
long_description_content_type="text/markdown",
author="Learning Equality",
author_email='[email protected]',
url='https://github.com/learningequality/morango',
Expand All @@ -35,16 +36,17 @@
'morango'},
include_package_data=True,
install_requires=install_requires,
license="MIT license",
license="MIT",
zip_safe=False,
keywords=['database', 'syncing', 'morango'],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Development Status :: 4 - Beta',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
)
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ commands =
[testenv:docs]

changedir = docs
deps = sphinx
deps =
-r{toxinidir}/requirements/docs.txt
commands =
sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html

Expand Down

0 comments on commit 2e24170

Please sign in to comment.