Skip to content

Commit

Permalink
Switch to a new continuous integration service to build and test this…
Browse files Browse the repository at this point in the history
… python package
  • Loading branch information
vladpunko committed Sep 30, 2023
1 parent e853024 commit d6b51cd
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .githooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
repos:
# Set the list of basic git hooks to find and fix common problems in the current working tree.
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9
hooks:
- id: check-executables-have-shebangs
- id: check-yaml
Expand All @@ -12,7 +12,7 @@ repos:

# Use the static code checker to find and fix logical errors in python source code.
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
rev: b9a7794c4f425ef8419081e6993f99419cc667ea
hooks:
- id: flake8
language_version: python3
Empty file added .github/.gitkeep
Empty file.
29 changes: 29 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: python testing and linting

on:
push:
branches:
- "master"

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- name: Step -- 1.
uses: actions/checkout@v3

- name: Step -- 2.
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Step -- 3.
run: pip3 install --upgrade pip && pip3 install --no-cache-dir --upgrade tox

- name: Step -- 4.
run: tox && tox -e lint
21 changes: 20 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
*
*.egg
*.egg-info
*.log
*.py[cod]
*.xml
.*

__pycache__/
build/
dist/
docs/_build
downloads/
eggs/
htmlcov/
lib/
lib64/
parts/
sdist/
var/
wheels/
Empty file added .gitkeep
Empty file.
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions README.markdown → README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# notebook-environments

![tests](https://github.com/vladpunko/notebook-environments/actions/workflows/tests.yml/badge.svg)

Manage python virtual environments on the working notebook server.

![usage-example](https://raw.githubusercontent.com/vladpunko/notebook-environments/master/notebook_environments.gif)
Expand Down
10 changes: 5 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ fi

workdir="$(mktemp -d)"

_cleanup() {
rm -f -r -- "${workdir}"
}
trap _cleanup 0 1 2 3 6

# Step -- 1.
git clone --depth=1 --branch=master -- https://github.com/vladpunko/notebook-environments.git "${workdir}" > /dev/null 2>&1 || {
echo 'An error occurred while downloading the source code to the current machine.' >&2
Expand All @@ -25,8 +30,3 @@ install -m 755 "${workdir}/n.sh" /usr/local/bin/n

# Step -- 3.
install -m 755 "${workdir}/notebook_environments.py" /usr/local/bin/notebook-environments

_cleanup() {
rm -f -r -- "${workdir}"
}
trap _cleanup 0 1 2 3 6
Binary file modified notebook_environments.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions notebook_environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import subprocess
import sys
import tempfile
import warnings

try:
_to_unicode = unicode
Expand Down Expand Up @@ -148,7 +149,7 @@
"show_kernels",
)

__version__ = "0.8.11"
__version__ = "0.8.12"


def _in_virtual_environment():
Expand Down Expand Up @@ -363,7 +364,10 @@ def initialize_new_notebook_environment():
sys.exit(errno.EPERM)

try:
from jupyter_core.paths import jupyter_path # noqa
with warnings.catch_warnings():
warnings.simplefilter("ignore")

from jupyter_core.paths import jupyter_path # noqa
except ImportError:
def jupyter_path(subdirs): # this function is to return a list
return [_get_data_path(subdirs)]
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
raise RuntimeError("The notebook-environments program doesn't support windows at this moment.")


with io.open("README.markdown", mode="rt", encoding="utf-8") as stream_in:
with io.open("README.md", mode="rt", encoding="utf-8") as stream_in:
# Load the readme file and use it as the long description for this python package.
long_description = stream_in.read()

Expand Down Expand Up @@ -67,6 +67,7 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",

"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Utilities",
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{27,35,36,37,38,39,310}
envlist = py{27,35,36,37,38,39,310,311}

# Ignore errors related to absence of some python interpreters on the current machine.
skip_missing_interpreters = true
Expand All @@ -13,7 +13,7 @@ deps =
pytest-cov
six
py{27,35}: pyfakefs<4.5.0 # mock the python file system modules for some previous interpreter versions
py{36,37,38,39,310}: pyfakefs
py{36,37,38,39,310,311}: pyfakefs

[testenv:lint]
commands = python -m pre_commit run --all-files --config .githooks.yml
Expand Down

0 comments on commit d6b51cd

Please sign in to comment.