Skip to content
Draft
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
33 changes: 17 additions & 16 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
[run]
branch = True
include = wagtail_wordpress_import/*
omit = */migrations/*,*/tests/*
source=wagtail_wordpress_import
source = src/wagtail_wordpress_import
omit =
*/migrations/*
*/tests/*
*/templates/*
*/static/*
*/static_src/*
*/__pycache__/*
*/__init__.py

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
def __str__
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
pass
raise ImportError

[html]
directory = htmlcov

ignore_errors = True
[xml]
output = coverage.xml
97 changes: 83 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,85 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
*.pyc
/build
/dist
/wagtail_wordpress_import.egg-info
/.coverage
/htmlcov
/.tox
/venv
/.vscode
/site
/test_wagtail_wordpress_import.db
/node_modules
/test-static
/test-media
.pytest_cache/
pytest_cache/
.ruff_cache/

# Distribution / packaging
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Testing
.coverage
.coverage.*
htmlcov/
.tox/
.nox/
coverage.xml
*.cover
.hypothesis/
stats-*.json
.pytest_cache/

# Virtual environments
venv/
env/
ENV/
.venv/
.env/

# IDE
.idea/
.vscode/
*.swp
*.swo

# Django/Wagtail specific
*.log
db.sqlite3
/media
/static
/staticfiles
test_wagtail_wordpress_import.db
tests-static/
tests-media/

# Node
node_modules/
package-lock.json
yarn.lock

# Docs
site/

# Mac OS
.DS_Store
/stats-*.json
.AppleDouble
.LSOverride

# UV
uv/
.uv/
.local/

# Local development
*_local_settings.py
local_settings.py
19 changes: 8 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
repos:
- repo: https://github.com/python/black
rev: 25.1.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.11.9
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 6.0.1
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: 7.2.0
hooks:
- id: flake8
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/jackdewinter/pymarkdown
rev: v0.9.29
hooks:
Expand Down
2 changes: 0 additions & 2 deletions .prettierrc.toml

This file was deleted.

1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
4 changes: 0 additions & 4 deletions MANIFEST.in

This file was deleted.

20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Wagtail WordPress Import

[![codecov](https://codecov.io/gh/torchbox/wagtail-wordpress-import/branch/main/graph/badge.svg?token=KFSTTxTGxZ)](https://codecov.io/gh/torchbox/wagtail-wordpress-import)

A package for Wagtail CMS to import WordPress blog content from an XML file into Wagtail.

- [Wagtail WordPress Import](#wagtail-wordpress-import)
Expand Down Expand Up @@ -37,8 +35,16 @@ The package has been developed and tested with:
## Initial app and package setup

1. Setup a Wagtail site using your preferred method or follow the [official documentation](https://docs.wagtail.io/en/stable/getting_started/tutorial.html) to get started.
2. Install this package from PyPi with `pip install wagtail-wordpress-import`
or using any method you prefer.
2. Install this package from PyPI:

```bash
# Using pip
pip install wagtail-wordpress-import

# Using uv (recommended)
uv pip install wagtail-wordpress-import
```

3. Place your XML files somewhere on your disk. The file can have any name you choose.
4. Create a `log` folder in the root of your site. The import script will need to write report files to this folder, you may need to set the permissions on the folder.
5. Add `"wagtail_wordpress_import"` to your INSTALLED_APPS config in your settings.py file.
Expand Down Expand Up @@ -181,6 +187,10 @@ We have included some developer commands to help you with importing large datase

[View Developer Tooling](docs/tooling.md)

### Development Setup

If you're interested in contributing to the project or setting up a development environment, please see our [Development Guide](docs/development.md).

## Further Usage Examples

- [Handling Specific HTML content structures](docs/examples.md)
Expand All @@ -189,7 +199,7 @@ We have included some developer commands to help you with importing large datase

If you're a Python or Django developer, fork the repo and get stuck in!

You might like to start by reviewing the [contributing guidelines](https://github.com/torchbox/wagtail-wordpress-import/wiki/Contributing-to-the-package) in the wiki and checking [current issues](https://github.com/torchbox/wagtail-wordpress-import/issues).
Start by reviewing our [Development Guide](docs/development.md) for instructions on setting up your development environment. You might also want to check the [contributing guidelines](https://github.com/torchbox/wagtail-wordpress-import/wiki/Contributing-to-the-package) in the wiki and see the [current issues](https://github.com/torchbox/wagtail-wordpress-import/issues).

## Releases

Expand Down
123 changes: 123 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Development Guide

This document outlines the development setup and process for working on the Wagtail WordPress Import package.

## Setting up a development environment

### Prerequisites

- Python 3.9 or higher
- pip or [uv](https://docs.astral.sh/uv/) (recommended)
- uv is a modern Python package installer and resolver that's significantly faster than pip
- Install uv with: `pip install uv`

### Installation

Clone the repository:

```bash
git clone https://github.com/torchbox/wagtail-wordpress-import.git
cd wagtail-wordpress-import
```

Create and activate a virtual environment:

```bash
python -m venv .venv
source .venv/bin/activate # On Windows, use .venv\Scripts\activate
```

Install the package in development mode with development dependencies:

```bash
# Using uv (recommended)
uv pip install -e ".[dev,testing]"

# Using pip
pip install -e ".[dev,testing]"
```

## Development Tools

The project uses several development tools that are installed as part of the development dependencies:

- **black**: Code formatter (enforces consistent code style)
- **flake8**: Linter (finds code quality issues)
- **isort**: Import sorter (organizes imports alphabetically and by type)
- **pre-commit**: Runs checks before committing code

### Setting up pre-commit

Pre-commit hooks help ensure code quality by running checks before each commit:

```bash
pre-commit install
```

After installation, pre-commit will automatically run the configured hooks on any files you attempt to commit.

## Running Tests

To run tests:

```bash
# Run all tests
python testmanage.py test

# Run tests with coverage
coverage run testmanage.py test
coverage report
```

## Project Structure

- **src/wagtail_wordpress_import/**: Core package code
- **importers/**: Import functionality
- **management/commands/**: Management commands for the package
- **migrations/**: Database migrations
- **prefilters/**: Content pre-processing filters
- **static/**: Static files
- **templates/**: HTML templates
- **test/**: Test configuration
- **docs/**: Documentation files
- **tests/**: Test files

## Configuration Files

- **pyproject.toml**: Main project configuration (dependencies, build settings, tools)
- **tox.ini**: Configuration for running tests in multiple environments
- **uv.lock**: Dependency lock file (when using uv)

## Build System

This project uses [hatchling](https://hatch.pypa.io/) as the build backend. The package configuration is defined in `pyproject.toml`.

## Publishing

To build the package for distribution:

```bash
# Install build dependencies
pip install build

# Build the package
python -m build
```

To publish to PyPI:

```bash
# Install twine
pip install twine

# Upload to PyPI
python -m twine upload dist/*
```

## References

- [uv Documentation](https://docs.astral.sh/uv/)
- [hatchling Documentation](https://hatch.pypa.io/)
- [Wagtail Documentation](https://docs.wagtail.org/)
- [Django Documentation](https://docs.djangoproject.com/)
- [Python Packaging User Guide](https://packaging.python.org/)
13 changes: 13 additions & 0 deletions docs/long_description.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

A package for Wagtail CMS to import WordPress blog content from an XML file into Wagtail.

## Installation

```bash
# Using pip
pip install wagtail-wordpress-import

# Using uv (recommended)
uv pip install wagtail-wordpress-import

# For development
uv pip install -e ".[dev,testing]"
```

## Requirements

1. Wagtail CMS Installed following the [initial setup](https://docs.wagtail.io/en/stable/getting_started/index.html)
Expand Down
Loading