Skip to content

Commit

Permalink
Prepare 1.0.2 release (#34)
Browse files Browse the repository at this point in the history
* add explicit urllib3 dep (#32)

* Import command classes inline (#33)

* Import command classes inline

* ruff

* Change test patch location

* Change RtD base to latest

* prepare 1.0.2
  • Loading branch information
freddyheppell authored Jul 12, 2024
1 parent b14c61f commit dd27d5a
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 14 deletions.
12 changes: 6 additions & 6 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Changelog

## 1.0.1
## 1.0.2 (2024-07-12)

_Released: 11th July 2024_
- Fixed not explicitly declaring dependency on `urllib3` (!32)
- Improved CLI performance with lazy imports of library functionality (!33)

### Bug Fixes
- Fixed an incorrect repository URL in the package metadata and CLI epilog (!29)
## 1.0.1 (2024-07-11)

## 1.0.0
- Fixed an incorrect repository URL in the package metadata and CLI epilog (!29)

_Released: 11th July 2024_
## 1.0.0 (2024-07-11)

This release is a major overhaul of the tool including built-in download functionality.

Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
site_name: WPextract
copyright: Copyright © 2022-24 The University of Sheffield.
repo_url: https://github.com/GateNLP/wpextract
site_url: https://wpextract.readthedocs.io/en/stable/
site_url: https://wpextract.readthedocs.io/en/latest/
site_description: Create datasets from WordPress sites for research or archiving
edit_uri: edit/main/docs/
theme:
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name="wpextract"
version="1.0.1post1"
version="1.0.2"
description="Create datasets from WordPress sites"
homepage="https://wpextract.readthedocs.io/"
documentation="https://wpextract.readthedocs.io/"
Expand Down Expand Up @@ -39,6 +39,7 @@ tqdm = ">=4.65.0"
requests = ">=2.32.3"
click = ">=8.0.1"
click-option-group = ">=0.5.3"
urllib3 = ">1.21.3,<3"

[tool.poetry.group.dev.dependencies]
build = "==0.9.*,>=0.9.0"
Expand Down
5 changes: 3 additions & 2 deletions src/wpextract/cli/_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
from click import Choice
from click_option_group import optgroup

from wpextract import WPDownloader
from wpextract.cli._shared import (
CMD_ARGS,
empty_directory,
logging_options,
setup_logging,
setup_tqdm_redirect,
)
from wpextract.download import RequestSession
from wpextract.util.str import ensure_prefixes, ensure_suffix

dl_types = ["categories", "media", "pages", "posts", "tags", "users"]
Expand Down Expand Up @@ -141,6 +139,9 @@ def download(
OUT_JSON is the directory to output the downloaded JSON to. It must be an existing empty directory or a non-existent directory which will be created.
"""
from wpextract import WPDownloader
from wpextract.download import RequestSession

setup_logging(verbose, log)

types_to_dl = set(dl_types) - set(skip_types)
Expand Down
3 changes: 2 additions & 1 deletion src/wpextract/cli/_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import click

from wpextract import WPExtractor
from wpextract.cli._shared import (
CMD_ARGS,
directory,
Expand Down Expand Up @@ -40,6 +39,8 @@ def extract(
OUT_DIR is the directory to output the extracted JSON to. It must be an existing empty directory or a non-existent directory which will be created.
"""
from wpextract import WPExtractor

setup_logging(verbose, log)

with setup_tqdm_redirect(log is None):
Expand Down
4 changes: 3 additions & 1 deletion tests/cli/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
def mock_cls_invoke(mocker, runner, datadir, args=None):
if args is None:
args = []
dl_mock = mocker.patch("wpextract.cli._download.WPDownloader")
# Patch at source since the CLI imports within a function
dl_mock = mocker.patch("wpextract.WPDownloader")

result = runner.invoke(
cli, ["download", "https://example.org", str(datadir), *args]
Expand All @@ -17,6 +18,7 @@ def test_default_args(mocker, runner, datadir):
dl_mock, result = mock_cls_invoke(mocker, runner, datadir)
assert result.exit_code == 0

dl_mock.assert_called_once()
assert dl_mock.call_args.kwargs["target"] == "https://example.org/"
assert dl_mock.call_args.kwargs["out_path"] == datadir
assert len(dl_mock.call_args.kwargs["data_types"]) == 6
Expand Down
5 changes: 4 additions & 1 deletion tests/cli/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ def mock_cls_invoke(mocker, runner, datadir, args=None, mkdirs=True):

if args is None:
args = []
dl_mock = mocker.patch("wpextract.cli._extract.WPExtractor")

# Patch at source since the CLI imports within a function
dl_mock = mocker.patch("wpextract.WPExtractor")

result = runner.invoke(cli, ["extract", str(in_dir), str(out_dir), *args])

Expand All @@ -21,6 +23,7 @@ def test_default_args(mocker, runner, datadir):
dl_mock, result = mock_cls_invoke(mocker, runner, datadir)
assert result.exit_code == 0

dl_mock.assert_called_once()
assert dl_mock.call_args.kwargs["json_root"] == datadir / "json_in"
assert dl_mock.call_args.kwargs["scrape_root"] is None
assert dl_mock.call_args.kwargs["json_prefix"] is None
Expand Down

0 comments on commit dd27d5a

Please sign in to comment.