From fa7c1fe86fe74f516cde53a68e8d0af05839d301 Mon Sep 17 00:00:00 2001 From: allmightyspiff Date: Fri, 3 May 2019 15:49:14 -0500 Subject: [PATCH 1/2] updating release process --- RELEASE.md | 8 +++++++- fabfile.py | 58 +++++++++++++++++++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 21 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 75eea45dc..eb1cb6d47 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -3,7 +3,13 @@ * Update version constants (find them by running `git grep [VERSION_NUMBER]`) * Create changelog entry (edit CHANGELOG.md with a one-liner for each closed issue going in the release) * Commit and push changes to master with the message: "Version Bump to v[VERSION_NUMBER]" -* Push tag and PyPi `fab release:[VERSION_NUMBER]`. Before you do this, make sure you have the organization repository set up as upstream remote & fabric installed (`pip install fabric`), also make sure that you have pip set up with your PyPi user credentials. The easiest way to do that is to create a file at `~/.pypirc` with the following contents: +* Make sure your `upstream` repo is set +``` +git remote -v +upstream git@github.com:softlayer/softlayer-python.git (fetch) +upstream git@github.com:softlayer/softlayer-python.git (push) +``` +* Push tag and PyPi `python fabfile.py 5.7.2`. Before you do this, make sure you have the organization repository set up as upstream remote, also make sure that you have pip set up with your PyPi user credentials. The easiest way to do that is to create a file at `~/.pypirc` with the following contents: ``` [server-login] diff --git a/fabfile.py b/fabfile.py index cd6a968f5..a393fe99b 100644 --- a/fabfile.py +++ b/fabfile.py @@ -1,49 +1,67 @@ +import click import os.path import shutil - -from fabric.api import local, lcd, puts, abort - +import subprocess +import sys +from pprint import pprint as pp def make_html(): - "Build HTML docs" - with lcd('docs'): - local('make html') - + """Build HTML docs""" + click.secho("Building HTML") + subprocess.run('make html', cwd='docs', shell=True) def upload(): - "Upload distribution to PyPi" - local('python setup.py sdist bdist_wheel') - local('twine upload dist/*') + """Upload distribution to PyPi""" + cmd_setup = 'python setup.py sdist bdist_wheel' + click.secho("\tRunning %s" % cmd_setup, fg='yellow') + subprocess.run(cmd_setup, shell=True) + cmd_twine = 'twine upload dist/*' + click.secho("\tRunning %s" % cmd_twine, fg='yellow') + subprocess.run(cmd_twine, shell=True) def clean(): - puts("* Cleaning Repo") + click.secho("* Cleaning Repo") directories = ['.tox', 'SoftLayer.egg-info', 'build', 'dist'] for directory in directories: if os.path.exists(directory) and os.path.isdir(directory): shutil.rmtree(directory) -def release(version, force=False): +@click.command() +@click.argument('version') +@click.option('--force', default=False, is_flag=True, help="Force upload") +def release(version, force): """Perform a release. Example: - $ fab release:3.0.0 + $ python fabfile.py 1.2.3 """ if version.startswith("v"): - abort("Version should not start with 'v'") + exit("Version should not start with 'v'") version_str = "v%s" % version clean() - local("pip install wheel") + subprocess.run("pip install wheel", shell=True) - puts(" * Uploading to PyPI") + print(" * Uploading to PyPI") upload() + make_html() - puts(" * Tagging Version %s" % version_str) force_option = 'f' if force else '' - local("git tag -%sam \"%s\" %s" % (force_option, version_str, version_str)) + cmd_tag = "git tag -%sam \"%s\" %s" % (force_option, version_str, version_str) + + click.secho(" * Tagging Version %s" % version_str) + click.secho("\tRunning %s" % cmd_tag, fg='yellow') + subprocess.run(cmd_tag, shell=True) + + + cmd_push = "git push upstream %s" % version_str + click.secho(" * Pushing Tag to upstream") + click.secho("\tRunning %s" % cmd_push, fg='yellow') + subprocess.run(cmd_push, shell=True) + - puts(" * Pushing Tag to upstream") - local("git push upstream %s" % version_str) +if __name__ == '__main__': + release() \ No newline at end of file From 9a84266584cd2435a316ef69943013a7aebbd17e Mon Sep 17 00:00:00 2001 From: allmightyspiff Date: Fri, 3 May 2019 16:13:39 -0500 Subject: [PATCH 2/2] updates for doc generation --- .readthedocs.yml | 23 +++++++++++++++++++++++ docs/requirements.txt | 4 ++++ 2 files changed, 27 insertions(+) create mode 100644 .readthedocs.yml create mode 100644 docs/requirements.txt diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 000000000..a36db8a13 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,23 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Build documentation with MkDocs +#mkdocs: +# configuration: mkdocs.yml + +# Optionally build your docs in additional formats such as PDF and ePub +formats: all + +# Optionally set the version of Python and requirements required to build your docs +python: + version: 3.7 + install: + - requirements: docs/requirements.txt diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 000000000..acb2b7258 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,4 @@ +sphinx +sphinx-click +click +prettytable \ No newline at end of file