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

Packaging #86

Merged
merged 46 commits into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7a30b99
Remove unnecessary __init__
GjjvdBurg Jun 20, 2020
0995be7
Add setup.py with dependencies and include cli
GjjvdBurg Jun 20, 2020
dc887d9
Move js code in a javascript dir inside the package
GjjvdBurg Jun 20, 2020
08564bf
Remove __init__ in tests directory
GjjvdBurg Jun 20, 2020
9bb2542
Fix imports in test directory
GjjvdBurg Jun 20, 2020
0b0dd40
Install node modules when installing package
GjjvdBurg Jun 20, 2020
92e50a9
Adapt readability.js code to new package structure
GjjvdBurg Jun 20, 2020
13f356a
Add makefile
GjjvdBurg Jun 20, 2020
4f21b8f
Update travis config to new package structure
GjjvdBurg Jun 20, 2020
64056a0
Remove package.json from project root
GjjvdBurg Jun 20, 2020
2111c4b
Fix package.json path in setup.py
GjjvdBurg Jun 20, 2020
d209949
Be more robust against npm not existing
GjjvdBurg Jun 20, 2020
c0c9735
Throw a warning if we don't have node
GjjvdBurg Jun 20, 2020
2cc990a
Fix typo in travis config
GjjvdBurg Jun 20, 2020
ae9fc51
Ensure dependencies are updated on Travis
GjjvdBurg Jun 20, 2020
b8c91ab
Don't install in editable mode on travis
GjjvdBurg Jun 20, 2020
37631d3
Replicate all Travis tests in Makefile
GjjvdBurg Jun 20, 2020
d38db7d
Squashed commit of the following:
GjjvdBurg Jun 20, 2020
55e30ff
Set version to None in setup.py
GjjvdBurg Sep 15, 2020
af70ba2
Clarify warning messages when npm-based install fails
GjjvdBurg Sep 15, 2020
d58cfbc
Properly handle a missing npm installation
GjjvdBurg Sep 15, 2020
623d5ef
Run code quality checks on test directory
GjjvdBurg Sep 15, 2020
386b246
Fix code quality issue
GjjvdBurg Sep 15, 2020
4e61d5d
Run code quality checks on test dir on Travis
GjjvdBurg Sep 15, 2020
53339e9
Better variable names
GjjvdBurg Sep 15, 2020
5bd90e6
Better variable names
GjjvdBurg Sep 15, 2020
1e4079e
Use Python builtin virtualenv
GjjvdBurg Sep 21, 2020
24cfad7
Document the help target
GjjvdBurg Sep 21, 2020
7844f10
Attempt at getting pylint to work on tests dir
GjjvdBurg Sep 21, 2020
95273be
Add Python 3.8 testing on Travis
GjjvdBurg Sep 21, 2020
4d48849
Change pylint command for test dir
GjjvdBurg Sep 21, 2020
54770d5
Add version command to CLI
GjjvdBurg Sep 21, 2020
6451ff0
Reorder extra requires in preparation for docs
GjjvdBurg Sep 21, 2020
37dffb1
Make sure test command matches that of travis
GjjvdBurg Sep 21, 2020
e40afbf
Minor fixes to docs target in Makefile
GjjvdBurg Sep 21, 2020
7fadc5d
Add release script to Git
GjjvdBurg Sep 21, 2020
b7f9559
Add a change log
GjjvdBurg Sep 21, 2020
5929ac4
Rewrite the readme to match the new package layout
GjjvdBurg Sep 21, 2020
c06e42c
Clarify installation instructions
GjjvdBurg Sep 21, 2020
d325f4a
readme fix
GjjvdBurg Sep 21, 2020
c0fdb87
Fix pylint complaints in release script
GjjvdBurg Sep 21, 2020
a76f381
Change color to colour
jemrobinson Sep 21, 2020
01651e8
Fix missing colour replacement
jemrobinson Sep 21, 2020
b7ee006
Merge remote-tracking branch 'upstream/master' into packaging
jemrobinson Sep 22, 2020
4e3ef82
Added maintainer fields to setup.py
jemrobinson Sep 22, 2020
4c06d21
Minor README updates
jemrobinson Sep 22, 2020
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
21 changes: 10 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,26 @@ python:
- 3.7

before_install:
# Install node.js following instructions from
# https://nodejs.org/en/download/package-manager/
- sudo apt install curl
- curl -sL https://deb.nodesource.com/setup_11.x | sudo bash -
- sudo apt install nodejs
# Use the pre-installed nvm version to update node
# Apparently Travis comes with nvm even on the python containers
- nvm install v12.18.1
- nvm use v12.18.1
- node -v
- npm version

install:
# Install node.js dependencies
- npm install
# Install python dependencies
- pip install -r requirements-dev.txt
# Install package, while updating dependencies
- pip install --upgrade --upgrade-strategy eager .[dev]

script:
# Run all pytest unit tests
- python -m pytest -v tests --cov readabilipy --cov-report term-missing --benchmark-disable
- cd tests && python -m pytest -v . --cov readabilipy --cov-report term-missing --benchmark-disable && cd ..
# Run pyflakes for error detection
- pyflakes *.py readabilipy tests
# Check PEP8 compliance (ignoring long lines)
- pycodestyle --statistics --ignore=E501 --count *.py readabilipy tests
# Run pylint for stricter error checking
- pylint readabilipy tests
- pylint readabilipy
GjjvdBurg marked this conversation as resolved.
Show resolved Hide resolved

after_success:
# Upload results to coveralls.io
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include readabilipy/javascript/*.js
include readabilipy/javascript/package.json
108 changes: 108 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Makefile for easier installation and cleanup.
#
# Uses self-documenting macros from here:
# http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html

SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
MAKEFLAGS += --warn-undefined-variables --no-builtin-rules

PACKAGE=readabilipy
DOC_DIR=./docs
VENV_DIR=/tmp/rdpy_venv
TEST_DIR=./tests

.PHONY: help

.DEFAULT_GOAL := help

help:
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) |\
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m\
%s\n", $$1, $$2}'
GjjvdBurg marked this conversation as resolved.
Show resolved Hide resolved

################
# Installation #
################

.PHONY: install

install: ## Install for the current user using the default python command
python setup.py build_ext --inplace
python setup.py install --user


################
# Distribution #
################

.PHONY: release dist

release: ## Make a release
python make_release.py

dist: ## Make Python source distribution
python setup.py sdist bdist_wheel


###########
# Testing #
###########

.PHONY: test

test: venv ## Run unit tests
source $(VENV_DIR)/bin/activate && cd $(TEST_DIR) && \
python -m pytest -v . --cov readabilipy \
--cov-report term-missing --benchmark-disable
source $(VENV_DIR)/bin/activate && pyflakes *.py readabilipy tests
source $(VENV_DIR)/bin/activate && pycodestyle --statistics \
--ignore=E501 --count *.py readabilipy tests
source $(VENV_DIR)/bin/activate && pylint readabilipy

#################
# Documentation #
#################

.PHONY: doc docs

docs: doc
doc: install ## Build documentation with Sphinx
exit; # not implemented
source $(VENV_DIR)/bin/activate && m2r README.md && mv README.rst $(DOC_DIR)
source $(VENV_DIR)/bin/activate && m2r CHANGELOG.md && mv CHANGELOG.rst $(DOC_DIR)
cd $(DOC_DIR) && \
rm source/* && \
source $(VENV_DIR)/bin/activate && \
sphinx-apidoc -H 'Paper2Remarkable API Documentation' -o source ../$(PACKAGE) && \
touch source/AUTOGENERATED
$(MAKE) -C $(DOC_DIR) html
jemrobinson marked this conversation as resolved.
Show resolved Hide resolved

#######################
# Virtual environment #
#######################

.PHONY: venv

venv: $(VENV_DIR)/bin/activate

$(VENV_DIR)/bin/activate: setup.py
test -d $(VENV_DIR) || virtualenv $(VENV_DIR)
source $(VENV_DIR)/bin/activate && pip install .[dev]
touch $(VENV_DIR)/bin/activate

############
# Clean up #
############

.PHONY: clean

clean: ## Clean build dist and egg directories left after install
rm -rf ./dist
rm -rf ./build
rm -rf ./$(PACKAGE).egg-info
rm -rf $(VENV_DIR)
rm -f MANIFEST
rm -rf $(PACKAGE)/javascript/node_modules
find . -type f -iname '*.pyc' -delete
find . -type d -name '__pycache__' -empty -delete
Empty file removed __init__.py
Empty file.
33 changes: 0 additions & 33 deletions extract_article.py

This file was deleted.

Loading