Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.
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
15 changes: 15 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[run]
branch = True
source = js.tableselect

[report]
precision = 2
fail_under = 100

[html]
directory = coverage-report

[paths]
source =
js/tableselect
.tox/*/lib/python*/site-packages/js/tableselect
43 changes: 43 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Lint

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
type: [ "opened", "reopened", "synchronize" ]

env:
FORCE_COLOR: 1

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Cache
uses: actions/cache@v2
with:
path: |
~/.cache/pip
~/.cache/pre-commit
key:
lint-v1-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
lint-v1-
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install pre-commit
- name: Lint
run: |
pre-commit run --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
47 changes: 47 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
type: [ "opened", "reopened", "synchronize" ]
schedule:
- cron: '0 12 * * 0' # run once a week on Sunday
jobs:
tests:
strategy:
matrix:
config:
# [Python version, tox env]
- ["2.7", "py27"]
- ["3.8", "py38"]
- ["3.8", "coverage"]
runs-on: ubuntu-latest
name: ${{ matrix.config[1] }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('setup.*', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test
run: tox -e ${{ matrix.config[1] }}
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls coverage-python-version
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.egg-info
*.pyc
*~
.*.swp
.coverage
.installed.cfg
.tox
bin
coverage-report
develop-eggs
dist
parts
38 changes: 38 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
exclude: resources/
- id: end-of-file-fixer
exclude: resources/
- id: fix-encoding-pragma
args: [--remove]
- id: check-yaml
- id: debug-statements
language_version: python3
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
language_version: python3
additional_dependencies: [flake8-typing-imports==1.9.0]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.5.4
hooks:
- id: autopep8
- repo: https://github.com/timothycrosley/isort
rev: 5.7.0
hooks:
- id: isort
args: [--filter-files]
files: \.py$
- repo: local
hooks:
- id: rst
name: rst
entry: rst-lint --encoding utf-8
files: .rst
language: python
additional_dependencies: [pygments, restructuredtext_lint]
2 changes: 1 addition & 1 deletion js/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
__import__('pkg_resources').declare_namespace(__name__) # pragma: nocover
7 changes: 5 additions & 2 deletions js/tableselect/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from fanstatic import Library, Resource
from fanstatic import Library
from fanstatic import Resource
from js.jquery import jquery
from js.jquery_datatables import jquery_datatables, fixed_header
from js.jquery_datatables import fixed_header
from js.jquery_datatables import jquery_datatables


library = Library('namespace', 'resources')

Expand Down
10 changes: 10 additions & 0 deletions js/tableselect/test_tableselect.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
How to use?
===========

You can import tableselect from ``js.tableselect`` and ``need`` it where you
want these resources to be included on a page::

>>> from js.tableselect import tableselect
>>> tableselect.need()

This already includes the respective css files.
10 changes: 10 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[bdist_wheel]
universal = 1

[isort]
lines_between_sections = 0
lines_after_imports = 2
no_sections = True
from_first = True
lines_between_types = 0
force_single_line = True
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from setuptools import setup, find_packages
from setuptools import find_packages
from setuptools import setup
import os


version = '0.4.dev0'


Expand Down
28 changes: 28 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[tox]
envlist =
flake8,
py27,
py38,
coverage,
minversion = 1.6

[testenv]
usedevelop = True
extras = test
deps = pytest
commands = py.test []

[testenv:coverage]
deps =
{[testenv]deps}
pytest-cov
commands = py.test --cov=js --cov-report=html --cov-report=term-missing []

[testenv:flake8]
basepython = python3
skip_install = true
deps = flake8
commands = flake8 js setup.py --doctests

[pytest]
addopts = --doctest-glob="*.rst"