Skip to main content

Generate, transform and assemble files for a PoA article.

Project description

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:

>>> 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

packagepoa-0.3.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

packagepoa-0.3.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file packagepoa-0.3.0.tar.gz.

File metadata

  • Download URL: packagepoa-0.3.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for packagepoa-0.3.0.tar.gz
Algorithm Hash digest
SHA256 541568f6f6d9852f3b228ba6b235475a9a78d047dbb5142bccfd28243d63876b
MD5 06de14b9a86066fbe4aee7bfcfb0b2f9
BLAKE2b-256 3228ddf38629717197e41b667dbca1409bbfb16ea1db066c96074897d4392345

See more details on using hashes here.

File details

Details for the file packagepoa-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: packagepoa-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for packagepoa-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b68e59d96443cfe678537700b449be1b3197445a15ab38241c049fb3f29ad65
MD5 7d3a7ab742d2c674c5b4966b3d0b9161
BLAKE2b-256 b32fcd0873f957e505b2be48407039e85f6946e1991b725940dd9ee8ad2bf4e3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page