Skip to main content

mwconstants

Various utilities and constants useful for analyses of wikitext. This package contains three types of artifacts:

  • Data generating functions: Python functions for calling various APIs to build useful data structures -- e.g., all Wikipedia language codes
  • Static data snapshots: Python variables that contain the most recent result of a data generating function
  • Utilities: Python functions for handling various wikitext-related processing tasks -- e.g., mapping links to namespaces.

Installation

You can install mwconstants with pip:

   $ pip install mwconstants

Basic Usage

from mwconstants import link_to_namespace, NON_WHITESPACE_LANGUAGES

print(link_to_namespace('Utilisateur:Isaac_(WMF)', lang='fr'))  # 'User'
print(sorted(NON_WHITESPACE_LANGUAGES))  # ['bo', 'bug', ..., 'zh-classical', 'zh-yue']

Modules

All modules generally contain relevant constants, functions for generating those constants, and other useful utilities for manipulating them:

  • languages.py: functions for identifying languages associated with a given Wikimedia project.
  • media.py: functions for identifying media in wikitext and parsing wikitext media syntax into its components
  • namespaces.py: functions for identifying namespace prefixes

Limitations

  • Links have many edge-cases, especially around interwiki prefixes. For now, just the basics are covered: language-specific namespaces and interlanguage links

Metadata

Release files for mwconstants 0.1.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 mwconstants 0.1.0
File Size Uploaded Provenance Actions
mwconstants-0.1.0.tar.gz 90.5 kB Without provenance Details for mwconstants-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 184.4 kB

Release files / mwconstants-0.1.0.tar.gz

Download URL mwconstants-0.1.0.tar.gz
Size 90.5 kB
Tags Source
SHA-256 checksum
How to use checksums
81cd90b1080e13053e55326856c1b78156c9f8612a403f0095c4f1a0b1488415
BLAKE2b-256 checksum
How to use checksums
d585a5416773f5a33feeffd7b9b78992e07a78b7e33b2b57a448e66eeebd3c68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / mwconstants-0.1.0-py3-none-any.whl

Download URL mwconstants-0.1.0-py3-none-any.whl
Size 93.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3023602ed465a5428e59d5a5fc51b0151acb4fc6246714d572f542d9efbb0786
BLAKE2b-256 checksum
How to use checksums
0d19e60761e20dd4e7609c76e126ba415b03de11c172dcc8290322dd8c75e069
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Security for mwconstants 0.1.0

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