semvec/pypi-packages huggingface dataset:
packagepoa 0.3.0
Generate, transform and assemble files for a PoA article.
License: MIT

# package-poa

Generate, transform and assemble files for a PoA article.

This library is used to transform a zip file input to produce output consisting of a reformatted zip file and to help produce a PDF file with its coverage page removed.

The transform procedure in summary follows these steps:

- get an article DOI from the `manifest.xml` file inside the input zip file
- get the zip's list of files and their titles, also by reading the `manifest.xml`
- rename files and add them into a new zip file, not including the PDF or the `manifest.xml`
- coordinate removing the cover page from the PDF file by relying on an external executable to modify the PDF

The PDF cover page is removed with the code in https://github.com/elifesciences/strip-coverletter

The output files generated by this library can then be accompanied with a Publish on Accept (PoA) research article JATS XML file, and all together can be bundled up and sent to journal publishing ingestion workflow.

## Requirements and install

a) Install from `pypi` package index

```
pip install packagepoa
```

b) Install locally

Clone the git repo

`git clone https://github.com/elifesciences/package-poa.git`

Create a python virtual environment and activate it

```
python3 -m venv venv
source venv/bin/activate
```

Install it locally

```
pip install -r requirements.txt
python setup.py install
```

In order to run the transform function as written, it will require `strip-coverletter` to be installed and ready to run locally, which will also require `Docker` to be installed and running.

## Configuration

The `packagepoa.cfg` configuration file provided in this repository can be changed in order specify different output file naming, depending on the journal, and to configure the temporary folder path and the location of the PDF strip coverletter executable.

## Example usage

This library is meant to be integrated into another operational system, where the input zip file can be downloaded from an S3 bucket and then processed. The following example illustrates how it might be invoked using interactive Python:

```python
>>> from packagepoa import transform
>>> from packagepoa.conf import raw_config, parse_raw_config
>>> config = parse_raw_config(raw_config('elife'))
>>> transform.process_zipfile("tests/test_data/18022_1_supp_mat_highwire_zip_268991_x75s4v.zip", config)
```

## Run code tests

Use `pytest` for testing, install it if missing:

```
pip install pytest
```

Run tests

```
pytest
```

Run tests with coverage

```
coverage run -m pytest
```

then report on code coverage

```
converage report -m
```

## License

Licensed under [MIT](https://opensource.org/licenses/mit-license.php).