Skip to content

Commit

Permalink
Merge pull request #77 from AltSchool/feature/distribution
Browse files Browse the repository at this point in the history
add pypi wrappers + contributing guide
  • Loading branch information
ryochiji committed Feb 6, 2016
2 parents 8b054be + 5b797fb commit 0ce1ec0
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ db.sqlite3

# pyenv
.python-version

# pypi
.pypirc
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,14 @@ We recommend running this before submitting a pull request. Doing so will create
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.

# Publishing

(PyPi and repository write access required)

Before releasing:

- Check/update the version in `constants.py`
- Commit changes and tag the commit with the version, prefixed by "v"
- Run `make pypi_upload_test` to upload a new version to PyPiTest. Check the contents at https://pypitest.python.org/pypi/dynamic-rest
- Run `make pypi_upload` to upload a new version to PyPi. Check the contents at https://pypi.python.org/pypi/dynamic-rest
9 changes: 9 additions & 0 deletions LICENSE.txt
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.
28 changes: 22 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ QUOTE := [\"]
WORD := [A-Z_]+
WHITESPACE := [ ]*
EXTRACT_REGEX := 's~^$(WHITESPACE)$(WORD)$(WHITESPACE)=$(WHITESPACE)$(QUOTE)(.*)$(QUOTE)$$~\1~'
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))
ORG_NAME := $(shell grep ORG_NAME dynamic_rest/constants.py | sed -E $(EXTRACT_REGEX))
REPO_NAME := $(shell grep REPO_NAME dynamic_rest/constants.py | sed -E $(EXTRACT_REGEX))
APP_NAME := $(shell grep APP_NAME dynamic_rest/constants.py | sed -E $(EXTRACT_REGEX))
PROJECT_NAME := $(shell grep PROJECT_NAME dynamic_rest/constants.py | sed -E $(EXTRACT_REGEX))
AUTHOR_EMAIL := $(shell grep AUTHOR_EMAIL dynamic_rest/constants.py | sed -E $(EXTRACT_REGEX))
VERSION := $(shell grep VERSION dynamic_rest/constants.py | sed -E $(EXTRACT_REGEX))

INSTALL_PREFIX := /usr/local
INSTALL_DIR := $(INSTALL_PREFIX)/$(ORG_NAME)/$(REPO_NAME)
Expand All @@ -21,6 +21,22 @@ endef

.PHONY: docs

pypi_register_test: install
$(call header,"Registering with PyPi - test")
@. $(INSTALL_DIR)/bin/activate; python setup.py register -r pypitest

pypi_register: install
$(call header,"Registering with PyPi")
@. $(INSTALL_DIR)/bin/activate; python setup.py register -r pypi

pypi_upload_test: install
$(call header,"Uploading new version to PyPi - test")
@. $(INSTALL_DIR)/bin/activate; python setup.py sdist upload -r pypitest

pypi_upload: install
$(call header,"Uploading new version to PyPi")
@. $(INSTALL_DIR)/bin/activate; python setup.py sdist upload -r pypi

docs: install
$(call header,"Building docs")
@rm -rf ./docs
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Dynamic REST

[![Circle CI](https://circleci.com/gh/AltSchool/dynamic-rest.svg?style=svg)](https://circleci.com/gh/AltSchool/dynamic-rest)
[![PyPi](https://img.shields.io/pypi/v/dynamic-rest.svg)](https://pypi.python.org/pypi/dynamic-rest)

**Dynamic API extensions for Django REST Framework**

Expand Down
2 changes: 1 addition & 1 deletion constants.py → dynamic_rest/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
REPO_NAME = "dynamic-rest"
PROJECT_NAME = "Dynamic REST"
ORG_NAME = "AltSchool"
VERSION = "1.3.14"
VERSION = "1.3.15"
2 changes: 1 addition & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys

import pytest
from constants import APP_NAME
from dynamic_rest.constants import APP_NAME

TESTS = 'tests'
BENCHMARKS = 'benchmarks'
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.md
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from setuptools import find_packages, setup

from constants import (
APP_NAME,
from dynamic_rest.constants import (
AUTHOR,
AUTHOR_EMAIL,
DESCRIPTION,
Expand All @@ -20,7 +19,7 @@
dependency_links=open('dependency_links.txt').readlines(),
install_requires=open('install_requires.txt').readlines(),
long_description=open('README.md').read(),
name=APP_NAME,
name=REPO_NAME,
packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES),
scripts=['manage.py'],
url='http://github.com/%s/%s' % (ORG_NAME, REPO_NAME),
Expand Down

0 comments on commit 0ce1ec0

Please sign in to comment.