Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distribution management changes #31

Merged
merged 10 commits into from
Jul 29, 2019
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
18 changes: 18 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[bumpversion]
current_version = 0, 1, 0, 'alpha', 0
commit = False
tag = False
parse = (?P<major>\d+)\,\ (?P<minor>\d+)\,\ (?P<patch>\d+)\,\ \'(?P<release>\S+)\'\,\ (?P<build>\d+)
serialize =
{major}, {minor}, {patch}, '{release}', {build}

[bumpversion:part:release]
optional_value = final
values =
alpha
candidate
final

[bumpversion:part:build]

[bumpversion:file:jupyterlab_celltests/_version.py]
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@ yarn.lock

# generated
Untitled_test.html
Untitled_test.py
Untitled_test.py
46 changes: 46 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributing

If you want to contribute to this repository here are some helpful guidelines.

## Reporting bugs, feature requests, etc.

To report bugs, request new features or similar, please open an issue on the Github
repository.

A good bug report includes:

- Expected behavior
- Actual behavior
- Steps to reproduce (preferably as minimal as possible)
- Possibly any output from the browser console (typically available via Ctrl + Shift + J or via F12).

## Minor changes, typos etc.

Minor changes can be contributed by navigating to the relevant files on the Github repository,
and clicking the "edit file" icon. By following the instructions on the page you should be able to
create a pull-request proposing your changes. A repository maintainer will then review your changes,
and either merge them, propose some modifications to your changes, or reject them (with a reason for
the rejection).

## Setting up a development environment

If you want to help resolve an issue by making some changes that are larger than that covered by the above paragraph, it is recommended that you:

- Fork the repository on Github
- Clone your fork to your computer
- Run the following commands inside the cloned repository:
- `pip install -e .[dev]` - This will install the Python package in development
mode.
- `jupyter labextension install .` - This will add the lab extension development
mode.
- Validate the install by running the tests:
- `py.test` - This command will run the Python tests.
- `npm test` - This command will run the JS tests.

Once you have such a development setup, you should:

- Make the changes you consider necessary
- Run the tests to ensure that your changes does not break anything
- If you add new code, preferably write one or more tests for checking that your code works as expected.
- Commit your changes and publish the branch to your github repo.
- Open a pull-request (PR) back to the main repo on Github.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2019 Jupyterlab-celltests contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
34 changes: 34 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
include LICENSE
include README.md
include CONTRIBUTING.md

include requirements.txt
include setup.cfg
include pyproject.toml
include .bumpversion.cfg
include jest.config.js
include Makefile

graft tests

# Documentation
graft docs
exclude docs/\#*

# docs subdirs we want to skip
prune docs/build
prune docs/gh-pages
prune docs/dist

# Webapp files
include package.json
include tsconfig.json
include tslint.json
graft src
graft style

# Patterns to exclude from any directory
global-exclude *~
global-exclude *.pyc
global-exclude *.pyo
global-exclude .git
global-exclude .ipynb_checkpoints
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ docs: ## make documentation
open ./docs/_build/html/index.html

install: ## install to site-packages
python3 setup.py install
pip3 install .

serverextension: install ## enable serverextension
jupyter serverextension enable --py jupyterlab_celltests
Expand All @@ -50,8 +50,8 @@ js: ## build javascript
labextension: js ## enable labextension
jupyter labextension install .

dist: ## dist to pypi
python3 setup.py sdist upload -r pypi
dist: clean ## dist to pypi
python3 setup.py sdist bdist_wheel && twine upload -r pypi dist/*

micro: ## steps before dist, defaults to previous tag + one micro
. scripts/deploy.sh MICRO
Expand Down
14 changes: 11 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,19 @@
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#

import os
_version_py = os.path.join('..', '..', 'jupyterlab', '_version.py')
version_ns = {}

with open(_version_py, mode='r') as version_file:
exec(version_file.read(), version_ns)

# The short X.Y version.
version = '0.1.0'
version = '%i.%i' % version_ns['version_info'][:2]
# The full version, including alpha/beta/rc tags.
release = '0.1.0'
release = version_ns['__version__']


# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"NotebookApp": {
"nbserver_extensions": {
"jupyterlab_celltests": true
}
}
}
2 changes: 1 addition & 1 deletion jupyterlab_celltests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ._version import VERSION as __version__ # noqa: F401
from ._version import __version__ # noqa: F401


def _jupyter_server_extension_paths():
Expand Down
27 changes: 25 additions & 2 deletions jupyterlab_celltests/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# # # # GENERATED FILE -- DO NOT MODIFY # # # #
VERSION = 'v0.1.0'
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

from collections import namedtuple

VersionInfo = namedtuple('VersionInfo', [
'major',
'minor',
'micro',
'releaselevel',
'serial'
])

# DO NOT EDIT THIS DIRECTLY! It is managed by bumpversion
version_info = VersionInfo(0, 1, 0, 'alpha', 0)

_specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': ''}

__version__ = '{}.{}.{}{}'.format(
version_info.major,
version_info.minor,
version_info.micro,
(''
if version_info.releaselevel == 'final'
else _specifier_[version_info.releaselevel] + str(version_info.serial)))
2 changes: 1 addition & 1 deletion jupyterlab_celltests/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ def extract_extrametadata(notebook, override=None):

def get_coverage(notebook):
meta = extract_extrametadata(notebook)
return meta['cell_tested']/meta['cell_count']*100
return meta['cell_tested'] / meta['cell_count'] * 100
44 changes: 41 additions & 3 deletions jupyterlab_celltests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,44 @@
import subprocess
from .shared import extract_cellsources, extract_celltests, extract_extrametadata

# This files includes code copied from nbval under the following license:
# Copyright (C) 2014 Oliver W. Laslett <O.Laslett@soton.ac.uk>
# David Cortes-Ortuno
# Maximilian Albert
# Ondrej Hovorka
# Hans Fangohr
# (University of Southampton, UK)
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# Neither the names of the contributors nor the associated institutions
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


BASE = '''
import unittest
from nbval.kernel import RunningKernel
Expand Down Expand Up @@ -99,14 +137,14 @@ def assemble_code(sources, tests):
for line in test:
# if testing the cell,
# write code from cell
if line.strip().startswith('%cell'):
if line.strip().startswith(r'%cell'):

# add comment in test for readability
cells[-1][1].append(INDENT + line.replace('%cell', '# Cell {' + str(i) + '} content\n'))
cells[-1][1].append(INDENT + line.replace(r'%cell', '# Cell {' + str(i) + '} content\n'))

# add all code for cell
for c in code:
cells[-1][1].append(INDENT + line.replace('\n', '').replace('%cell', '') + c + '\n')
cells[-1][1].append(INDENT + line.replace('\n', '').replace(r'%cell', '') + c + '\n')

cells[-1][1].append('\n')

Expand Down
17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,29 @@
],
"scripts": {
"build": "tsc",
"build:lab": "rimraf lab-dist && mkdirp lab-dist && cd lab-dist && npm pack ..",
"build:all": "npm run build && npm run build:lab",
"clean": "rimraf lib",
"lint": "./node_modules/.bin/tslint './src/*.ts'",
"prepublish": "npm run build",
"prepublishOnly": "npm run build",
"test": "jest --coverage --collectCoverageFrom=src/*.{ts}"
},
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.css"
],
"jupyterlab": {
"extension": true
"extension": true,
"discovery": {
"server": {
"base": {
"name": "jupyterlab_celltests"
},
"managers": [
"pip"
]
}
}
},
"dependencies": {
"@jupyterlab/application": "^1.0.0",
Expand All @@ -41,6 +53,7 @@
"@types/jest": "^24.0.4",
"jest": "^24.1.0",
"jest-transform-css": "^2.0.0",
"mkdirp": "^0.5.1",
"rimraf": "^2.6.1",
"ts-jest": "^23.10.4",
"tslint": "^5.14.0",
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools", "wheel", "jupyter-packaging"]
59 changes: 0 additions & 59 deletions scripts/deploy.py

This file was deleted.

21 changes: 0 additions & 21 deletions scripts/deploy.sh

This file was deleted.

Loading