Skip to main content

NLDCSC package

GitHub Release GPLv3 License

codecov pypi pytest

This package contains generic re-usable code.

Install the full package:

pip install nldcsc[all]

Package has several modules which can be installed separately by specifying them as an extra requirement. To install the loggers module only, specify:

pip install nldcsc[loggers]

Or for multiple modules:

pip install nldcsc[loggers, flask_managers]

Modules

The following modules are available in the nldcsc package:

  • auth
  • datatables
  • flask_managers
  • flask_middleware
  • flask_plugins
  • http_apis
  • http_apis_cached
  • httpx_apis
  • loggers
  • sql_migrations
  • sso
  • plugins
    • plugin_doh
    • plugin_geo_ip
    • plugin_sql_migrate
    • plugin_redis
    • plugin_mailgun
    • plugin_nexpose
    • plugin_viper
  • custom_types
    • custom_type_sqlalchemy

Loggers

There are two loggers provided:

  • AppLogger (nldcsc.loggers.app_logger.AppLogger)
  • GunicornLogger (nldcsc.loggers.app_logger.GunicornLogger)

The AppLogger is intended to be used as a loggerClass to be used for the standard python logging module.

import logging
from nldcsc.loggers.app_logger import AppLogger

logging.setLoggerClass(AppLogger)

mylogger = logging.getLogger(__name__)

The 'mylogger' instance has all the proper formatting and handlers (according to the desired config) to log messages.

The Gunicorn logger is intended to be used for as a loggerClass for the gunicorn webserver; it enables the FlaskAppManager to set the necessary formatting and handles according to the AppLogger specs and a custom format for the gunicorn access logging.

Flask app manager

The FlaskAppManager is intended to be used to 'run' flask applications in both test, development as in production environments.

from YADA import app
from nldcsc.flask_managers.flask_app_manager import FlaskAppManager

fam = FlaskAppManager(version="1.0", app=app)
fam.run()

Depending on the configuration the FlaskAppManager uses a werkzeug (DEBUG == True) or a gunicorn webserver. TLS could be set for both webservers iaw the module specific README.md.

HTTP apis cached

Baseclass for http api communication is present under nldcsc.http_apis.base_class.cached_base_class.CachedApi

This baseclass utilizes requests_cache to cache requests automagically.

HTTP apis

Baseclass for http api communication is present under nldcsc.http_apis.base_class.api_base_class.ApiBaseClass

HTTPX apis

Baseclass for httpx api communication is present under nldcsc.httpx_apis.base_class.httpx_base_class.HTTPXBaseClass

SQL Migrations

The sql migrations can be used to facilitate migration between different versions of sql models / versions. It relies on flask migrate to perform the different migrations. It has a CLI as well as an python class based API.

Check the command line help

python3 -m nldcsc.sql_migrations.flask_sql_migrate -a /path/to/script_with_flask_app.py -i
python3 -m nldcsc.sql_migrations.flask_sql_migrate -a /path/to/script_with_flask_app.py -m
python3 -m nldcsc.sql_migrations.flask_sql_migrate -a /path/to/script_with_flask_app.py -u

Or initiate the FlaskSqlMigrate as a class and initiate the migration process from there:

from nldcsc.sql_migrations.flask_sql_migrate import FlaskSqlMigrate
fsm = FlaskSqlMigrate(app_ref="/path/to/script_with_flask_app.py")

fsm.db_init()
fsm.db_migrate()
fsm.db_update()

Plugins

There are several off the shelf plugins that can be used in other projects. Every plugin can be installed with:

pip install nldcsc[plugin-<plugin-name>]

or if you rather install all the plugins:

pip install nldcsc[plugins]

plugin-sql-migrate

The sql_migrate plugin serves as a wrapper around alembic but replaces the naming convention of migration files to support multiple branches of development. To make use of this plugin the CLI can be used.

Check the command line help

python3 -m nldcsc db --help

OR

nldcsc db --help

The plugin expects to be pointed towards a python configuration file that looks something like this:

from my_awesome_project.db import get_engine
from my_awesome_project.models.base import ModelBase

#This should be a SQLAlchemy engine object.
db = get_engine()

#This should be the modelbase class metadata
metadata = ModelBase.metadata

Custom types

Custom types is a collection of custom types or objects that can be used with other libraries

custom_type_sqlalchemy

This is a collection of types to be used together with sqlalchemy. If these types are to be used make sure to inherit from the ModelBase within the NLDCSC package. As the types get mapped to their SQL equivalents there.

Adding modules and/or groups

Everything for this package is defined in the pyproject.toml file. Dependencies are managed by poetry and grouped in, you guessed it, groups. Every poetry group can be installed as an extra using pip.

Extra extras or group on group/extra dependencies can also be defined in the [tool.nldcsc.group.dependencies] section. Everything defined here will also become an extra if no group already exists. You can use everything defined here as dependency for another group, order does not matter.

example:

[tool.nldcsc.group.dependencies]
my_awesome_extra = ["my_awesome_group", "my_other_group"]
my_awesome_group = ["my_logging_group"]

[tool.poetry.group.my_awesome_group.dependencies]
<dependency here>

[tool.poetry.group.my_other_group.dependencies]
<dependency here>

[tool.poetry.group.my_logging_group.dependencies]
<dependency here>

Using this example the following extras exist with the correct dependencies:

pip install nldcsc[all]
pip install nldcsc[my-awesome-extra]
pip install nldcsc[my-awesome-group]
pip install nldcsc[my-other-group]
pip install nldcsc[my-logging-group]

Release files for nldcsc 0.3.93

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

Source distribution (sdist)

Source distribution for nldcsc 0.3.93
File Size Uploaded
nldcsc-0.3.93.tar.gz 144.0 kB Details

Built distribution (wheel)

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

Total release size: 321.6 kB

Release files / nldcsc-0.3.93.tar.gz

Download URL nldcsc-0.3.93.tar.gz
Size 144.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f01a3699f7a8ce613591e94dcba0a3943fdfc8a33f5bbd2cc9853166ee055c21
BLAKE2b-256 checksum
How to use checksums
2d0b498dccfd1ebdb5f2182075798b1579ea7299c762b7e7d65d59352afe8b32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / nldcsc-0.3.93-py3-none-any.whl

Download URL nldcsc-0.3.93-py3-none-any.whl
Size 177.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cb10dd54975e3b6b8578d5db4dc381e93923192c925c384b1d3d4f042cbdaf2
BLAKE2b-256 checksum
How to use checksums
63a9d817bbc6a63eb5b82418ab5d1547fd311908e34e4df63ef5b3a064bac075
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.95

2 release files

0.3.94

2 release files

This release

0.3.93 This release

2 release files

0.3.90

2 release files

0.3.85

2 release files

0.3.84

2 release files

0.3.83

2 release files

0.3.82

2 release files

0.3.81

2 release files

0.3.80

2 release files

0.3.79

2 release files

0.3.78

2 release files

0.3.77

2 release files

0.3.75

2 release files

0.3.74

2 release files

0.3.73

2 release files

0.3.72

2 release files

0.3.71

2 release files

0.3.70

2 release files

0.3.69

2 release files

0.3.68

2 release files

0.3.67

2 release files

0.3.66

2 release files

0.3.65

2 release files

0.3.60

2 release files

0.3.59

2 release files

0.3.58

2 release files

0.3.57

2 release files

0.3.52

2 release files

0.3.51

2 release files

0.3.50

2 release files

0.3.49

2 release files

0.3.48

2 release files

0.3.47

2 release files

0.3.45

2 release files

0.3.44

2 release files

0.3.43

2 release files

0.3.42

2 release files

0.3.36

2 release files

0.3.34

2 release files

0.3.32

2 release files

0.3.31

2 release files

0.3.30

2 release files

0.3.29

2 release files

0.3.28

2 release files

0.3.27

2 release files

0.3.26

2 release files

0.3.25

2 release files

0.3.24

2 release files

0.3.23

2 release files

0.3.22

2 release files

0.3.21

2 release files

0.3.20

2 release files

0.3.18

2 release files

0.3.12

2 release files

0.3.11

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.0

2 release files

0.2.48

2 release files

0.2.44

2 release files

0.2.43

2 release files

0.2.41

2 release files

0.2.40

2 release files

0.2.39

2 release files

0.2.38

2 release files

0.2.37

2 release files

0.2.35

2 release files

0.2.34

2 release files

0.2.33

2 release files

0.2.32

2 release files

0.2.31

2 release files

0.2.30

2 release files

0.2.29

2 release files

0.2.28

2 release files

0.2.27

2 release files

0.2.25

2 release files

0.2.24

2 release files

0.2.23

2 release files

0.2.22

2 release files

0.2.21

2 release files

0.2.20

2 release files

0.2.15

2 release files

0.2.13

2 release files

0.2.12

2 release files

0.2.11

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

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

0.0.24

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.12

2 release files

0.0.11

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

2 release files

0.0.3

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