Skip to main content

mapchartpy

A super simple library to manage and create Mapchart save files.

Getting started

  1. Please make sure your code editor has support for intellisense in Python. This library has typing for basically everything, so it'll make your life a lot easier.
Opening a map
```python
import mapchartpy as mc
from pathlib import Path

map = mc.Map(save_file=Path("map.txt"))
```
Creating a new map
```python
import mapchartpy as mc

map = mc.Map()
```
Highlighting a country
```python
import mapchartpy as mc

map = mc.Map()
map.fill_country("Finland", "#002F6C")
```

You can find a list of countries available by running

```python
import mapchartpy as mc

countries = mc.Map.get_countries_and_territories()
print(countries)

# >> ['Austria', 'Belgium', 'Bulgaria', 'Croatia', 'Cyprus', 'Czechia', 'Denmark'...
```
Highlighting US states
```python
import mapchartpy as mc

map = mc.Map()
map.fill_country("USA_Kentucky", "#A3080B")
```

States are generally formatted as "US_(State)"

You can find a list of states available by running

```python
import mapchartpy as mc

territories = mc.Map.get_countries_and_territories()

for territory in territories:
    if territory.startswith("US"):
        print(territory)

```
Creating a map of a specific region
For example, here's europe:

```python
import mapchartpy as mc

map = mc.Map()
map.set_map_type("europe")
```
Saving the map file
```python
import mapchartpy as mc
import json

map = mc.Map()
map.fill_country("Finland", "#002F6C")

with open("output.txt", "w") as f:
    json.dump(map.get_file(), f)
```

Features

  1. Super simple editing It's literally three lines of code
import mapchartpy as mc

map = mc.Map()
map.fill_country("Finland", "#002F6C")
  1. Ability to load existing maps
import mapchartpy as mc
from pathlib import Path

map = mc.Map(save_file=Path("map.txt"))
  1. Full type hinting The library supports full* type hinting of the Mapchart save file, in addition to some other nice-to-haves.

Image of autocomplete working in countries Image of autocomplete working on the raw data file Image of autocomplete working on a function

*: Type hinting may not be available for special properties. If you encounter a situation where you don't have full type hinting, please make an issue on our GitHub

  1. Exporting to Mapchart's file format
import mapchartpy as mc
import json

map = mc.Map()
map.fill_country("Finland", "#002F6C")

with open("output.txt", "w") as f:
    json.dump(map.get_file(), f)
  1. Dead simple installation It's literally just pip install mapchartpy

Metadata

Release files for mapchartpy 0.0.3

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

Source distribution (sdist)

Source distribution for mapchartpy 0.0.3
File Size Uploaded Provenance Actions
mapchartpy-0.0.3.tar.gz 98.3 kB Without provenance Details for mapchartpy-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mapchartpy 0.0.3
File Interpreter ABI Platform Actions
mapchartpy-0.0.3-py3-none-any.whl Python 3 none any Details for mapchartpy-0.0.3-py3-none-any.whl

Total release size: 106.4 kB

Release files / mapchartpy-0.0.3.tar.gz

Download URL mapchartpy-0.0.3.tar.gz
Size 98.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2f9cc327d61e67a1c3d7b07f8522e20634137f3284d32527b3eaa71b396ee561
BLAKE2b-256 checksum
How to use checksums
7ac6b76c8bf6d572f53a803019d8788a5060f341f8c6cf16f1168618c7f39714
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.0

Release files / mapchartpy-0.0.3-py3-none-any.whl

Download URL mapchartpy-0.0.3-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfe06833803fac0fa67fdb21e295800f6b4f147865b4a324299248d2b557e99e
BLAKE2b-256 checksum
How to use checksums
79e126134519e1b5c86a6edc1c6fffa01cdd837d5150331cf2c030550cf03b38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.0

Security for mapchartpy 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

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