Skip to main content

Утилита для загрузки и обновления фикстур НСИ

Project Status
CI/CD Latest Release
Quality Coverage
Package PyPI - Version PyPI - Support Python Versions Project PyPI - Downloads
Meta types - Mypy License - MIT code style - Ruff

Команда loadnsi позволяет загружать и обновлять фикстуры НСИ в которых записи имеют стабильный pk вашей внутренней системы бд.

Подготовка к запуску

  1. Установка пакета

    pip install loadnsi
    
  2. Создание файла переменных среды .env файл с содержимым:

    # Опционально, позволяет запускать команду из вложенных директорий проекта.
    ABS_ROOT_DIR=C:/path/to/your/project/dir
    PATH_TO_LOADNSI_CONFIG=path/to/your/config/file.py
    # Опционально, требуется только если вы собираетесь использовать официальный API НСИ (Запуск команды с флагом `--use_official_api`).
    NSI_API_USER_KEY=some-key
    
  3. Создание файла конфигурации loadnsi_config.py

    NSI_FIXTURES_FOLDER = 'path/to/your/nsi/folder'
    NSI_PASSPORTS = {
        'file': 'Локальное название файла с паспортами справочников',
        'model': 'Локальное название модели с паспортами справочников',
        # Опциональные параметры (include, exclude):
        'include': <Iterable объект состоящий из полей паспорта (str) которые необходимо оставить в объекте паспорта>,
        'exclude': <Iterable объект состоящий из полей паспорта (str) которые необходимо исключить из объекта паспорта>,
    }
    DICT_INTERNAL_PK = 'your pk field name *not alias*'
    PASSPORTS_REL = 'your fieldname for ForeignKey to PARENT_DICT_CLS'
    PARENT_DICT_CLS = 'your base cls modelname for dicts'
    NSI_DICTIONARIES = {
        'Локальное название файла справочника 1': {
            'model': 'Приложение.МодельСправочника1',
            'oid': 'OID Справочника 1',
            # Опциональные параметры (filter, include, exclude и create_sql):
            'filter': <Callable объект принимает справочник (dict) должен вернуть (bool) оставлять ли этот объект в списке>,
            'include': <Iterable объект состоящий из полей справочника (str) которые необходимо оставить в объекте справочника>,
            'exclude': <Iterable объект состоящий из полей справочника (str) которые необходимо исключить из объекта справочника>,
            'create_sql': <Boolean объект (bool), если True будет создан дублирующий файл справочника в SQL формате>,
        },
        'Локальное название файла справочника 2': {
            'model': 'Приложение.МодельСправочника2',
            'oid': 'OID Справочника 2',
        },
    }
    

About command

Подробности про каждую опцию команды можно узнать вызвав команду с флагом --help

Contributing

We would love you to contribute to loadnsi, pull requests are very welcome! Please see CONTRIBUTING.md for more information.

Metadata

Release files for loadnsi 0.1.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 loadnsi 0.1.2
File Size Uploaded Provenance Actions
loadnsi-0.1.2.tar.gz 39.3 kB With provenance Details for loadnsi-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 71.8 kB

Release files / loadnsi-0.1.2.tar.gz

Download URL loadnsi-0.1.2.tar.gz
Size 39.3 kB
Tags Source
SHA-256 checksum
How to use checksums
495e422b7aa5a6dff8550ac6c6668ff530495227022a44b54c771094032ef393
BLAKE2b-256 checksum
How to use checksums
33efb36f7b62ea28e9e9bbbd517fa5b0460025f65545146831a7911d9869f099
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Aug 9, 2025.

Transparency log

Release files / loadnsi-0.1.2-py3-none-any.whl

Download URL loadnsi-0.1.2-py3-none-any.whl
Size 32.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1fd088284a0ce6cb9f5aa5ba94a802182d28f83d92f66c28150be2293dff7941
BLAKE2b-256 checksum
How to use checksums
4eb1b86260102b0d6b0a34af80818f8fb5e9b241ff4923b4f569a8d789d725e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Aug 9, 2025.

Transparency log

Security for loadnsi 0.1.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for loadnsi-0.1.2.tar.gz

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 Aug 9, 2025.

Transparency log

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