Skip to main content

This is cruscopoetry.core, the base package of the cruscopoetry libraries. This package handles the processing of poetic texts and their translations written in the CruscoPoetry syntax. cruscopoetry.core can be used both from commandline and programmatically in Python script.

Installation

Through pip:

pip install cruscopoetry.core

This will install the package in your Python (global or virtual) environment.

Accessing documentation about CruscoPoetry Syntax

Knowing CruscoPoetry syntax is a necessary step to use this library. To read the documentation relative to it, download the source code from https://pypi.org/project/cruscopoetry.core/ and extract the archive; go in the directory docs/cruscopoetry_syntax and find there the documentation in rst format.

Basic operations

Help command

cruscopoetry -h, cruscopoetry --help

Prints an outline of the basic operations.

Build command

cruscopoetry build

Parses a source text written in CruscoPoetry syntax and organises its content in a CruscoPoetry Json file.

Options:

-h, --help

Shows a help message about this operation

-i INPUT, --input INPUT

The path of the file containing the poem in CruscoPoetry syntax

-o OUTPUT, --output OUTPUT

The path where the new CruscoPoetry Json file shall be saved

-v, --verbose

Shows more information during the process.

Add Translations command

cruscopoetry add_translations

Parses a translation text written in CruscoPoetry syntax and loads its content on a CruscoPoetry Json file.

Options:

-h, --help

Shows a help message about this operation

-SOURCE, --source SOURCE

The Json file where the translation will be loaded

-t TRANSLATIONS, --translations TRANSLATIONS

one or more translation files writtern in CruscoPoetry syntax. More file names need to be separated by a space; space characters contained in file names must be escaped.

Delete Traslations command

cruscopoetry delete_translations

Deletes a translation from a CruscoPoetry Json file.

Options:

-h, --help

Shows a help message about this operation

-SOURCE, --source SOURCE

The Json file where the translation will be deleted

-t TRANSLATION_IDS, --translation_ids TRANSLATION_IDS

the id or ids of each translation to be deleted. More ids need to be separated by a space.

--indent INDENT

the indent string to be used in the txt file.

List Translations

cruscopoetry list_translations

List the languages and ids of the translations already loaded in a CruscoPoetry Json file.

Options:

-h, --help

Shows a help message about this operation

Positional arguments:
json_file:

The Json file where the translation will be deleted

Render

Rewrites the content of the poem from the Json File to a human-readable format. Besides the source text, also one translation can be included in the rendering. Two subcommands are available, for producing txt and html renderings. Some options are common to both commands:

-h, -help

Prints a help message

-i INPUT, --input INPUT

the JSON file to render as text

--tr_id TR_ID

the id of the translation to include in the text file

--tr_layout

the translation layout, represented by an integer from 0 to 4

--number_after NUMBER_AFTER

the number whose lines have one of its multiples as number will display their number

-o OUTPUT, --output OUTPUT

the file to save the rendering in. If not specified, it will be printed on stdout

The translation layout is indicated by an integer. Each integer corresponds to a different option:

0

NO TRANSLATION

Only the source text is rendered

1

AFTER_TEXT

The whole translation is rendered below the whole original text

2

AFTER_EACH_STANZA

Each stanza is rendered in its original version and immediately below in translation

3

AFTER_EACH_LINE

Each line is rendered in its original version and immediately below in translation

4

SIDE_BY_SIDE

Source text and translations are side by side, each line showing the source version and the translation on the same row

Txt rendering

cruscopoetry render txt

Besides the options listed above, there is:

--indent INDENT

the indent string to be used in the txt file.

Html rendering

cruscopoetry render html

Besides the options listed above, there is:

--pretty_print

pretty-print output option.

Release files for cruscopoetry.core 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cruscopoetry.core 0.0.4
File Size Uploaded
cruscopoetry_core-0.0.4.tar.gz 50.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cruscopoetry.core 0.0.4
File Interpreter ABI Platform
cruscopoetry_core-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 148.8 kB

Release files / cruscopoetry_core-0.0.4.tar.gz

Download URL cruscopoetry_core-0.0.4.tar.gz
Size 50.7 kB
Tags Source
SHA-256 checksum
How to use checksums
aa6cbcb35b66f981c06f1a069f55fdb557da3f4735f647e9d296b182a6e194cb
BLAKE2b-256 checksum
How to use checksums
0ff53a60b11eab6ce5e4e89c7f80854c6ccc68cf5f01d08a57cc60ca559d891d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / cruscopoetry_core-0.0.4-py3-none-any.whl

Download URL cruscopoetry_core-0.0.4-py3-none-any.whl
Size 98.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df3ca13429a54b2689b2d1eb9b359b1a14718199eb071172fb71a4afe939a225
BLAKE2b-256 checksum
How to use checksums
35e35fece081d2d00d76944d4039a4328dc67b3d43004ae12b3c1d5ee5437ebd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page