Skip to main content

cartocss-doc-parser

PyPI Python versions Tests Coverage Status

CartoCSS documentation Python parser.

Install

pip install cartocss-doc-parser

Quickstart

The main function cartocss_doc returns a dictionary with almost every section of the documentation. All the properties are wrapped in generators.

>>> from pprint import pprint
>>> from cartocss_doc_parser import cartocss_doc
>>>
>>> doc = cartocss_doc()
>>> pprint(doc)
{'building': <generator object ...>,
 'common_elements': <generator object ...>,
 'line': <generator object ...>,
 'line_pattern': <generator object ...>,
 'map_background_and_string_elements': <generator object ...>,
 'markers': <generator object ...>,
 'other_parameters': <generator object ...>,
 'point': <generator object ...>,
 'polygon': <generator object ...>,
 'polygon_pattern': <generator object ...>,
 'raster': <generator object ...>,
 'shield': <generator object ...>,
 'symbolizers': <generator object ...>,
 'text': <generator object ...>,
 'torque_properties': <generator object ...>,
 'values': <generator object ...>}

All properties contains the attributes

  • default Default value.
  • description Description.
  • id Identificator.
  • link Link to the property on documentation.
  • name Name of the property.
  • sample Example of use.
  • type Value data type. For a complete list see cartocss_data_types.

and if the data type is keyword contains an additional attribute

  • variants Possible values for the property.
>>> pprint(list(doc["polygon"]))
[{'default': 'gray',
  'description': 'The fill color assigned to a polygon.',
  'id': 'polygon-fill-color',
  'link': 'https://carto.com/developers/styling/cartocss/#polygon-fill-color',
  'name': 'polygon-fill',
  'sample': 'polygon-fill: rgba(128, 128, 128, 1);',
  'type': 'color'},
 {'default': '1',
  'description': 'The opacity of the polygon.',
  'id': 'polygon-opacity-float',
  'link': 'https://carto.com/developers/styling/cartocss/#polygon-opacity-float',
  'name': 'polygon-opacity',
  'sample': 'polygon-opacity: 1;',
  'type': 'float'},
 ...,
 {'default': 'power',
  'description': 'An anti-grain geometry method that represents a 2D rendering '
                 'library, specific to controlling the quality of antialiasing '
                 'and used to calculate pixel gamma (pow(x,gamma), which '
                 'produces slightly smoother line and polygon antialiasing '
                 "than the 'linear' method.",
  'id': 'polygon-gamma-method-keyword',
  'link': 'https://carto.com/developers/styling/cartocss/#polygon-gamma-method-keyword',
  'name': 'polygon-gamma-method',
  'sample': 'polygon-gamma-method: power;',
  'type': 'keyword',
  'variants': ['power', 'linear', 'none', 'threshold', 'multiply']},
 ...
]

All data types can be requested with cartocss_data_types function:

>>> from cartocss_doc_parser import cartocss_data_types
>>> pprint(list(cartocss_data_types()))
['color',
 'float',
 'uri',
 'string',
 'boolean',
 'expression',
 'numbers',
 'number',
 'percentages',
 'percentage',
 'functions',
 'function',
 'keyword',
 'unsigned',
 'tags']

Documentation

# cartocss_doc(url="https://carto.com/developers/styling/cartocss/", user_agent="cartocss_doc_parser vX.Y.Z") ⇒ dict

Provides information for almost every section of CartoCSS documentation.

  • url (str) URL to the documentation page. Can be a local file, in which case any HTTP request would be performed, instead the file would be read.
  • user_agent (str) User agent performing the HTTP request to documentation page. As default is cartocss_doc_parser (v%(version)s).

# cartocss_data_types(url="https://carto.com/developers/styling/cartocss/", user_agent="cartocss_doc_parser vX.Y.Z") ⇒ gen

Lists all available data types for properties for CartoCSS.

  • url (str) URL to the documentation page. Can be a local file, in which case any HTTP request would be performed, instead the file would be read.
  • user_agent (str) User agent performing the HTTP request to documentation page. As default is cartocss_doc_parser (v%(version)s).

Release files for cartocss-doc-parser 2.0.0

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

Source distribution (sdist)

Source distribution for cartocss-doc-parser 2.0.0
File Size Uploaded
cartocss_doc_parser-2.0.0.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cartocss-doc-parser 2.0.0
File Interpreter ABI Platform
cartocss_doc_parser-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / cartocss_doc_parser-2.0.0.tar.gz

Download URL cartocss_doc_parser-2.0.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7c9b69c0dc5ac1f091b6266990ded284efe8c558967ad068389bed431c34c8ee
BLAKE2b-256 checksum
How to use checksums
f7f69b0cd30391191947cd38c381c6ee489aed56299b993c0a1249356abd2ed3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / cartocss_doc_parser-2.0.0-py3-none-any.whl

Download URL cartocss_doc_parser-2.0.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01e1adb008eb341fda6ab0b84d94fc53dc34c10803a6201ab7fad9feeacbbfb8
BLAKE2b-256 checksum
How to use checksums
c8efbf80e0c55e161fce7261877c5a859770e3566e6106eb6991d58b46444c5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

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