Skip to content

Commit

Permalink
documentation, benchmarking, and licensing
Browse files Browse the repository at this point in the history
  • Loading branch information
aleontiev committed Feb 2, 2016
1 parent eb657fa commit c8813a6
Show file tree
Hide file tree
Showing 95 changed files with 23,025 additions and 243 deletions.
37 changes: 37 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
We encourage bug reports, suggestions for improvements, and direct contributions through Github Issues/Pull Requests.

When making contributions, try to follow these guidelines:

# Development

## Style

Use `make lint` to check your code for style violations.

We use the `flake8` and `isort` linters to enforce PEP8 code style.
For additional details, see our [Python style guide](https://github.com/AltSchool/Python).

## Documentation

Use `make docs` to generate the automated documentation for the project.

We recommend documenting all public modules, classes, and methods, but generating the documentation is not required.

## Tests

Use `make test` to lint and run all unit tests (runs in a few seconds).
Use `make tox` to run all unit tests against all supported combinations of Python, Django, and Django REST Framework (can take several minutes).

We recommend linting regularly, testing with every commit, and running tests against all combinations before submitting a pull request.

## Benchmarks

Use `make benchmark` to benchmark your changes against the latest version of Django REST Framework (can take several minutes).

We recommend running this before submitting a pull request. Doing so will create a [benchmarks.html](benchmarks.html) file in the repository root directory.

# Submission

Please submit your pull request with a clear title and description.
Any visual changes (e.g. to the Browsable API) should include screenshots in the description.
Any related issues in Dynamic REST, Django REST Framework, or Django should include a URL reference to the issue.
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright AltSchool, PBC (c) 2016

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 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.
34 changes: 30 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ EXTRACT_REGEX := 's~^$(WHITESPACE)$(WORD)$(WHITESPACE)=$(WHITESPACE)$(QUOTE)(.*)
ORG_NAME := $(shell grep ORG_NAME constants.py | sed -E $(EXTRACT_REGEX))
REPO_NAME := $(shell grep REPO_NAME constants.py | sed -E $(EXTRACT_REGEX))
APP_NAME := $(shell grep APP_NAME constants.py | sed -E $(EXTRACT_REGEX))
PROJECT_NAME := $(shell grep PROJECT_NAME constants.py | sed -E $(EXTRACT_REGEX))
AUTHOR_EMAIL := $(shell grep AUTHOR_EMAIL constants.py | sed -E $(EXTRACT_REGEX))
VERSION := $(shell grep VERSION constants.py | sed -E $(EXTRACT_REGEX))

INSTALL_PREFIX := /usr/local
INSTALL_DIR := $(INSTALL_PREFIX)/$(ORG_NAME)/$(REPO_NAME)
Expand All @@ -16,6 +19,18 @@ define header
@tput sgr0
endef

.PHONY: docs

docs: install
$(call header,"Building docs")
@rm -rf ./docs
@$(INSTALL_DIR)/bin/sphinx-apidoc -F -o ./docs $(APP_NAME) -H "$(PROJECT_NAME)" -A "$(AUTHOR_EMAIL)" -V $(VERSION) -R $(VERSION)
@sed -i -E "s/sphinx.ext.autodoc'/sphinx.ext.autodoc', 'sphinx.ext.napoleon'/" ./docs/conf.py
@rm -rf ./docs/conf.py-E
@DJANGO_SETTINGS_MODULE='tests.settings' $(INSTALL_DIR)/bin/sphinx-build -b html ./docs ./_docs
@cp -r ./_docs/* ./docs
@rm -rf ./_docs

# Build/install the app
# Runs on every command
install: $(INSTALL_DIR)
Expand Down Expand Up @@ -49,9 +64,20 @@ test: lint install
@$(INSTALL_DIR)/bin/py.test --cov=$(APP_NAME) --tb=short -q -s -rw tests/$(TEST)

# Run all tests (tox)
tox: lint install
tox: install
$(call header,"Running multi-version tests")
@$(INSTALL_DIR)/bin/tox
@$(INSTALL_DIR)/bin/tox $(CMD)

# Benchmarks
benchmarks: benchmark
benchmark: install
$(call header,"Running benchmarks")
@$(INSTALL_DIR)/bin/python runtests.py --benchmarks --fast

# Create test app migrations
migrations: install
$(call header,"Creating test app migrations")
$(INSTALL_DIR)/bin/python manage.py makemigrations --settings=tests.settings

# Start the Django shell
shell: install
Expand All @@ -74,9 +100,9 @@ start: install
# Lint the project
lint: clean_working_directory
$(call header,"Linting code")
@find . -type f -name '*.py' | xargs flake8
@find . -type f -name '*.py' -not -path './docs/*' -not -path './build/*' | xargs flake8

# Auto-format the project
format: clean_working_directory
$(call header,"Auto-formatting code")
@find . -type f -name '*.py' | xargs flake8 | sed -E 's/^([^:]*\.py).*/\1/g' | uniq | xargs autopep8 --experimental -a --in-place
@find $(APP_NAME) -type f -name '*.py' | xargs flake8 | sed -E 's/^([^:]*\.py).*/\1/g' | uniq | xargs autopep8 --experimental -a --in-place
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: manage.py migrate --settings=tests.settings && manage.py runserver 0.0.0.0:$PORT --settings=tests.settings
Loading

0 comments on commit c8813a6

Please sign in to comment.