Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 7 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 4 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sphinx
sphinx-click
click
prettytable
58 changes: 38 additions & 20 deletions fabfile.py
Original file line number Diff line number Diff line change
@@ -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()