Skip to main content

Pakkenellik

Pakkenellik is a collection of shared Python utilities for Bord4's data-analysis projects. It includes helpers for dataframes, project paths, publishing, integrations, Norwegian regions and Statistics Norway (SSB).

The package is used by bord4-analysis-templates.

Requirements

  • Python 3.10 or later

Installation

Install the core package with pip:

pip install pakkenellik

Or add it to a project managed by uv:

uv add pakkenellik

Optional dependencies are grouped by feature:

uv add "pakkenellik[s3]"          # Amazon S3
uv add "pakkenellik[gspread]"     # Google Sheets
uv add "pakkenellik[nvdb]"        # Norwegian Public Roads Administration
uv add "pakkenellik[gis]"         # Geospatial dataframes
uv add "pakkenellik[viz]"         # Matplotlib visualizations
uv add "pakkenellik[datawrapper]" # Datawrapper
uv add "pakkenellik[ssb]"         # SSB helpers (no additional dependencies)

Usage

Clean dataframe column names:

import pandas as pd

from pakkenellik.dataframe.clean_column_headers import clean_column_headers

df = pd.DataFrame({"Første kolonne": [1]})
df = clean_column_headers(df)
# df.columns: ["forste_kolonne"]

Format numbers with Norwegian separators:

from pakkenellik.dataframe.numbers import format_number

formatted = format_number(1234567.89)
# "1.234.567,89"

Use common project paths:

from pakkenellik.config import Config

config = Config("/path/to/project")
source_file = config.get_source_file("data.csv")
# "/path/to/project/data/source/data.csv"

Features

  • aws: publishing files and data to Amazon S3
  • config: common paths and URLs for Bord4 projects
  • dataframe: cleaning columns, date/time helpers and number formatting
  • datawrapper: low-level Datawrapper client helpers
  • google: reading from and writing to Google Sheets
  • integration: Schibsted MM and Datawrapper integration helpers
  • regions: Norwegian municipality and county data, including historical changes
  • ssb: population data, rates and ranking helpers
  • vegvesen: routes and road data from the Norwegian Public Roads Administration
  • viz: shared Matplotlib styling and plotting helpers

Local development

Install uv, clone the repository and install all development and optional dependencies:

git clone https://github.com/BergensTidende/pakkenellik.git
cd pakkenellik
make sync

The Makefile provides these common commands:

Command Description
make format Format and sort imports with Ruff
make lint Check formatting, linting and types with Ruff and mypy
make test Run the pytest test suite
make check Run all linting and tests

Contributing

Create a branch from main, make your changes and verify them before opening a pull request:

git switch -c name-of-branch
make check
git push -u origin name-of-branch

Use present-tense commit messages that describe what the commit does. If you do not have write access to the repository, create a personal fork and open the pull request from your fork against the repository's main branch.

License

Pakkenellik is distributed under the MIT License.

Contact

Bord4 — bord4@bt.no

Metadata

Release files for pakkenellik 0.2.2

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

Source distribution (sdist)

Source distribution for pakkenellik 0.2.2
File Size Uploaded Provenance Actions
pakkenellik-0.2.2.tar.gz 471.0 kB Without provenance Details for pakkenellik-0.2.2.tar.gz

Built distribution (wheel)

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

Total release size: 502.9 kB

Release files / pakkenellik-0.2.2.tar.gz

Download URL pakkenellik-0.2.2.tar.gz
Size 471.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6281abe735dca92fe73b2f6ce75bebad333c56b06c7eeae6357a3e066dc5cd4d
BLAKE2b-256 checksum
How to use checksums
549fb146ef55da9f84f8e73f486a3b9272b1a7e99e08ed3bfc88847f8ba68c31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.10

Release files / pakkenellik-0.2.2-py3-none-any.whl

Download URL pakkenellik-0.2.2-py3-none-any.whl
Size 31.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e65a2528d1b81e90bc9a9dd06219a83bb1889d666695fb5263ab89a9b6eb43b6
BLAKE2b-256 checksum
How to use checksums
4e21e707c4fa89a26b37db2c7f52484c037883ef9bf3929923976a844ae0f34e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.10

Security for pakkenellik 0.2.2

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.

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