Skip to content

Commit 13324a8

Browse files
committed
Split web-monitoring-diff out from -processing
This commit caps off the process of extracting the `web-monitoring-diff` package from the old `web-monitoring-processing` repo! There's a lot happening here: - The README has been almost entirely rewritten. - `setup.py` has been updated for this package. - Versioneer has been updated. - Requirements have been slimmed down to just what's needed for this codebase. - Requirements can be installed via `pip install web-monitoring-diff` or `pip install web-monitoring-diff[server,dev]`. `requirements.txt` files are not needed except for Docker and "experimental" diffs. - The server script has been renamed to `web-monitoring-diff-server` to match the package name. It's long, but now that we are treating this as more abstract, I'm leery of abbreviating as much. - Modules have been moved around and renamed. `web_monitoring_diff.diff.<whatever>` and `web_monitoring_diff.diff_server` both seemed pretty redundant, so we now have: - `web_monitoring_diff.<diff_function>` -- all the diff functions are exposed directly at the top level. - The actual submodules containing diff functions are named `<whatever>_diff.py`: - `basic_diffs.py` instead of `differs` to be more clear that these are relatively simple functions all thrown together. - `html_render_diff.py` instead of `html_diff_render.py` to fit the convention. - `html_links_diff.py` instead of `links_diff.py` to clarify that this is for HTML documents. - `experimental/<wrapped_package_name>.py` contains the diffs that are no longer actively used and were never especially well supported. They have to be installed by via git instead of PyPI, so setup is also kind of special. Since they need extra special installation support, importing them may fail, and so each one is in a separate module. I've also tried to document the issues and concerns around each of them much more than we had anywhere before. - `web_monitoring_diff.exceptions` as a common standard for where our exception types belong. - `web_monitoring_diff.server` for the server. It's a subpackage since the content of the server module is so big. I think it's a pretty obvious future plan to refactor that megamodule into smaller files and this lets us do so. - `deployment.md` has been removed -- it's no longer relevant. - Switch to flake8 for linting Layer dependencies better in Dockerfile Fix CircleCI dependencies Switch to flake8 for linting (but limit it a lot)
1 parent 0c85613 commit 13324a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1271
-1419
lines changed

.circleci/config.yml

+34-27
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
11
version: 2
22
jobs:
33
build:
4-
working_directory: ~/web-monitoring-processing
4+
working_directory: ~/web-monitoring-diff
55
docker:
66
- image: circleci/python:3.7
77
steps:
88
- checkout
99
- restore_cache:
1010
keys:
11-
- processing-{{ arch }}-{{ checksum "requirements.txt" }}-{{ checksum "dev-requirements.txt" }}
12-
- processing-{{ arch }}-
11+
- cache-v1-{{ arch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements-server.txt" }}-{{ checksum "requirements-dev.txt" }}-{{ checksum "requirements-experimental.txt" }}
12+
- cache-v1-{{ arch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements-server.txt" }}-{{ checksum "requirements-dev.txt" }}-
13+
- cache-v1-{{ arch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements-server.txt" }}-
14+
- cache-v1-{{ arch }}-{{ checksum "requirements.txt" }}-
15+
- cache-v1-{{ arch }}-
1316

1417
# Bundle install dependencies
1518
- run:
1619
name: Install Dependencies
1720
command: |
1821
python -m venv venv
1922
. venv/bin/activate
20-
pip install -r requirements.txt
21-
pip install -r dev-requirements.txt
22-
python setup.py install
23+
pip install -e .[server,dev] --no-binary lxml
24+
pip install -r requirements-experimental.txt
2325
2426
# Store bundle cache
2527
- save_cache:
26-
key: processing-{{ arch }}-{{ checksum "requirements.txt" }}-{{ checksum "dev-requirements.txt" }}
28+
key: cache-v1-{{ arch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements-server.txt" }}-{{ checksum "requirements-dev.txt" }}-{{ checksum "requirements-experimental.txt" }}
2729
paths:
2830
- venv
2931

3032
- run:
3133
name: Tests
3234
command: |
3335
. venv/bin/activate
34-
coverage run run_tests.py -v web_monitoring/tests/
36+
coverage run -m pytest -vv
3537
- run:
3638
name: Coverage
3739
command: |
@@ -41,24 +43,24 @@ jobs:
4143
name: Code linting
4244
command: |
4345
. venv/bin/activate
44-
pyflakes web_monitoring
45-
- run:
46-
name: Build docs
47-
command: |
48-
. venv/bin/activate
49-
cd docs && make html
46+
flake8 .
47+
# - run:
48+
# name: Build docs
49+
# command: |
50+
# . venv/bin/activate
51+
# cd docs && make html
5052

5153
build_docker:
5254
machine: true
5355
steps:
5456
- checkout
5557
- run: |
56-
docker build -t envirodgi/processing:$CIRCLE_SHA1 .
58+
docker build -t envirodgi/web-monitoring-diff:$CIRCLE_SHA1 .
5759
- run:
5860
name: Save Image
5961
command: |
6062
mkdir /tmp/workspace
61-
docker save --output /tmp/workspace/docker-image envirodgi/processing:$CIRCLE_SHA1
63+
docker save --output /tmp/workspace/docker-image envirodgi/web-monitoring-diff:$CIRCLE_SHA1
6264
- persist_to_workspace:
6365
root: /tmp/workspace
6466
paths:
@@ -74,25 +76,30 @@ jobs:
7476
command: docker load --input /tmp/workspace/docker-image
7577
- run:
7678
name: Re-tag Image
77-
command: docker image tag envirodgi/processing:$CIRCLE_SHA1 envirodgi/processing:latest
79+
command: docker image tag envirodgi/web-monitoring-diff:$CIRCLE_SHA1 envirodgi/web-monitoring-diff:latest
7880
- run:
7981
name: Publish to Docker Hub
8082
command: |
8183
docker login -u $DOCKER_USER -p $DOCKER_PASS
82-
docker push envirodgi/processing:$CIRCLE_SHA1
83-
docker push envirodgi/processing:latest
84+
docker push envirodgi/web-monitoring-diff:$CIRCLE_SHA1
85+
docker push envirodgi/web-monitoring-diff:latest
8486
8587
workflows:
8688
version: 2
8789
build:
8890
jobs:
8991
- build
9092
- build_docker
91-
- publish_docker:
92-
requires:
93-
- build
94-
- build_docker
95-
filters:
96-
branches:
97-
only:
98-
- release
93+
# XXX: Temporarily disable while in the middle of extracting this package
94+
# For this repo, we should probably publish based on tags:
95+
# https://circleci.com/docs/2.0/workflows/#executing-workflows-for-a-git-tag
96+
# Use $CIRCLE_TAG to identify the tag being used:
97+
# https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables
98+
# - publish_docker:
99+
# requires:
100+
# - build
101+
# - build_docker
102+
# filters:
103+
# branches:
104+
# only:
105+
# - release

.coveragerc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[run]
22
source =
3-
web_monitoring
3+
web_monitoring_diff
44
[report]
55
omit =
66
*/python?.?/*

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web_monitoring/_version.py export-subst
1+
web_monitoring_diff/_version.py export-subst

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ target/
6868
# pytest
6969
.pytest_cache
7070

71-
# diff_output
72-
diff_output_*
71+
# test_output
72+
test_output
7373

7474
# environment file with secrets
7575
.env

Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ WORKDIR /app
1212
# Copy the requirements.txt alone into the container at /app
1313
# so that they can be cached more aggressively than the rest of the source.
1414
ADD requirements.txt /app
15-
16-
# Install any needed packages specified in requirements.txt
1715
RUN pip install --trusted-host pypi.python.org -r requirements.txt
16+
ADD requirements-server.txt /app
17+
RUN pip install --trusted-host pypi.python.org -r requirements-server.txt
18+
ADD requirements-experimental.txt /app
19+
RUN pip install --trusted-host pypi.python.org -r requirements-experimental.txt
1820

1921
# Copy the rest of the source.
2022
ADD . /app
@@ -26,4 +28,4 @@ RUN pip install .
2628
EXPOSE 80
2729

2830
# Run server on port 80 when the container launches.
29-
CMD ["wm-diffing-server", "80"]
31+
CMD ["web-monitoring-diff-server", "80"]

MANIFEST.in

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
include versioneer.py
2-
include web_monitoring/_version.py
3-
include web_monitoring/tests/cassettes/*
4-
include web_monitoring/example_data/*
2+
include web_monitoring_diff/_version.py
3+
include web_monitoring_diff/example_data/*

0 commit comments

Comments
 (0)