From 9eeacae4a615ddd68935cf9a4f48c8326e37c069 Mon Sep 17 00:00:00 2001 From: aleontiev Date: Fri, 5 Feb 2016 16:42:48 -0500 Subject: [PATCH 1/4] add pypi wrappers + contributing guide --- .gitignore | 3 +++ CONTRIBUTING.md | 11 +++++++++++ LICENSE.txt | 9 +++++++++ Makefile | 16 ++++++++++++++++ README.md | 1 + setup.cfg | 2 ++ setup.py | 3 +-- 7 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 LICENSE.txt create mode 100644 setup.cfg diff --git a/.gitignore b/.gitignore index c084314c..56c5af27 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,6 @@ db.sqlite3 # pyenv .python-version + +# pypi +.pypirc diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5b780dcc..e01faed9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..4b5a3576 --- /dev/null +++ b/LICENSE.txt @@ -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. diff --git a/Makefile b/Makefile index b7841500..3862b243 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 8feee8ff..b4e9f52a 100644 --- a/README.md +++ b/README.md @@ -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://img.shields.io.pypi/v/dynamic-rest.svg) **Dynamic API extensions for Django REST Framework** diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..b88034e4 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = README.md diff --git a/setup.py b/setup.py index 53f446a6..1d478868 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ from setuptools import find_packages, setup from constants import ( - APP_NAME, AUTHOR, AUTHOR_EMAIL, DESCRIPTION, @@ -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), From 63e83e1caeda82b0121802923e5bd5c3596308b2 Mon Sep 17 00:00:00 2001 From: aleontiev Date: Fri, 5 Feb 2016 16:47:37 -0500 Subject: [PATCH 2/4] move constants into setup.py accessible pacage --- Makefile | 12 ++++++------ constants.py => dynamic_rest/constants.py | 0 setup.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) rename constants.py => dynamic_rest/constants.py (100%) diff --git a/Makefile b/Makefile index 3862b243..7ac5c8b2 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/constants.py b/dynamic_rest/constants.py similarity index 100% rename from constants.py rename to dynamic_rest/constants.py diff --git a/setup.py b/setup.py index 1d478868..a0d40b74 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import find_packages, setup -from constants import ( +from dynamic_rest.constants import ( AUTHOR, AUTHOR_EMAIL, DESCRIPTION, From 1d36437e301a1f3a71a32707df673adef5603aad Mon Sep 17 00:00:00 2001 From: aleontiev Date: Fri, 5 Feb 2016 16:48:10 -0500 Subject: [PATCH 3/4] bump version, move constants --- dynamic_rest/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dynamic_rest/constants.py b/dynamic_rest/constants.py index 076fae12..29dc2cd3 100644 --- a/dynamic_rest/constants.py +++ b/dynamic_rest/constants.py @@ -5,4 +5,4 @@ REPO_NAME = "dynamic-rest" PROJECT_NAME = "Dynamic REST" ORG_NAME = "AltSchool" -VERSION = "1.3.14" +VERSION = "1.3.15" From 5b797fbddcc07c50e4643e8f8a3852a5db8401e9 Mon Sep 17 00:00:00 2001 From: aleontiev Date: Fri, 5 Feb 2016 21:29:23 -0500 Subject: [PATCH 4/4] fix link + runtests --- README.md | 2 +- runtests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b4e9f52a..aa09d941 100644 --- a/README.md +++ b/README.md @@ -1,7 +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://img.shields.io.pypi/v/dynamic-rest.svg) +[![PyPi](https://img.shields.io/pypi/v/dynamic-rest.svg)](https://pypi.python.org/pypi/dynamic-rest) **Dynamic API extensions for Django REST Framework** diff --git a/runtests.py b/runtests.py index 64913401..46e49d84 100755 --- a/runtests.py +++ b/runtests.py @@ -8,7 +8,7 @@ import sys import pytest -from constants import APP_NAME +from dynamic_rest.constants import APP_NAME TESTS = 'tests' BENCHMARKS = 'benchmarks'