Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Prepare for CircleCI publishing.
Browse files Browse the repository at this point in the history
  • Loading branch information
fferegrino committed Jul 22, 2018
1 parent b2574c2 commit ffb6c07
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 20 deletions.
90 changes: 90 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6.1

working_directory: ~/repo

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "setup.py" }}

- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
make dev
- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "setup.py" }}

deploy:
docker:
- image: circleci/python:3.6
steps:
- checkout

- restore_cache:
key: v1-dependency-cache-{{ checksum "setup.py" }}

- run:
name: install python dependencies
command: |
python3 -m venv venv
. venv/bin/activate
make dev
- save_cache:
key: v1-dependency-cache-{{ checksum "setup.py" }}
paths:
- "venv"

- run:
name: verify git tag vs. version
command: |
python3 -m venv venv
. venv/bin/activate
python setup.py verify
- run:
name: init .pypirc
command: |
echo -e "[pypi]" >> ~/.pypirc
echo -e "username = io_exception" >> ~/.pypirc
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
- run:
name: create packages
command: |
make package
- run:
name: upload to pypi
command: |
. venv/bin/activate
twine upload dist/*
workflows:
version: 2
build_and_deploy:
jobs:
- build:
filters:
tags:
only: /.*/
- deploy:
requires:
- build
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
23 changes: 15 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
run: install
jupyter notebook
install: clean
pip install -e .
jupyter serverextension enable --py jupygit --sys-prefix
jupyter nbextension install --py jupygit --sys-prefix
jupyter nbextension enable --py jupygit --sys-prefix
.PHONY: help clean dev docs package test

help:
@echo "This project assumes that an active Python virtualenv is present."
@echo "The following make targets are available:"
@echo " dev install all deps for dev env"

clean:
find . -type d -name "__pycache__" -exec rm -rf {} +
rm -rf dist/*

dev:
pip install -r requirements.txt

package:
python setup.py sdist
python setup.py bdist_wheel
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
twine
42 changes: 30 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
from setuptools import setup, find_packages
import os
import sys

try:
long_desc = open('README.md').read()
except:
long_desc = ''
from setuptools import setup
from setuptools.command.install import install

with open("README.md", "r") as fh:
long_description = fh.read()

# Package version
VERSION = "0.1.0"

class VerifyVersionCommand(install):
"""Custom command to verify that the git tag matches our version"""
description = 'verify that the git tag matches our version'

def run(self):
tag = os.getenv('CIRCLE_TAG')

if tag != VERSION:
info = "Git tag: {0} does not match the version of this library: {1}".format(
tag, VERSION
)
sys.exit(info)

setup(
name="jupygit",
url="https://github.com/fferegrino/jupygit",
author="Antonio Feregrino",
author_email="[email protected]",
version="0.0.26",
packages=find_packages(),
install_requires=[
"jupyter==1"
],
include_package_data=True,
version=VERSION,
description="Prepare your Notebooks to be pushed to GitHub",
long_description=long_desc,
long_description=long_description,
long_description_content_type="text/markdown",
include_package_data=True,
cmdclass={
'verify': VerifyVersionCommand,
}
)

0 comments on commit ffb6c07

Please sign in to comment.