package-auto-assembler


Namepackage-auto-assembler JSON
Version 0.5.23 PyPI version JSON
download
home_pagehttps://kiril-mordan.github.io/reusables/package_auto_assembler/
SummaryA tool to automate package creation within ci based on just .py and optionally .ipynb file.
upload_time2024-12-21 23:01:21
maintainerNone
docs_urlNone
authorKyrylo Mordan
requires_pythonNone
licensemit
keywords python packaging aa-paa-tool
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Package auto assembler

`package-auto-assembler` is a tool that meant to streamline creation of `single module packages`.
Its primary goal is to automate as many aspects of python package creation as possible,
thereby shortening the development cycle of reusable components and maintaining a high standard of quality for reusable code. 

With `package-auto-assembler`, you can simplify the package creation process to the point where it can be seamlessly triggered within CI/CD pipelines, requiring minimal setup and preparation for new modules.

## Key features

- [Set up new Python packaging repositories](https://kiril-mordan.github.io/reusables/package_auto_assembler/python_packaging_repo/) for Github and Azure DevOps.
- [Create new packages dynamically](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#creating-packages), reducing manual effort.
- [Check module dependencies](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#checking-dependencies) for vulnerabilities and unexpected licenses.
- [Run FastAPI and Streamlit apps](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#running-apps-from-packages) directly from packages created with this tool.
- [Extract artifacts and files](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#extracting-files-from-packages) packaged alongside code.
- [Show detailed information](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#show-modules-info) about installed packages made with the tool.
- [Automatically assemble release notes](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#other) based on commit messages.
- [Extract requirements](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#other) automatically from `.py` files without maintaining separate `requirements.txt`.

The following includes additional details to how some features of the packages work with examples that involve internal components. Even though using the package this way is very much possible, [cli interface](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools) is recomended. 


```python
from package_auto_assembler import (VersionHandler, \
    ImportMappingHandler, RequirementsHandler, MetadataHandler, \
        LocalDependaciesHandler, LongDocHandler, SetupDirHandler, \
            ReleaseNotesHandler, MkDocsHandler, PackageAutoAssembler, \
                DependenciesAnalyser)
```

### 1. Package versioning

Package versioning within paa is done based on semantic versioning.

`major.minor.patch`

By default, patch is updated, but the minor and major could also be update based on, for example, commit messages or manually from the log file. 

Package auto assembler does try to pull latest version from package storage, but in case of failure uses version logs stored in `.paa/tracking`.

---

initialize VersionHandler


```python
pv = VersionHandler(
    # required
    versions_filepath = '../tests/package_auto_assembler/other/lsts_package_versions.yml',
    log_filepath = '../tests/package_auto_assembler/other/version_logs.csv',
    # optional
    default_version = "0.0.1")
```

add new package


```python
pv.add_package(
    package_name = "new_package",
    # optional
    version = "0.0.1"
)
```

update package version


```python
pv.increment_patch(
    package_name = "new_package"
)
## for not tracked package
pv.increment_patch(
    package_name = "another_new_package",
    # optional
    default_version = "0.0.1"
)
```

    There are no known versions of 'another_new_package', 0.0.1 will be used!


display current versions and logs


```python
pv.get_versions(
    # optional
    versions_filepath = '../tests/package_auto_assembler/other/lsts_package_versions.yml'
)
```




    {'another_new_package': '0.0.1', 'new_package': '0.0.2'}




```python
pv.get_version(
    package_name='new_package'
)
```




    '0.0.2'




```python
pv.get_logs(
    # optional
    log_filepath = '../tests/package_auto_assembler/other/version_logs.csv'
)
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Timestamp</th>
      <th>Package</th>
      <th>Version</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>2024-07-29 03:26:39</td>
      <td>new_package</td>
      <td>0.0.1</td>
    </tr>
    <tr>
      <th>1</th>
      <td>2024-07-29 03:26:40</td>
      <td>new_package</td>
      <td>0.0.2</td>
    </tr>
    <tr>
      <th>2</th>
      <td>2024-07-29 03:26:40</td>
      <td>another_new_package</td>
      <td>0.0.1</td>
    </tr>
  </tbody>
</table>
</div>



flush versions and logs


```python
pv.flush_versions()
pv.flush_logs()
```

get latest available version with pip


```python
pv.get_latest_pip_version(package_name = 'package-auto-assembler')
```




    '0.3.1'



### 2. Import mapping

Install and import names of dependencies may vary. The mapping files maps import names to install names so that requirements extraction from `.py` files is possible. Some of the mapping are packaged and would not need to provided, but in case a dependency used within new package was not inluded, it is possible to augment default mapping through `.paa/package_mapping.json`.

---

initialize ImportMappingHandler


```python
im = ImportMappingHandler(
    # required
    mapping_filepath = "../env_spec/package_mapping.json"
)
```

load package mappings


```python
im.load_package_mappings(
    # optional
    mapping_filepath = "../env_spec/package_mapping.json"
)
```




    {'PIL': 'Pillow',
     'bs4': 'beautifulsoup4',
     'fitz': 'PyMuPDF',
     'attr': 'attrs',
     'dotenv': 'python-dotenv',
     'googleapiclient': 'google-api-python-client',
     'google_auth_oauthlib': 'google-auth-oauthlib',
     'sentence_transformers': 'sentence-transformers',
     'flask': 'Flask',
     'stdlib_list': 'stdlib-list',
     'sklearn': 'scikit-learn',
     'yaml': 'pyyaml',
     'package_auto_assembler': 'package-auto-assembler',
     'git': 'gitpython'}



### 3. Extracting and merging requirements

Maintaining requirements is much simpler, when done automatically based on the `.py` files. 

The actual requirements files is still constructed. Standard libraries are not added, others are added with their versions, if specified. Local files are also used as dependencies, from which imports are extracted as well. 

For example:

```python
import os
import pandas
import attr #>=22.2.0
from .components.local_dep import *
```

produces 

``` txt
pandas
attrs >=22.2.0
yaml
```

as requirements file, where `yaml` is extracted from `local_dep.py` file.

Checking dependecies for vulnerabilities is usefull and it is done with `pip audit` which is integrated into the paa package and is used by default.

Optional requirements for `extras_require` could be probided the same way normal requirements are, but each like that contains an import like that should be commented out in a special way, starting with `#!`, for example:

```python
import os
import pandas
import attr #>=22.2.0
#! import hnswlib #==0.8.0
```

produces

``` txt
pandas
attrs >=22.2.0
hnswlib==0.8.0; extra == "hnswlib"
```

Sometimes automatic translation of import names to install names via `package_mapping.json`, for packages where these names differ, may not be enough. A manual overwrite can be done with exlusion of some dependencies from automatic extraction pipeline with `#-` comment next to import and `#@` prefix before text that is intended to end up in an equivalent requirements file, for example:

```python
import os
import pandas
import attr #>=22.2.0
import tensorflow #-
#@ tensorflow-gpu
```

produces


``` txt
pandas
attrs >=22.2.0
tensorflow-gpu
```

---

initialize RequirementsHandler


```python
rh = RequirementsHandler(
    # optional/required later
    module_filepath = "../tests/package_auto_assembler/other/example_module.py",
    package_mappings = {'PIL': 'Pillow',
                        'bs4': 'beautifulsoup4',
                        'fitz': 'PyMuPDF',
                        'attr': 'attrs',
                        'dotenv': 'python-dotenv',
                        'googleapiclient': 'google-api-python-client',
                        'sentence_transformers': 'sentence-transformers',
                        'flask': 'Flask',
                        'stdlib_list': 'stdlib-list',
                        'sklearn': 'scikit-learn',
                        'yaml': 'pyyaml'},
    requirements_output_path = "../tests/package_auto_assembler/other/",
    output_requirements_prefix = "requirements_",
    custom_modules_filepath = "../tests/package_auto_assembler/dependancies",
    python_version = '3.8',
    add_header = True
)
```

list custom modules for a given directory


```python
rh.list_custom_modules(
    # optional
    custom_modules_filepath="../tests/package_auto_assembler/dependancies"
)
```




    ['example_local_dependacy_1', 'example_local_dependacy_2']



check if module is a standard python library


```python
rh.is_standard_library(
    # required
    module_name = 'example_local_dependacy_1',
    # optional
    python_version = '3.8'
)
```




    False




```python
rh.is_standard_library(
    # required
    module_name = 'logging',
    # optional
    python_version = '3.8'
)
```




    True



extract requirements from the module file


```python
rh.extract_requirements(
    # optional
    module_filepath = "../tests/package_auto_assembler/other/example_module.py",
    custom_modules = ['example_local_dependacy_2', 'example_local_dependacy_1'],
    package_mappings = {'PIL': 'Pillow',
                        'bs4': 'beautifulsoup4',
                        'fitz': 'PyMuPDF',
                        'attr': 'attrs',
                        'dotenv': 'python-dotenv',
                        'googleapiclient': 'google-api-python-client',
                        'sentence_transformers': 'sentence-transformers',
                        'flask': 'Flask',
                        'stdlib_list': 'stdlib-list',
                        'sklearn': 'scikit-learn',
                        'yaml': 'pyyaml'},
    python_version = '3.8',
    add_header=True
)
```




    (['attrs>=22.2.0'],
     ['torch<=2.4.1', 'fastapi[all]', 'scikit-learn==1.5.1', 'numpy'])




```python
rh.requirements_list
```




    ['attrs>=22.2.0']




```python
rh.optional_requirements_list
```




    ['torch<=2.4.1', 'fastapi[all]', 'scikit-learn==1.5.1', 'numpy']



audit dependencies


```python
rh.check_vulnerabilities(
    # optional if ran extract_requirements() before
    requirements_list = None,
    raise_error = True
)
```

    No known vulnerabilities found
    


    



```python
rh.vulnerabilities
```




    []




```python
try:
    rh.check_vulnerabilities(
        # optional if ran extract_requirements() before
        requirements_list = ['attrs>=22.2.0', 'pandas', 'hnswlib==0.7.0'],
        raise_error = True
    )
except Exception as e:
    print(f"Error: {e}")
```

    Found 1 known vulnerability in 1 package
    


    Name    Version ID                  Fix Versions
    ------- ------- ------------------- ------------
    hnswlib 0.7.0   GHSA-xwc8-rf6m-xr86
    
    Error: Found vulnerabilities, resolve them or ignore check to move forwards!



```python
rh.vulnerabilities
```




    [{'name': 'hnswlib',
      'version': '0.7.0',
      'id': 'GHSA-xwc8-rf6m-xr86',
      'fix_versions': None}]



save requirements to a file


```python
rh.write_requirements_file(
    # optional/required later
    module_name = 'example_module',
    requirements = ['### example_module.py', 'attrs>=22.2.0'],
    output_path = "../tests/package_auto_assembler/other/",
    prefix = "requirements_"
)
```

read requirements


```python
rh.read_requirements_file(
    # required
    requirements_filepath = "../tests/package_auto_assembler/other/requirements_example_module.txt"
)
```




    ['attrs>=22.2.0']



### 4. Preparing metadata

Since all of the necessary information for building a package needs to be contained within main component `.py` file, basic metadata is provided with the use of `__package_metadata__` dictionary object, defined within that `.py` file. It is also used as a trigger for package building within paa pipeline. 

Even though some general information shared between packages could be provided through general config, but package specific info should be provided through `__package_metadata__`. It should support most text fields from setup file, but for others the following fields are available:

- `classifiers`: adds classifiers to the general ones from config, unless it's `Development Status :: ` then module level definition will overwrite the one from config
- `extras_require`: a dictionary of optional package that wouldn't be installed during normal installation. The key could be used during installation and the value would be a list of dependencies.
- `install_requires` : adds requirements to the list read from imports

\* Note that providing dependencies this way does not check them through pip-audit or translate them through package mapping

---


initializing MetadataHandler


```python
mh = MetadataHandler(
    # optional/required later
    module_filepath = "../tests/package_auto_assembler/other/example_module.py"
)
```

check if metadata is available


```python
mh.is_metadata_available(
    # optional
    module_filepath = "../tests/package_auto_assembler/other/example_module.py"
)
```




    True



extract metadata from module


```python
mh.get_package_metadata(
    # optional
    module_filepath = "../tests/package_auto_assembler/other/example_module.py"
)
```




    {'author': 'Kyrylo Mordan',
     'author_email': 'parachute.repo@gmail.com',
     'version': '0.0.1',
     'description': 'A mock handler for simulating a vector database.',
     'keywords': ['python', 'vector database', 'similarity search']}



### 5. Merging local dependacies into single module

Package auto assembler creates `single module packages`, meaning that once package is built all of the object are imported from a single place. The packaging tool does allow for `local dependecies` which are `.py` files imported from specified dependencies directory and its subfolders. Packaging structure may look like the following:

```
packaging repo/
└src/
  ├ <package names>.py
  └ components
    ├local_dependecy.py
    └subdir_1
      └local_dependency_2.py 
```

During packaging process paa merges main module with its local dependies into a single file.

---

initializing LocalDependaciesHandler


```python
ldh = LocalDependaciesHandler(
    # required
    main_module_filepath = "../tests/package_auto_assembler/other/example_module.py",
    dependencies_dir = "../tests/package_auto_assembler/dependancies/",
    # optional
    save_filepath = "./combined_example_module.py"
)
```

combine main module with dependacies


```python
print(ldh.combine_modules(
    # optional
    main_module_filepath = "../tests/package_auto_assembler/other/example_module.py",
    dependencies_dir = "../tests/package_auto_assembler/dependancies/",
    add_empty_design_choices = False
)[0:1000])
```

    """
    Mock Vector Db Handler
    
    This class is a mock handler for simulating a vector database, designed primarily for testing and development scenarios.
    It offers functionalities such as text embedding, hierarchical navigable small world (HNSW) search,
    and basic data management within a simulated environment resembling a vector database.
    """
    
    import logging
    import json
    import time
    import attr #>=22.2.0
    import sklearn
    
    __design_choices__ = {}
    
    @attr.s
    class Shouter:
    
        """
        A class for managing and displaying formatted log messages.
    
        This class uses the logging module to create and manage a logger
        for displaying formatted messages. It provides a method to output
        various types of lines and headers, with customizable message and
        line lengths.
        """
    
        # Formatting settings
        dotline_length = attr.ib(default=50)
    
        # Logger settings
        logger = attr.ib(default=None)
        logger_name = attr.ib(default='Shouter')
        loggerLvl = attr.ib(default=logging.DEBUG)
        log



```python
ldh.dependencies_names_list
```




    ['example_local_dependacy_2', 'example_local_dependacy_1', 'dep_from_bundle_1']



save combined module


```python
ldh.save_combined_modules(
    # optional
    combined_module = ldh.combine_modules(),
    save_filepath = "./combined_example_module.py"
)
```

### 6. Prepare README

Package description is based on `.ipynb` with same name as the `.py`. By default it is converted to markdown as is, but there is also an option to execute it.

---


```python
import logging
ldh = LongDocHandler(
    # optional/required later
    notebook_path = "../tests/package_auto_assembler/other/example_module.ipynb",
    markdown_filepath = "../example_module.md",
    timeout = 600,
    kernel_name = 'python3',
    # logger
    loggerLvl = logging.DEBUG
)
```

convert notebook to md without executing


```python
ldh.convert_notebook_to_md(
    # optional
    notebook_path = "../tests/package_auto_assembler/other/example_module.ipynb",
    output_path = "../example_module.md"
)
```

    Converted ../tests/package_auto_assembler/example_module.ipynb to ../example_module.md


convert notebook to md with executing


```python
ldh.convert_and_execute_notebook_to_md(
    # optional
    notebook_path = "../tests/package_auto_assembler/other/example_module.ipynb",
    output_path = "../example_module.md",
    timeout = 600,
    kernel_name = 'python3'
)
```

    Converted and executed ../tests/package_auto_assembler/example_module.ipynb to ../example_module.md


return long description


```python
long_description = ldh.return_long_description(
    # optional
    markdown_filepath = "../example_module.md"
)
```

### 7. Assembling setup directory

Packages are created following rather simple sequence of steps. At some point of the process a temporary directory is created to store the following files:

- `__init__.py` is a simple import from a single module
- `<package name>.py` is a single module with all of the local dependecies
- `cli.py` is optional packaged cli tool
- `routes.py` is optional packaged file with fastapi routes
- `streamlit.py` is optional packaged streamlit app
- `setup.py` is a setup file for making a package
- `README.md` is a package description file based on `.ipynb` file
- `LICENSE` is optional license file
- `MANIFEST.in` is a list of additional files to be included with the package
- `mkdocs` is a folder with built mkdocs site based on optional `extra_docs` for the module, module docstring and `README.md`
- `artifacts` contains optional files that would be packaged with the module
- `tests` contains files needed to run tests with [`pytest`](https://docs.pytest.org/en/stable/)
- `.paa.tracking` contains tracking files from `.paa` dir to make each release of the package independent of PPR that released it

---


initializing SetupDirHandler


```python
sdh = SetupDirHandler(
    # required
    module_filepath = "../tests/package_auto_assembler/other/example_module.py",
    # optional/ required
    module_name = "example_module",
    metadata = {'author': 'Kyrylo Mordan',
                'version': '0.0.1',
                'description': 'Example module.',
                'long_description' : long_description,
                'keywords': ['python']},
    license_path = "../LICENSE",
    requirements = ['attrs>=22.2.0'],
    classifiers = ['Development Status :: 3 - Alpha',
                   'Intended Audience :: Developers',
                   'Intended Audience :: Science/Research',
                   'Programming Language :: Python :: 3',
                   'Programming Language :: Python :: 3.9',
                   'Programming Language :: Python :: 3.10',
                   'Programming Language :: Python :: 3.11',
                   'License :: OSI Approved :: MIT License',
                   'Topic :: Scientific/Engineering'],
    setup_directory = "./example_setup_dir"
)
```

create empty setup dir


```python
sdh.flush_n_make_setup_dir(
    # optional
    setup_directory = "./example_setup_dir"
)
```

copy module to setup dir


```python
sdh.copy_module_to_setup_dir(
    # optional
    module_filepath = "./combined_example_module.py",
    setup_directory = "./example_setup_dir"
)
```

copy license to setup dir


```python
sdh.copy_module_to_setup_dir(
    # optional
    license_path = "../LICENSE",
    setup_directory = "./example_setup_dir"
)
```

create init file


```python
sdh.create_init_file(
    # optional
    module_name = "example_module",
    setup_directory = "./example_setup_dir"
)
```

create setup file


```python
sdh.write_setup_file(
    # optional
    module_name = "example_module",
    metadata = {'author': 'Kyrylo Mordan',
                'version': '0.0.1',
                'description': 'Example Module',
                'keywords': ['python']},
    requirements = ['attrs>=22.2.0'],
    classifiers = ['Development Status :: 3 - Alpha',
                   'Intended Audience :: Developers',
                   'Intended Audience :: Science/Research',
                   'Programming Language :: Python :: 3',
                   'Programming Language :: Python :: 3.9',
                   'Programming Language :: Python :: 3.10',
                   'Programming Language :: Python :: 3.11',
                   'License :: OSI Approved :: MIT License',
                   'Topic :: Scientific/Engineering'],
    setup_directory = "./example_setup_dir"
)
```

### 8. Creating release notes from commit messages

Package versioning could be enhanced with release notes. Since the tool is mainly meant for ci/cd, it takes advantage of commit messages to construct a release note for every version. 

Commit history is analysed from the last merge, if nothiong found then the next and the next, until at least one of `[<package name>]` labels are found within commit messages. They are bundled together to for a note, where each commit message or messages deliminated with `;` are turned in a list element. Previos notes are used to establish which part of commit history to use as a starting point.

Commit messages could also be used to increment version by something other then a default patch. 

- `[<package name>][..+]` increments patch (default behavior)
- `[<package name>][.+.]` increments minor
- `[<package name>][+..]` increments major
- `[<package name>][0.1.2]` forces specific version `0.1.2`

\* First release within new packaging repo may struggle to extract release note since commit messages are only analysed from merges in the commit history. 

---



```python
rnh = ReleaseNotesHandler(
    # path to existing or new release notes file
    filepath = '../tests/package_auto_assembler/other/release_notes.md',
    # name of label in commit message [example_module] for filter
    label_name = 'example_module',
    # new version to be used in release notes
    version = '0.0.1'
)
```

    No relevant commit messages found!
    ..trying depth 2 !
    No relevant commit messages found!
    No messages to clean were provided


overwritting commit messages from example


```python
# commit messages from last merge
rnh.commit_messages
```




    ['fixing paa tests',
     'fixing paa tests',
     'fixing paa tests',
     '[package_auto_assembler] increasing default max search depth for commit history to 5',
     'fixing mocker-db release notes',
     'Update package version tracking files',
     'Update README',
     'Update requirements']




```python
example_commit_messages = [
    '[example_module] usage example for initial release notes; bugfixes for RNH',
    '[BUGFIX] missing parameterframe usage example and reduntant png file',
    '[example_module][0.1.2] initial release notes handler',
    'Update README',
    'Update requirements'
]
rnh.commit_messages = example_commit_messages
```

internal methods that run on intialiazation of ReleaseNotesHandler


```python
# get messages relevant only for label
rnh._filter_commit_messages_by_package()
print("Example filtered_messaged:")
print(rnh.filtered_messages)

# clean messages
rnh._clean_and_split_commit_messages()
print("Example processed_messages:")
print(rnh.processed_messages)
```

    Example filtered_messaged:
    ['[example_module] usage example for initial release notes; bugfixes for RNH', '[example_module][0.1.2] initial release notes handler']
    Example processed_messages:
    ['usage example for initial release notes', 'bugfixes for RNH', 'initial release notes handler']


get version update from relevant messages


```python
version_update = rnh.extract_latest_version()
print(f"Example version_update: {version_update}")
```

    Example version_update: 0.1.2


get latest version from relevant release notes


```python
latest_version = rnh.extract_latest_version()
print(f"Example latest_version: {latest_version}")
```

    Example latest_version: 0.1.2


augment existing release note with new entries or create new


```python
# augment existing release note with new entries or create new
rnh.create_release_note_entry(
    # optional
    existing_contents=rnh.existing_contents,
    version=rnh.version,
    new_messages=rnh.processed_messages
)
print("Example processed_note_entries:")
print(rnh.processed_note_entries)
```

    Example processed_note_entries:
    ['# Release notes\n', '\n', '### 0.1.2\n', '\n', '    - usage example for initial release notes\n', '\n', '    - bugfixes for RNH\n', '\n', '    - initial release notes handler\n', '\n', '### 0.0.1\n', '\n', '    - initial version of example_module\n']


saving updated relese notes


```python
rnh.existing_contents
```




    ['# Release notes\n',
     '\n',
     '### 0.1.2\n',
     '\n',
     '    - usage example for initial release notes\n',
     '    - bugfixes for RNH\n',
     '    - initial release notes handler\n',
     '### 0.1.2\n',
     '\n',
     '    - usage example for initial release notes\n',
     '\n',
     '    - bugfixes for RNH\n',
     '\n',
     '    - initial release notes handler\n',
     '\n',
     '### 0.0.1\n',
     '\n',
     '    - initial version of example_module\n']




```python
rnh.save_release_notes()
```


```python
# updated content
rnh.get_release_notes_content()
```




    ['# Release notes\n',
     '\n',
     '### 0.1.2\n',
     '\n',
     '    - usage example for initial release notes\n',
     '\n',
     '    - bugfixes for RNH\n',
     '\n',
     '    - initial release notes handler\n',
     '\n',
     '### 0.0.1\n',
     '\n',
     '    - initial version of example_module\n']



### 9. Analysing package dependencies

Extracting info from installed dependencies can provide important insight into inner workings of a package and help avoid some of the licenses. 

Licenses are extracted from package metadata and normalized for analysis. Missing labels are marked with `-` and not recognized licenses with `unknown`.

Information about unrecognized license labels could be provided through `.paa/package_licenses json` file that would contain install package name and corresponding license label.

---


```python
da = DependenciesAnalyser(
    # optional
    package_name = 'mocker-db',
    package_licenses_filepath = '../tests/package_auto_assembler/other/package_licenses.json',
    allowed_licenses = ['mit', 'apache-2.0', 'lgpl-3.0', 'bsd-3-clause', 'bsd-2-clause', '-', 'mpl-2.0']
)
```

finding installed packages with a list of tags


```python
da.filter_packages_by_tags(tags=['aa-paa-tool'])
```




    [('comparisonframe', '0.0.0'),
     ('mocker-db', '0.0.1'),
     ('package-auto-assembler', '0.0.0'),
     ('proompter', '0.0.0')]



extracting some metadata from the installed package


```python
package_metadata = da.get_package_metadata(
    package_name = 'mocker-db'
)
package_metadata
```




    {'keywords': ['aa-paa-tool'],
     'version': '0.0.1',
     'author': 'Kyrylo Mordan',
     'author_email': 'parachute.repo@gmail.com',
     'classifiers': ['Development Status :: 3 - Alpha',
      'Intended Audience :: Developers',
      'Intended Audience :: Science/Research',
      'Programming Language :: Python :: 3',
      'Programming Language :: Python :: 3.9',
      'Programming Language :: Python :: 3.10',
      'Programming Language :: Python :: 3.11',
      'License :: OSI Approved :: MIT License',
      'Topic :: Scientific/Engineering',
      'PAA-Version :: 0.4.3',
      'PAA-CLI :: False'],
     'paa_version': '0.4.3',
     'paa_cli': 'False',
     'license_label': 'MIT'}



extracting package requirements


```python
package_requirements = da.get_package_requirements(
    package_name = 'mocker-db'
)
package_requirements
```




    ['requests',
     'attrs >=22.2.0',
     'httpx',
     'hnswlib ==0.8.0',
     'gridlooper ==0.0.1',
     'dill ==0.3.7',
     'numpy ==1.26.0',
     "sentence-transformers ; extra == 'sentence_transformers'"]



extracting tree of dependencies


```python
extracted_dependencies_tree = da.extract_dependencies_tree(
    package_name = 'mocker-db'
)
extracted_dependencies_tree
```




    {'requests': {'charset-normalizer': [],
      'idna': [],
      'urllib3': [],
      'certifi': []},
     'attrs': {'importlib-metadata': {'zipp': [], 'typing-extensions': []}},
     'httpx': {'anyio': {'idna': [],
       'sniffio': [],
       'exceptiongroup': [],
       'typing-extensions': []},
      'certifi': [],
      'httpcore': {'certifi': [], 'h11': {'typing-extensions': []}},
      'idna': [],
      'sniffio': []},
     'hnswlib': {'numpy': []},
     'gridlooper': {'dill': [],
      'attrs': {'importlib-metadata': {'zipp': [], 'typing-extensions': []}},
      'tqdm': {'colorama': []}},
     'dill': [],
     'numpy': []}



addding license labels to tree of dependencies


```python
extracted_dependencies_tree_license = da.add_license_labels_to_dep_tree(
    dependencies_tree = extracted_dependencies_tree
)
extracted_dependencies_tree_license
```




    {'requests': 'apache-2.0',
     'requests.charset-normalizer': '-',
     'requests.idna': '-',
     'requests.urllib3': '-',
     'requests.certifi': 'mpl-2.0',
     'attrs': '-',
     'attrs.importlib-metadata': '-',
     'attrs.importlib-metadata.zipp': '-',
     'attrs.importlib-metadata.typing-extensions': '-',
     'httpx': '-',
     'httpx.anyio': 'mit',
     'httpx.anyio.idna': '-',
     'httpx.anyio.sniffio': '-',
     'httpx.anyio.exceptiongroup': '-',
     'httpx.anyio.typing-extensions': '-',
     'httpx.certifi': 'mpl-2.0',
     'httpx.httpcore': '-',
     'httpx.httpcore.certifi': 'mpl-2.0',
     'httpx.httpcore.h11': 'mit',
     'httpx.httpcore.h11.typing-extensions': '-',
     'httpx.idna': '-',
     'httpx.sniffio': '-',
     'hnswlib': '-',
     'hnswlib.numpy': 'bsd-3-clause',
     'gridlooper': '-',
     'gridlooper.dill': 'bsd-3-clause',
     'gridlooper.attrs': '-',
     'gridlooper.attrs.importlib-metadata': '-',
     'gridlooper.attrs.importlib-metadata.zipp': '-',
     'gridlooper.attrs.importlib-metadata.typing-extensions': '-',
     'gridlooper.tqdm': '-',
     'gridlooper.tqdm.colorama': '-',
     'dill': 'bsd-3-clause',
     'numpy': 'bsd-3-clause'}



printing extracted tree of dependencies


```python
da.print_flattened_tree(extracted_dependencies_tree_license)
```

    └── requests : apache-2.0
        ├── charset-normalizer : -
        ├── idna : -
        ├── urllib3 : -
        └── certifi : mpl-2.0
    └── attrs : -
        └── importlib-metadata : -
            ├── zipp : -
            └── typing-extensions : -
    └── httpx : -
        ├── anyio : mit
            ├── idna : -
            ├── sniffio : -
            ├── exceptiongroup : -
            └── typing-extensions : -
        ├── certifi : mpl-2.0
        ├── httpcore : -
            ├── certifi : mpl-2.0
            └── h11 : mit
                └── typing-extensions : -
        ├── idna : -
        └── sniffio : -
    └── hnswlib : -
        └── numpy : bsd-3-clause
    └── gridlooper : -
        ├── dill : bsd-3-clause
        ├── attrs : -
            └── importlib-metadata : -
                ├── zipp : -
                └── typing-extensions : -
        └── tqdm : -
            └── colorama : -
    └── dill : bsd-3-clause
    └── numpy : bsd-3-clause


filtering for unexpected licenses in tree of dependencies


```python
allowed_licenses = ['mit', 'apache-2.0', 'lgpl-3.0', 'mpl-2.0', '-']

da.find_unexpected_licenses_in_deps_tree(
    tree_dep_license = extracted_dependencies_tree_license,
    # optional
    allowed_licenses = allowed_licenses,
    raise_error = True
)
```

    {'hnswlib': '', 'gridlooper': ''}
    └── dill : bsd-3-clause
    └── numpy : bsd-3-clause
    └── hnswlib : 
        └── numpy : bsd-3-clause
    └── gridlooper : 
        └── dill : bsd-3-clause



    ---------------------------------------------------------------------------

    Exception                                 Traceback (most recent call last)

    Cell In[9], line 3
          1 allowed_licenses = ['mit', 'apache-2.0', 'lgpl-3.0', 'mpl-2.0', '-']
    ----> 3 da.find_unexpected_licenses_in_deps_tree(
          4     tree_dep_license = extracted_dependencies_tree_license,
          5     # optional
          6     allowed_licenses = allowed_licenses,
          7     raise_error = True
          8 )


    File ~/miniforge3/envs/testenv/lib/python3.10/site-packages/package_auto_assembler/package_auto_assembler.py:2670, in DependenciesAnalyser.find_unexpected_licenses_in_deps_tree(self, tree_dep_license, allowed_licenses, raise_error)
       2668 if raise_error and out != {}:
       2669     self.print_flattened_tree(flattened_dict = out)
    -> 2670     raise Exception("Found unexpected licenses!")
       2671 else:
       2672     self.logger.info("No unexpected licenses found")


    Exception: Found unexpected licenses!


### 10. Adding cli interfaces

The tool allows to make a package with optional cli interfaces. These could be sometimes preferable when a package contains a standalone tool that would be called from script anyway.

All of the cli logic would need to be included within a `.py` file which should be stored within `cli_dir` provided in `.paa.config`. 
Dependencies from these files are extracted in the similar manner to the main module.

Tools from main `.py` file could still be imported like the following:

```python
from package_name.package_name import ToBeImported
```

The code is wired in `setup.py` via the following automatically assuming that appropriate file with the same name as the package exists within `cli_dir` location.

```python
...,
entry_points = {'console_scripts': [
    '<package_alias> = package_name.cli:cli']} ,
...
```

Alias for name could be provided via the following piece of code, defined after imports, otherwise package name would be used.

```python 
__cli_metadata__ = {
    "name" : <package_alias>
}
```

Package-auto-assembler tool itself uses [`click`](https://pypi.org/project/click/) dependency to build that file, use its [cli definition](https://github.com/Kiril-Mordan/reusables/blob/main/cli/package_auto_assembler.py) as example.



### 11. Adding routes and running FastAPI application

The tool allows to make a package with optional routes for FastAPI application and run them. Each packages can have one routes file where its logic should be defined. Package-auto-assembler itself can combine multiple routes from packages and filepaths into one application.

A `.py`  file with the same name of the package should be stored within `api_routes_dir` provided in `.paa.config`.

Dependencies from these files are extracted in the similar manner to the main module.

Tools from main `.py` file could still be imported like the following:

```python
from package_name.package_name import ToBeImported
```

Api description, middleware and run parameters could be provided via optional `.paa.api.config` file, which for example would look like:

```
DESCRIPTION : {
    'version' : 0.0.0
}
MIDDLEWARE : {
    allow_origins : ['*']
}
RUN : {
 host : 0.0.0.0
}
```

where DESCRIPTION contains parameters for `FastAPI`, MIDDLEWARE for `CORSMiddleware` and RUN for `uvicorn.run`


### 12. Adding ui and running streamlit application

The tools allows to make a package with optional [`streamlit`](https://streamlit.io/) application as interface to the packaged code.  Each package can have one streamlit file. Package-auto-assembler itself would then be used to run packaged applications from the package. 

A `.py`  file with the same name of the package should be stored within `streamlit_dir` provided in `.paa.config`.

Dependencies from these files are extracted in the similar manner to the main module.

Tools from main `.py` file could still be imported like the following:

```python
from package_name import ToBeImported
```

Config file with server, theme and other settings can be provided via optional `.paa.streamlit.config`. 


### 13 Adding artifacts to packages

The tool allows to add files to packages that could be accessed from the package or extracted into selected directory.

There are different types of artifacts with a package like this:

- `.paa.tracking` : includes some tracking files for the purposes of the tool, added to every package
- `mkdocs` : optional static mkdocs site 
- `artifacts` contains directories, files and links to files copied from `artifacts_dir/<package_name>` (from `.paa.config`)
- `tests` contains optional directory with tests with `pytest`, copied from `tests_dir/<package_name>` (from `.paa.config`)

##### 1. Description of default tracking files

Tracking files are added automatically of artifacts adding was not turned off. At the moment contains:

- `.paa.config` : config file that specifies how paa show work
- `.paa.version`: version of `package-auto-assembler` that was used for packaging
- `release_notes.md` : latest release notes for the package
- `version_logs.csv` : logs for version updates for all packages in the packaging repo
- `lsts_package_versions.yml` : latests versions of all packages in the packaging repo
- `package_mapping.json` : additional user-provided remapping of package import names to install names
- `package_licenses.json` : additional user-provided license labels to overwrite detected ones
- `notebook.ipynb` : optional jupyter notebook that was used for package description`

##### 2. Adding files

User provided artifacts could be provided in two ways:

1. adding directory, file or link to the file under `artifacts_dir/<package_name>`

    These files would be packaged with the packages, and files from links would be downloaded and packaged as well. To add a link, create a file with `.link` extension in the name.

2. adding `artifact_urls` dictionary to `__package_metadata__` within module `.py` file

Example of `__package_metadata__` with these additional dictionary would be:

```python
__package_metadata__ = {
    ...,
    "artifact_urls" : {
        'downloaded.md' : 'https://raw.githubusercontent.com/Kiril-Mordan/reusables/refs/heads/main/docs/module_from_raw_file.md',
        'downloaded.png' : 'https://raw.githubusercontent.com/Kiril-Mordan/reusables/refs/heads/main/docs/reuse_logo.png'
    }
}
```

where key would contain name of the artifact and value its link.

These files would not be downloaded and only links would be packaged. After package installation both kinds of links could be refreshed/donwloaded using [`cli interface`](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli/) from `package-auto-assembler`.

##### 3. Accessing packaged artifacts

Artifacts packaged within the package could be accessed in two ways:

1. using [`package-auto-assembler` cli tools](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#extracting-files-from-packages) to copy a file or files into a selected directory

2. reading packaged artifacts from the package, by the use of similar code that finds path to installed package in your system:

```python
import importlib
import importlib.metadata
import importlib.resources as pkg_resources

installed_package_path = pkg_resources.files('<package_name>')

file_name_path = None
if 'artifacts' in os.listdir(installed_package_path):

    with pkg_resources.path('<package_name>.artifacts', '<file_name>') as path:
        file_name_path = path
```


### 14. Preparing module for packaging

#### 1. Preparing code for packaging

To add/edit a python package with `package-auto-assembler`, its building blocks would need to follow requirements mentioned below. 

**Note**: For basic package only `main module` would be required. More about role of optional files could be seen [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/python_packaging_repo/#inputs-and-outputs-of-ppr).

- Main module **[required]**

    Main module is considered to be a `<package_name>.py` file stored in `module_dir` (from `.paa.config`), which can also me called `packaging layer`. 
    This is where most code of the package would be, unless `local dependencies` are used. 

    Requirements to this file:

    1. starts with module docstring (will be used in package description)
    2. contains [`__package_metadata__`](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#4-preparing-metadata) (a way to provide package metadata)
    3. **[optional]** import from `local dependencies` stored only in `dependencies_dir`
    4. **[optional]** contains [versions of module dependencies](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#3-extracting-and-merging-requirements) (specifying requirements)


- Local dependencies

    Local dependencies are optional modules that other modules from `packaging layer` would import from, and are not packaged on their own. These are useful for segmenting codebase into smaller independent components.
    They would be stored in subdirectory of `module_dir`, specified as `dependencies_dir` in `.paa.config`. 

    Requirements for these files:

    1. stored only in `dependencies_dir` or its subdirectories 
    2. do not import any other moduled stored locally
    3. **[optional]** contain [versions of module dependencies](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#3-extracting-and-merging-requirements) (specifying requirements)


- Cli interface

    Command line interface could be optionally defined for a package by placing `<package_name>.py` file into `cli_dir` (from `.paa.config`). More about adding cli could be found [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#10-adding-cli-interfaces).

    Requirements for this file:

    1. imports and uses [`click`](https://pypi.org/project/click/) to define cli tools
    2. contains [`__cli_metadata__`](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#10-adding-cli-interfaces) (a way to provide alias for cli tools)
    3. **[optional]** imports from packaging layer and local dependencies only with `from <package_name>.<package_name> import ToBeImported`
    4. **[optional]** contains [versions of module dependencies](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#3-extracting-and-merging-requirements) (specifying requirements)



- API routes

    Routes for FastAPI application could be optionally defined for a package by placing `<package_name>.py` file into `api_routes_dir` (from `.paa.config`). More about adding api routes could be found [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#11-adding-routes-and-running-fastapi-application).

    Requirements for this file:

    1. imports `from fastapi import APIRouter`
    2. defines `router = APIRouter(prefix = "/<package-name>")`
    3. uses `@router.*` to define endpoints
    4. **[optional]** import from packaging layer and local dependencies only with `from <package_name>.<package_name> import ToBeImported`
    5. **[optional]** contain [versions of module dependencies](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#3-extracting-and-merging-requirements) (specifying requirements)


- Streamlit app

    Streamlit application could be optionally defined for a package by placing `<package_name>.py` file into `streamlit_dir` (from `.paa.config`). More about adding streamlit app could be found [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#12-adding-ui-and-running-streamlit-application).

    Requirements for this file:

    1. imports [`streamlit`](https://pypi.org/project/streamlit/)
    2. **[optional]** import from packaging layer and local dependencies only with `from <package_name>.<package_name> import ToBeImported`
    3. **[optional]** contain [versions of module dependencies](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#3-extracting-and-merging-requirements) (specifying requirements)



#### 2. Preparing documentation for packaging

- Package description

    Providing package description is a useful way to show what the package is about to the intended audience. By default, [`main_module`](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#preparing-code-for-packaging) docstring would be used for this purpose and stored alongside the package in a `README.md` file, as shown [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/python_packaging_repo/#inputs-and-outputs-of-ppr). 

    Optionally, one could provide additional information that would be appended to the package docstring via `<package_name>.ipynb` file, placed into `example_notebooks_path` (from `.paa.config`). In the early stages of development, this file could both serve as a place where code is developed/tested before a release and a way to show usage examples.


- Additional documentation

    Package description may not be enough to store documentation. 
    A simple [mkdocs](https://www.mkdocs.org/) static site is built by default for every package with for followig tabs:

    - `intro` contains module docstring and `pypi` link for `github + pypi` type of packaging repository
    - `description` contains optional content from `<package_name>.ipynb` file, placed into `example_notebooks_path` (from `.paa.config`)
    - `release notes` contains release notes assembled based on commit messages

    Additional documentation can be provided via the following files:

    1. `<package_name>.drawio` file, placed into `drawio_dir` (from `.paa.config`). Each tab would be turned into `<package_name>-<tab_name>.png`, which if not referenced would be presented as a separate tab;
    2. `.png`, `.ipynb` or `.md` files placed in `extra_docs_dir/<package_name>` (from `.paa.config`). Each file would be turned into a separate tab, but just like `.png` from drawio, if referenced, would not be presented as a separate tab.

    **Note**: During packaging process files derived from `<package_name>.drawio` conversion and files from `extra_docs_dir/<package_name>` would both be placed into `.paa/docs` with `<package_name>-*` prefix. Make sure not to name drawio tabs and extra docs with the same names. 

#### 3. Preparing files for packaging

Packaging files alongside code and documentation could be achieved by placing files  into `artifacts_dir/<package_name>` directory (from `.paa.config`). These files could be referenced from within the package and there is an option to provide links instead of physical files. More about adding artifacts to the package could be found [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#13-adding-artifacts-to-packages).

Tests that would be used in ci/cd pipeline are expected to be placed into `tests_dir<package_name>` directory (from `.paa.config`). These would be copied into the package as well. 




### 15. Making a package

Main wrapper for the package integrates described above components into a class that could be used to build package building pipelines within python scripts. 

To simplify usage [cli interface](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli/) is recomended instead. 

---

initializing PackageAutoAssembler


```python
paa = PackageAutoAssembler(
    # required
    module_name = "example_module",
    module_filepath  = "../tests/package_auto_assembler/other/example_module.py",
    # optional
    mapping_filepath = "../env_spec/package_mapping.json",
    licenses_filepath = "../tests/package_auto_assembler/other/package_licenses.json",
    allowed_licenses = ['mit', 'apache-2.0', 'lgpl-3.0', 'mpl-2.0', '-'],
    dependencies_dir = "../tests/package_auto_assembler/dependancies/",
    example_notebook_path = "./mock_vector_database.ipynb",
    versions_filepath = '../tests/package_auto_assembler/other/lsts_package_versions.yml',
    log_filepath = '../tests/package_auto_assembler/other/version_logs.csv',
    setup_directory = "./example_module",
    release_notes_filepath = "../tests/package_auto_assembler/other/release_notes.md",
    license_path = "../LICENSE",
    license_label = "mit",
    classifiers = ['Development Status :: 3 - Alpha',
                    'Intended Audience :: Developers',
                    'Intended Audience :: Science/Research',
                    'Programming Language :: Python :: 3',
                    'Programming Language :: Python :: 3.9',
                    'Programming Language :: Python :: 3.10',
                    'Programming Language :: Python :: 3.11',
                    'License :: OSI Approved :: MIT License',
                    'Topic :: Scientific/Engineering'],
    requirements_list = [],
    execute_readme_notebook = True,
    python_version = "3.8",
    version_increment_type = "patch",
    default_version = "0.0.1",
    check_vulnerabilities = True,
    check_dependencies_licenses = False,
    add_requirements_header = True
)
```

add metadata from module


```python
paa.add_metadata_from_module(
    # optional
    module_filepath  = "../tests/package_auto_assembler/other/example_module.py"
)
```

    Adding metadata ...


add or update version


```python
paa.add_or_update_version(
    # overwrites auto mode (not suggested)
    version_increment_type = "patch",
    version = "1.2.6",
    # optional
    module_name = "example_module",
    versions_filepath = '../tests/package_auto_assembler/lsts_package_versions.yml',
    log_filepath = '../tests/package_auto_assembler/version_logs.csv'
)
```

    Incrementing version ...
    No relevant commit messages found!
    ..trying depth 2 !
    No relevant commit messages found!
    ..trying depth 3 !
    No relevant commit messages found!
    ..trying depth 4 !
    No relevant commit messages found!
    ..trying depth 5 !
    No relevant commit messages found!
    No messages to clean were provided


add release notes from commit messages


```python
paa.add_or_update_release_notes(
    # optional
    filepath="../tests/package_auto_assembler/release_notes.md",
    version=paa.metadata['version']
)
```

    Updating release notes ...


prepare setup directory


```python
paa.prep_setup_dir()
```

    Preparing setup directory ...


merge local dependacies


```python
paa.merge_local_dependacies(
    # optional
    main_module_filepath = "../tests/package_auto_assembler/other/example_module.py",
    dependencies_dir= "../tests/package_auto_assembler/dependancies/",
    save_filepath = "./example_module/example_module.py"
)
```

    Merging ../tests/package_auto_assembler/other/example_module.py with dependecies from ../tests/package_auto_assembler/dependancies/ into ./example_module/example_module.py


add requirements from module


```python
paa.add_requirements_from_module(
    # optional
    module_filepath = "../tests/package_auto_assembler/other/example_module.py",
    import_mappings = {'PIL': 'Pillow',
                        'bs4': 'beautifulsoup4',
                        'fitz': 'PyMuPDF',
                        'attr': 'attrs',
                        'dotenv': 'python-dotenv',
                        'googleapiclient': 'google-api-python-client',
                        'sentence_transformers': 'sentence-transformers',
                        'flask': 'Flask',
                        'stdlib_list': 'stdlib-list',
                        'sklearn': 'scikit-learn',
                        'yaml': 'pyyaml',
                        'git' : 'gitpython'}
)
```

    Adding requirements from ../tests/package_auto_assembler/other/example_module.py
    No known vulnerabilities found
    


    



```python
paa.requirements_list
```




    ['### example_module.py', 'attrs>=22.2.0']



make README out of example notebook


```python
paa.add_readme(
    # optional
    example_notebook_path = "../tests/package_auto_assembler/other/example_module.ipynb",
    output_path = "./example_module/README.md",
    execute_notebook=False,
)
```

    Adding README from ../tests/package_auto_assembler/other/example_module.ipynb to ./example_module/README.md


prepare setup file


```python
paa.prep_setup_file(
    # optional
    metadata = {'author': 'Kyrylo Mordan',
                'version': '0.0.1',
                'description': 'Example module',
                'keywords': ['python'],
                'license' : 'mit'},
    requirements = ['### example_module.py',
                    'attrs>=22.2.0'],
    classifiers = ['Development Status :: 3 - Alpha',
                    'Intended Audience :: Developers',
                    'Intended Audience :: Science/Research',
                    'Programming Language :: Python :: 3',
                    'Programming Language :: Python :: 3.9',
                    'Programming Language :: Python :: 3.10',
                    'Programming Language :: Python :: 3.11',
                    'License :: OSI Approved :: MIT License',
                    'Topic :: Scientific/Engineering'],
    cli_module_filepath = "../tests/package_auto_assembler/other/cli.py"

)
```

    Preparing setup file for example-module package ...


make package


```python
paa.make_package(
    # optional
    setup_directory = "./example_module"
)
```

    Making package from ./example_module ...





    CompletedProcess(args=['python', './example_module/setup.py', 'sdist', 'bdist_wheel'], returncode=0, stdout="running sdist\nrunning egg_info\nwriting example_module.egg-info/PKG-INFO\nwriting dependency_links to example_module.egg-info/dependency_links.txt\nwriting entry points to example_module.egg-info/entry_points.txt\nwriting requirements to example_module.egg-info/requires.txt\nwriting top-level names to example_module.egg-info/top_level.txt\nreading manifest file 'example_module.egg-info/SOURCES.txt'\nwriting manifest file 'example_module.egg-info/SOURCES.txt'\nrunning check\ncreating example_module-0.0.0\ncreating example_module-0.0.0/example_module\ncreating example_module-0.0.0/example_module.egg-info\ncopying files to example_module-0.0.0...\ncopying example_module/__init__.py -> example_module-0.0.0/example_module\ncopying example_module/cli.py -> example_module-0.0.0/example_module\ncopying example_module/example_module.py -> example_module-0.0.0/example_module\ncopying example_module/setup.py -> example_module-0.0.0/example_module\ncopying example_module.egg-info/PKG-INFO -> example_module-0.0.0/example_module.egg-info\ncopying example_module.egg-info/SOURCES.txt -> example_module-0.0.0/example_module.egg-info\ncopying example_module.egg-info/dependency_links.txt -> example_module-0.0.0/example_module.egg-info\ncopying example_module.egg-info/entry_points.txt -> example_module-0.0.0/example_module.egg-info\ncopying example_module.egg-info/requires.txt -> example_module-0.0.0/example_module.egg-info\ncopying example_module.egg-info/top_level.txt -> example_module-0.0.0/example_module.egg-info\ncopying example_module.egg-info/SOURCES.txt -> example_module-0.0.0/example_module.egg-info\nWriting example_module-0.0.0/setup.cfg\nCreating tar archive\nremoving 'example_module-0.0.0' (and everything under it)\nrunning bdist_wheel\nrunning build\nrunning build_py\ncopying example_module/example_module.py -> build/lib/example_module\ncopying example_module/__init__.py -> build/lib/example_module\ncopying example_module/setup.py -> build/lib/example_module\ncopying example_module/cli.py -> build/lib/example_module\ninstalling to build/bdist.linux-x86_64/wheel\nrunning install\nrunning install_lib\ncreating build/bdist.linux-x86_64/wheel\ncreating build/bdist.linux-x86_64/wheel/example_module\ncopying build/lib/example_module/example_module.py -> build/bdist.linux-x86_64/wheel/example_module\ncopying build/lib/example_module/__init__.py -> build/bdist.linux-x86_64/wheel/example_module\ncopying build/lib/example_module/setup.py -> build/bdist.linux-x86_64/wheel/example_module\ncopying build/lib/example_module/cli.py -> build/bdist.linux-x86_64/wheel/example_module\nrunning install_egg_info\nCopying example_module.egg-info to build/bdist.linux-x86_64/wheel/example_module-0.0.0-py3.10.egg-info\nrunning install_scripts\ncreating build/bdist.linux-x86_64/wheel/example_module-0.0.0.dist-info/WHEEL\ncreating 'dist/example_module-0.0.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it\nadding 'example_module/__init__.py'\nadding 'example_module/cli.py'\nadding 'example_module/example_module.py'\nadding 'example_module/setup.py'\nadding 'example_module-0.0.0.dist-info/METADATA'\nadding 'example_module-0.0.0.dist-info/WHEEL'\nadding 'example_module-0.0.0.dist-info/entry_points.txt'\nadding 'example_module-0.0.0.dist-info/top_level.txt'\nadding 'example_module-0.0.0.dist-info/RECORD'\nremoving build/bdist.linux-x86_64/wheel\n", stderr='warning: sdist: standard file not found: should have one of README, README.rst, README.txt, README.md\n\n/home/kyriosskia/miniconda3/envs/testenv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.\n!!\n\n        ********************************************************************************\n        Please avoid running ``setup.py`` directly.\n        Instead, use pypa/build, pypa/installer or other\n        standards-based tools.\n\n        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.\n        ********************************************************************************\n\n!!\n  self.initialize_options()\n')



### 16. Making simple MkDocs site

Package documentation can be presented in a form of mkdocs static site, which could be either served or deployed to something like github packages. 

Main module docstring is used as intro package that contains something like optional pypi and license badges. Package description and realease notes are turned into separate tabs. Png with diagrams for example could be provided and displayed as their own separate tabs as well.
 
The one for this package can be seen [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/)

It can be packaged with the package and be displayed in web browser like documentation for api via `<package-name>\docs` when using included api handling capabilities.

---

##### 1. Preparing inputs


```python
package_name = "example_module"

module_content = LongDocHandler().read_module_content(filepath=f"../tests/package_auto_assembler/{package_name}.py")

docstring = LongDocHandler().extract_module_docstring(module_content=module_content)
pypi_link = LongDocHandler().get_pypi_badge(module_name=package_name)


docs_file_paths = {
    "../example_module.md" : "usage-examples.md",
    '../tests/package_auto_assembler/release_notes.md' : 'release_notes.md'
}
```


```python
mdh = MkDocsHandler(
    # required
    ## name of the package to be displayed
    package_name = package_name,
    ## dictionary of markdown files, with path as keys
    docs_file_paths = docs_file_paths,
    # optional
    ## module docstring to be displayed in the index
    module_docstring = docstring,
    ## pypi badge to be displayed in the index
    pypi_badge = pypi_link,
    ## license badge to be displayed in the index
    license_badge="[![License](https://img.shields.io/github/license/Kiril-Mordan/reusables)](https://github.com/Kiril-Mordan/reusables/blob/main/LICENSE)",
    ## name of the project directory
    project_name = "temp_project")
```

##### 2. Preparing site


```python
mdh.create_mkdocs_dir()
mdh.move_files_to_docs()
mdh.generate_markdown_for_images()
mdh.create_index()
mdh.create_mkdocs_yml()
mdh.build_mkdocs_site()
```

    Created new MkDocs dir: temp_project
    Copied ../example_module.md to temp_project/docs/usage-examples.md
    Copied ../tests/package_auto_assembler/release_notes.md to temp_project/docs/release_notes.md
    index.md has been created with site_name: example-module
    mkdocs.yml has been created with site_name: Example module
    Custom CSS created at temp_project/docs/css/extra.css


    INFO    -  Cleaning site directory
    INFO    -  Building documentation to directory: /home/kyriosskia/Documents/nlp/reusables/example_notebooks/temp_project/site
    INFO    -  Documentation built in 0.12 seconds


##### 3. Test-running site


```python
mdh.serve_mkdocs_site()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://kiril-mordan.github.io/reusables/package_auto_assembler/",
    "name": "package-auto-assembler",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python, packaging, aa-paa-tool",
    "author": "Kyrylo Mordan",
    "author_email": "parachute.repo@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/75/d1/9d1ecd93b764d59aba2aa8f89d43d0b0e62f60cb802eb42eaf03f5266a28/package_auto_assembler-0.5.23.tar.gz",
    "platform": null,
    "description": "# Package auto assembler\n\n`package-auto-assembler` is a tool that meant to streamline creation of `single module packages`.\nIts primary goal is to automate as many aspects of python package creation as possible,\nthereby shortening the development cycle of reusable components and maintaining a high standard of quality for reusable code. \n\nWith `package-auto-assembler`, you can simplify the package creation process to the point where it can be seamlessly triggered within CI/CD pipelines, requiring minimal setup and preparation for new modules.\n\n## Key features\n\n- [Set up new Python packaging repositories](https://kiril-mordan.github.io/reusables/package_auto_assembler/python_packaging_repo/) for Github and Azure DevOps.\n- [Create new packages dynamically](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#creating-packages), reducing manual effort.\n- [Check module dependencies](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#checking-dependencies) for vulnerabilities and unexpected licenses.\n- [Run FastAPI and Streamlit apps](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#running-apps-from-packages) directly from packages created with this tool.\n- [Extract artifacts and files](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#extracting-files-from-packages) packaged alongside code.\n- [Show detailed information](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#show-modules-info) about installed packages made with the tool.\n- [Automatically assemble release notes](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#other) based on commit messages.\n- [Extract requirements](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#other) automatically from `.py` files without maintaining separate `requirements.txt`.\n\nThe following includes additional details to how some features of the packages work with examples that involve internal components. Even though using the package this way is very much possible, [cli interface](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools) is recomended. \n\n\n```python\nfrom package_auto_assembler import (VersionHandler, \\\n    ImportMappingHandler, RequirementsHandler, MetadataHandler, \\\n        LocalDependaciesHandler, LongDocHandler, SetupDirHandler, \\\n            ReleaseNotesHandler, MkDocsHandler, PackageAutoAssembler, \\\n                DependenciesAnalyser)\n```\n\n### 1. Package versioning\n\nPackage versioning within paa is done based on semantic versioning.\n\n`major.minor.patch`\n\nBy default, patch is updated, but the minor and major could also be update based on, for example, commit messages or manually from the log file. \n\nPackage auto assembler does try to pull latest version from package storage, but in case of failure uses version logs stored in `.paa/tracking`.\n\n---\n\ninitialize VersionHandler\n\n\n```python\npv = VersionHandler(\n    # required\n    versions_filepath = '../tests/package_auto_assembler/other/lsts_package_versions.yml',\n    log_filepath = '../tests/package_auto_assembler/other/version_logs.csv',\n    # optional\n    default_version = \"0.0.1\")\n```\n\nadd new package\n\n\n```python\npv.add_package(\n    package_name = \"new_package\",\n    # optional\n    version = \"0.0.1\"\n)\n```\n\nupdate package version\n\n\n```python\npv.increment_patch(\n    package_name = \"new_package\"\n)\n## for not tracked package\npv.increment_patch(\n    package_name = \"another_new_package\",\n    # optional\n    default_version = \"0.0.1\"\n)\n```\n\n    There are no known versions of 'another_new_package', 0.0.1 will be used!\n\n\ndisplay current versions and logs\n\n\n```python\npv.get_versions(\n    # optional\n    versions_filepath = '../tests/package_auto_assembler/other/lsts_package_versions.yml'\n)\n```\n\n\n\n\n    {'another_new_package': '0.0.1', 'new_package': '0.0.2'}\n\n\n\n\n```python\npv.get_version(\n    package_name='new_package'\n)\n```\n\n\n\n\n    '0.0.2'\n\n\n\n\n```python\npv.get_logs(\n    # optional\n    log_filepath = '../tests/package_auto_assembler/other/version_logs.csv'\n)\n```\n\n\n\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Timestamp</th>\n      <th>Package</th>\n      <th>Version</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>2024-07-29 03:26:39</td>\n      <td>new_package</td>\n      <td>0.0.1</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>2024-07-29 03:26:40</td>\n      <td>new_package</td>\n      <td>0.0.2</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>2024-07-29 03:26:40</td>\n      <td>another_new_package</td>\n      <td>0.0.1</td>\n    </tr>\n  </tbody>\n</table>\n</div>\n\n\n\nflush versions and logs\n\n\n```python\npv.flush_versions()\npv.flush_logs()\n```\n\nget latest available version with pip\n\n\n```python\npv.get_latest_pip_version(package_name = 'package-auto-assembler')\n```\n\n\n\n\n    '0.3.1'\n\n\n\n### 2. Import mapping\n\nInstall and import names of dependencies may vary. The mapping files maps import names to install names so that requirements extraction from `.py` files is possible. Some of the mapping are packaged and would not need to provided, but in case a dependency used within new package was not inluded, it is possible to augment default mapping through `.paa/package_mapping.json`.\n\n---\n\ninitialize ImportMappingHandler\n\n\n```python\nim = ImportMappingHandler(\n    # required\n    mapping_filepath = \"../env_spec/package_mapping.json\"\n)\n```\n\nload package mappings\n\n\n```python\nim.load_package_mappings(\n    # optional\n    mapping_filepath = \"../env_spec/package_mapping.json\"\n)\n```\n\n\n\n\n    {'PIL': 'Pillow',\n     'bs4': 'beautifulsoup4',\n     'fitz': 'PyMuPDF',\n     'attr': 'attrs',\n     'dotenv': 'python-dotenv',\n     'googleapiclient': 'google-api-python-client',\n     'google_auth_oauthlib': 'google-auth-oauthlib',\n     'sentence_transformers': 'sentence-transformers',\n     'flask': 'Flask',\n     'stdlib_list': 'stdlib-list',\n     'sklearn': 'scikit-learn',\n     'yaml': 'pyyaml',\n     'package_auto_assembler': 'package-auto-assembler',\n     'git': 'gitpython'}\n\n\n\n### 3. Extracting and merging requirements\n\nMaintaining requirements is much simpler, when done automatically based on the `.py` files. \n\nThe actual requirements files is still constructed. Standard libraries are not added, others are added with their versions, if specified. Local files are also used as dependencies, from which imports are extracted as well. \n\nFor example:\n\n```python\nimport os\nimport pandas\nimport attr #>=22.2.0\nfrom .components.local_dep import *\n```\n\nproduces \n\n``` txt\npandas\nattrs >=22.2.0\nyaml\n```\n\nas requirements file, where `yaml` is extracted from `local_dep.py` file.\n\nChecking dependecies for vulnerabilities is usefull and it is done with `pip audit` which is integrated into the paa package and is used by default.\n\nOptional requirements for `extras_require` could be probided the same way normal requirements are, but each like that contains an import like that should be commented out in a special way, starting with `#!`, for example:\n\n```python\nimport os\nimport pandas\nimport attr #>=22.2.0\n#! import hnswlib #==0.8.0\n```\n\nproduces\n\n``` txt\npandas\nattrs >=22.2.0\nhnswlib==0.8.0; extra == \"hnswlib\"\n```\n\nSometimes automatic translation of import names to install names via `package_mapping.json`, for packages where these names differ, may not be enough. A manual overwrite can be done with exlusion of some dependencies from automatic extraction pipeline with `#-` comment next to import and `#@` prefix before text that is intended to end up in an equivalent requirements file, for example:\n\n```python\nimport os\nimport pandas\nimport attr #>=22.2.0\nimport tensorflow #-\n#@ tensorflow-gpu\n```\n\nproduces\n\n\n``` txt\npandas\nattrs >=22.2.0\ntensorflow-gpu\n```\n\n---\n\ninitialize RequirementsHandler\n\n\n```python\nrh = RequirementsHandler(\n    # optional/required later\n    module_filepath = \"../tests/package_auto_assembler/other/example_module.py\",\n    package_mappings = {'PIL': 'Pillow',\n                        'bs4': 'beautifulsoup4',\n                        'fitz': 'PyMuPDF',\n                        'attr': 'attrs',\n                        'dotenv': 'python-dotenv',\n                        'googleapiclient': 'google-api-python-client',\n                        'sentence_transformers': 'sentence-transformers',\n                        'flask': 'Flask',\n                        'stdlib_list': 'stdlib-list',\n                        'sklearn': 'scikit-learn',\n                        'yaml': 'pyyaml'},\n    requirements_output_path = \"../tests/package_auto_assembler/other/\",\n    output_requirements_prefix = \"requirements_\",\n    custom_modules_filepath = \"../tests/package_auto_assembler/dependancies\",\n    python_version = '3.8',\n    add_header = True\n)\n```\n\nlist custom modules for a given directory\n\n\n```python\nrh.list_custom_modules(\n    # optional\n    custom_modules_filepath=\"../tests/package_auto_assembler/dependancies\"\n)\n```\n\n\n\n\n    ['example_local_dependacy_1', 'example_local_dependacy_2']\n\n\n\ncheck if module is a standard python library\n\n\n```python\nrh.is_standard_library(\n    # required\n    module_name = 'example_local_dependacy_1',\n    # optional\n    python_version = '3.8'\n)\n```\n\n\n\n\n    False\n\n\n\n\n```python\nrh.is_standard_library(\n    # required\n    module_name = 'logging',\n    # optional\n    python_version = '3.8'\n)\n```\n\n\n\n\n    True\n\n\n\nextract requirements from the module file\n\n\n```python\nrh.extract_requirements(\n    # optional\n    module_filepath = \"../tests/package_auto_assembler/other/example_module.py\",\n    custom_modules = ['example_local_dependacy_2', 'example_local_dependacy_1'],\n    package_mappings = {'PIL': 'Pillow',\n                        'bs4': 'beautifulsoup4',\n                        'fitz': 'PyMuPDF',\n                        'attr': 'attrs',\n                        'dotenv': 'python-dotenv',\n                        'googleapiclient': 'google-api-python-client',\n                        'sentence_transformers': 'sentence-transformers',\n                        'flask': 'Flask',\n                        'stdlib_list': 'stdlib-list',\n                        'sklearn': 'scikit-learn',\n                        'yaml': 'pyyaml'},\n    python_version = '3.8',\n    add_header=True\n)\n```\n\n\n\n\n    (['attrs>=22.2.0'],\n     ['torch<=2.4.1', 'fastapi[all]', 'scikit-learn==1.5.1', 'numpy'])\n\n\n\n\n```python\nrh.requirements_list\n```\n\n\n\n\n    ['attrs>=22.2.0']\n\n\n\n\n```python\nrh.optional_requirements_list\n```\n\n\n\n\n    ['torch<=2.4.1', 'fastapi[all]', 'scikit-learn==1.5.1', 'numpy']\n\n\n\naudit dependencies\n\n\n```python\nrh.check_vulnerabilities(\n    # optional if ran extract_requirements() before\n    requirements_list = None,\n    raise_error = True\n)\n```\n\n    No known vulnerabilities found\n    \n\n\n    \n\n\n\n```python\nrh.vulnerabilities\n```\n\n\n\n\n    []\n\n\n\n\n```python\ntry:\n    rh.check_vulnerabilities(\n        # optional if ran extract_requirements() before\n        requirements_list = ['attrs>=22.2.0', 'pandas', 'hnswlib==0.7.0'],\n        raise_error = True\n    )\nexcept Exception as e:\n    print(f\"Error: {e}\")\n```\n\n    Found 1 known vulnerability in 1 package\n    \n\n\n    Name    Version ID                  Fix Versions\n    ------- ------- ------------------- ------------\n    hnswlib 0.7.0   GHSA-xwc8-rf6m-xr86\n    \n    Error: Found vulnerabilities, resolve them or ignore check to move forwards!\n\n\n\n```python\nrh.vulnerabilities\n```\n\n\n\n\n    [{'name': 'hnswlib',\n      'version': '0.7.0',\n      'id': 'GHSA-xwc8-rf6m-xr86',\n      'fix_versions': None}]\n\n\n\nsave requirements to a file\n\n\n```python\nrh.write_requirements_file(\n    # optional/required later\n    module_name = 'example_module',\n    requirements = ['### example_module.py', 'attrs>=22.2.0'],\n    output_path = \"../tests/package_auto_assembler/other/\",\n    prefix = \"requirements_\"\n)\n```\n\nread requirements\n\n\n```python\nrh.read_requirements_file(\n    # required\n    requirements_filepath = \"../tests/package_auto_assembler/other/requirements_example_module.txt\"\n)\n```\n\n\n\n\n    ['attrs>=22.2.0']\n\n\n\n### 4. Preparing metadata\n\nSince all of the necessary information for building a package needs to be contained within main component `.py` file, basic metadata is provided with the use of `__package_metadata__` dictionary object, defined within that `.py` file. It is also used as a trigger for package building within paa pipeline. \n\nEven though some general information shared between packages could be provided through general config, but package specific info should be provided through `__package_metadata__`. It should support most text fields from setup file, but for others the following fields are available:\n\n- `classifiers`: adds classifiers to the general ones from config, unless it's `Development Status :: ` then module level definition will overwrite the one from config\n- `extras_require`: a dictionary of optional package that wouldn't be installed during normal installation. The key could be used during installation and the value would be a list of dependencies.\n- `install_requires` : adds requirements to the list read from imports\n\n\\* Note that providing dependencies this way does not check them through pip-audit or translate them through package mapping\n\n---\n\n\ninitializing MetadataHandler\n\n\n```python\nmh = MetadataHandler(\n    # optional/required later\n    module_filepath = \"../tests/package_auto_assembler/other/example_module.py\"\n)\n```\n\ncheck if metadata is available\n\n\n```python\nmh.is_metadata_available(\n    # optional\n    module_filepath = \"../tests/package_auto_assembler/other/example_module.py\"\n)\n```\n\n\n\n\n    True\n\n\n\nextract metadata from module\n\n\n```python\nmh.get_package_metadata(\n    # optional\n    module_filepath = \"../tests/package_auto_assembler/other/example_module.py\"\n)\n```\n\n\n\n\n    {'author': 'Kyrylo Mordan',\n     'author_email': 'parachute.repo@gmail.com',\n     'version': '0.0.1',\n     'description': 'A mock handler for simulating a vector database.',\n     'keywords': ['python', 'vector database', 'similarity search']}\n\n\n\n### 5. Merging local dependacies into single module\n\nPackage auto assembler creates `single module packages`, meaning that once package is built all of the object are imported from a single place. The packaging tool does allow for `local dependecies` which are `.py` files imported from specified dependencies directory and its subfolders. Packaging structure may look like the following:\n\n```\npackaging repo/\n\u2514src/\n  \u251c <package names>.py\n  \u2514 components\n    \u251clocal_dependecy.py\n    \u2514subdir_1\n      \u2514local_dependency_2.py \n```\n\nDuring packaging process paa merges main module with its local dependies into a single file.\n\n---\n\ninitializing LocalDependaciesHandler\n\n\n```python\nldh = LocalDependaciesHandler(\n    # required\n    main_module_filepath = \"../tests/package_auto_assembler/other/example_module.py\",\n    dependencies_dir = \"../tests/package_auto_assembler/dependancies/\",\n    # optional\n    save_filepath = \"./combined_example_module.py\"\n)\n```\n\ncombine main module with dependacies\n\n\n```python\nprint(ldh.combine_modules(\n    # optional\n    main_module_filepath = \"../tests/package_auto_assembler/other/example_module.py\",\n    dependencies_dir = \"../tests/package_auto_assembler/dependancies/\",\n    add_empty_design_choices = False\n)[0:1000])\n```\n\n    \"\"\"\n    Mock Vector Db Handler\n    \n    This class is a mock handler for simulating a vector database, designed primarily for testing and development scenarios.\n    It offers functionalities such as text embedding, hierarchical navigable small world (HNSW) search,\n    and basic data management within a simulated environment resembling a vector database.\n    \"\"\"\n    \n    import logging\n    import json\n    import time\n    import attr #>=22.2.0\n    import sklearn\n    \n    __design_choices__ = {}\n    \n    @attr.s\n    class Shouter:\n    \n        \"\"\"\n        A class for managing and displaying formatted log messages.\n    \n        This class uses the logging module to create and manage a logger\n        for displaying formatted messages. It provides a method to output\n        various types of lines and headers, with customizable message and\n        line lengths.\n        \"\"\"\n    \n        # Formatting settings\n        dotline_length = attr.ib(default=50)\n    \n        # Logger settings\n        logger = attr.ib(default=None)\n        logger_name = attr.ib(default='Shouter')\n        loggerLvl = attr.ib(default=logging.DEBUG)\n        log\n\n\n\n```python\nldh.dependencies_names_list\n```\n\n\n\n\n    ['example_local_dependacy_2', 'example_local_dependacy_1', 'dep_from_bundle_1']\n\n\n\nsave combined module\n\n\n```python\nldh.save_combined_modules(\n    # optional\n    combined_module = ldh.combine_modules(),\n    save_filepath = \"./combined_example_module.py\"\n)\n```\n\n### 6. Prepare README\n\nPackage description is based on `.ipynb` with same name as the `.py`. By default it is converted to markdown as is, but there is also an option to execute it.\n\n---\n\n\n```python\nimport logging\nldh = LongDocHandler(\n    # optional/required later\n    notebook_path = \"../tests/package_auto_assembler/other/example_module.ipynb\",\n    markdown_filepath = \"../example_module.md\",\n    timeout = 600,\n    kernel_name = 'python3',\n    # logger\n    loggerLvl = logging.DEBUG\n)\n```\n\nconvert notebook to md without executing\n\n\n```python\nldh.convert_notebook_to_md(\n    # optional\n    notebook_path = \"../tests/package_auto_assembler/other/example_module.ipynb\",\n    output_path = \"../example_module.md\"\n)\n```\n\n    Converted ../tests/package_auto_assembler/example_module.ipynb to ../example_module.md\n\n\nconvert notebook to md with executing\n\n\n```python\nldh.convert_and_execute_notebook_to_md(\n    # optional\n    notebook_path = \"../tests/package_auto_assembler/other/example_module.ipynb\",\n    output_path = \"../example_module.md\",\n    timeout = 600,\n    kernel_name = 'python3'\n)\n```\n\n    Converted and executed ../tests/package_auto_assembler/example_module.ipynb to ../example_module.md\n\n\nreturn long description\n\n\n```python\nlong_description = ldh.return_long_description(\n    # optional\n    markdown_filepath = \"../example_module.md\"\n)\n```\n\n### 7. Assembling setup directory\n\nPackages are created following rather simple sequence of steps. At some point of the process a temporary directory is created to store the following files:\n\n- `__init__.py` is a simple import from a single module\n- `<package name>.py` is a single module with all of the local dependecies\n- `cli.py` is optional packaged cli tool\n- `routes.py` is optional packaged file with fastapi routes\n- `streamlit.py` is optional packaged streamlit app\n- `setup.py` is a setup file for making a package\n- `README.md` is a package description file based on `.ipynb` file\n- `LICENSE` is optional license file\n- `MANIFEST.in` is a list of additional files to be included with the package\n- `mkdocs` is a folder with built mkdocs site based on optional `extra_docs` for the module, module docstring and `README.md`\n- `artifacts` contains optional files that would be packaged with the module\n- `tests` contains files needed to run tests with [`pytest`](https://docs.pytest.org/en/stable/)\n- `.paa.tracking` contains tracking files from `.paa` dir to make each release of the package independent of PPR that released it\n\n---\n\n\ninitializing SetupDirHandler\n\n\n```python\nsdh = SetupDirHandler(\n    # required\n    module_filepath = \"../tests/package_auto_assembler/other/example_module.py\",\n    # optional/ required\n    module_name = \"example_module\",\n    metadata = {'author': 'Kyrylo Mordan',\n                'version': '0.0.1',\n                'description': 'Example module.',\n                'long_description' : long_description,\n                'keywords': ['python']},\n    license_path = \"../LICENSE\",\n    requirements = ['attrs>=22.2.0'],\n    classifiers = ['Development Status :: 3 - Alpha',\n                   'Intended Audience :: Developers',\n                   'Intended Audience :: Science/Research',\n                   'Programming Language :: Python :: 3',\n                   'Programming Language :: Python :: 3.9',\n                   'Programming Language :: Python :: 3.10',\n                   'Programming Language :: Python :: 3.11',\n                   'License :: OSI Approved :: MIT License',\n                   'Topic :: Scientific/Engineering'],\n    setup_directory = \"./example_setup_dir\"\n)\n```\n\ncreate empty setup dir\n\n\n```python\nsdh.flush_n_make_setup_dir(\n    # optional\n    setup_directory = \"./example_setup_dir\"\n)\n```\n\ncopy module to setup dir\n\n\n```python\nsdh.copy_module_to_setup_dir(\n    # optional\n    module_filepath = \"./combined_example_module.py\",\n    setup_directory = \"./example_setup_dir\"\n)\n```\n\ncopy license to setup dir\n\n\n```python\nsdh.copy_module_to_setup_dir(\n    # optional\n    license_path = \"../LICENSE\",\n    setup_directory = \"./example_setup_dir\"\n)\n```\n\ncreate init file\n\n\n```python\nsdh.create_init_file(\n    # optional\n    module_name = \"example_module\",\n    setup_directory = \"./example_setup_dir\"\n)\n```\n\ncreate setup file\n\n\n```python\nsdh.write_setup_file(\n    # optional\n    module_name = \"example_module\",\n    metadata = {'author': 'Kyrylo Mordan',\n                'version': '0.0.1',\n                'description': 'Example Module',\n                'keywords': ['python']},\n    requirements = ['attrs>=22.2.0'],\n    classifiers = ['Development Status :: 3 - Alpha',\n                   'Intended Audience :: Developers',\n                   'Intended Audience :: Science/Research',\n                   'Programming Language :: Python :: 3',\n                   'Programming Language :: Python :: 3.9',\n                   'Programming Language :: Python :: 3.10',\n                   'Programming Language :: Python :: 3.11',\n                   'License :: OSI Approved :: MIT License',\n                   'Topic :: Scientific/Engineering'],\n    setup_directory = \"./example_setup_dir\"\n)\n```\n\n### 8. Creating release notes from commit messages\n\nPackage versioning could be enhanced with release notes. Since the tool is mainly meant for ci/cd, it takes advantage of commit messages to construct a release note for every version. \n\nCommit history is analysed from the last merge, if nothiong found then the next and the next, until at least one of `[<package name>]` labels are found within commit messages. They are bundled together to for a note, where each commit message or messages deliminated with `;` are turned in a list element. Previos notes are used to establish which part of commit history to use as a starting point.\n\nCommit messages could also be used to increment version by something other then a default patch. \n\n- `[<package name>][..+]` increments patch (default behavior)\n- `[<package name>][.+.]` increments minor\n- `[<package name>][+..]` increments major\n- `[<package name>][0.1.2]` forces specific version `0.1.2`\n\n\\* First release within new packaging repo may struggle to extract release note since commit messages are only analysed from merges in the commit history. \n\n---\n\n\n\n```python\nrnh = ReleaseNotesHandler(\n    # path to existing or new release notes file\n    filepath = '../tests/package_auto_assembler/other/release_notes.md',\n    # name of label in commit message [example_module] for filter\n    label_name = 'example_module',\n    # new version to be used in release notes\n    version = '0.0.1'\n)\n```\n\n    No relevant commit messages found!\n    ..trying depth 2 !\n    No relevant commit messages found!\n    No messages to clean were provided\n\n\noverwritting commit messages from example\n\n\n```python\n# commit messages from last merge\nrnh.commit_messages\n```\n\n\n\n\n    ['fixing paa tests',\n     'fixing paa tests',\n     'fixing paa tests',\n     '[package_auto_assembler] increasing default max search depth for commit history to 5',\n     'fixing mocker-db release notes',\n     'Update package version tracking files',\n     'Update README',\n     'Update requirements']\n\n\n\n\n```python\nexample_commit_messages = [\n    '[example_module] usage example for initial release notes; bugfixes for RNH',\n    '[BUGFIX] missing parameterframe usage example and reduntant png file',\n    '[example_module][0.1.2] initial release notes handler',\n    'Update README',\n    'Update requirements'\n]\nrnh.commit_messages = example_commit_messages\n```\n\ninternal methods that run on intialiazation of ReleaseNotesHandler\n\n\n```python\n# get messages relevant only for label\nrnh._filter_commit_messages_by_package()\nprint(\"Example filtered_messaged:\")\nprint(rnh.filtered_messages)\n\n# clean messages\nrnh._clean_and_split_commit_messages()\nprint(\"Example processed_messages:\")\nprint(rnh.processed_messages)\n```\n\n    Example filtered_messaged:\n    ['[example_module] usage example for initial release notes; bugfixes for RNH', '[example_module][0.1.2] initial release notes handler']\n    Example processed_messages:\n    ['usage example for initial release notes', 'bugfixes for RNH', 'initial release notes handler']\n\n\nget version update from relevant messages\n\n\n```python\nversion_update = rnh.extract_latest_version()\nprint(f\"Example version_update: {version_update}\")\n```\n\n    Example version_update: 0.1.2\n\n\nget latest version from relevant release notes\n\n\n```python\nlatest_version = rnh.extract_latest_version()\nprint(f\"Example latest_version: {latest_version}\")\n```\n\n    Example latest_version: 0.1.2\n\n\naugment existing release note with new entries or create new\n\n\n```python\n# augment existing release note with new entries or create new\nrnh.create_release_note_entry(\n    # optional\n    existing_contents=rnh.existing_contents,\n    version=rnh.version,\n    new_messages=rnh.processed_messages\n)\nprint(\"Example processed_note_entries:\")\nprint(rnh.processed_note_entries)\n```\n\n    Example processed_note_entries:\n    ['# Release notes\\n', '\\n', '### 0.1.2\\n', '\\n', '    - usage example for initial release notes\\n', '\\n', '    - bugfixes for RNH\\n', '\\n', '    - initial release notes handler\\n', '\\n', '### 0.0.1\\n', '\\n', '    - initial version of example_module\\n']\n\n\nsaving updated relese notes\n\n\n```python\nrnh.existing_contents\n```\n\n\n\n\n    ['# Release notes\\n',\n     '\\n',\n     '### 0.1.2\\n',\n     '\\n',\n     '    - usage example for initial release notes\\n',\n     '    - bugfixes for RNH\\n',\n     '    - initial release notes handler\\n',\n     '### 0.1.2\\n',\n     '\\n',\n     '    - usage example for initial release notes\\n',\n     '\\n',\n     '    - bugfixes for RNH\\n',\n     '\\n',\n     '    - initial release notes handler\\n',\n     '\\n',\n     '### 0.0.1\\n',\n     '\\n',\n     '    - initial version of example_module\\n']\n\n\n\n\n```python\nrnh.save_release_notes()\n```\n\n\n```python\n# updated content\nrnh.get_release_notes_content()\n```\n\n\n\n\n    ['# Release notes\\n',\n     '\\n',\n     '### 0.1.2\\n',\n     '\\n',\n     '    - usage example for initial release notes\\n',\n     '\\n',\n     '    - bugfixes for RNH\\n',\n     '\\n',\n     '    - initial release notes handler\\n',\n     '\\n',\n     '### 0.0.1\\n',\n     '\\n',\n     '    - initial version of example_module\\n']\n\n\n\n### 9. Analysing package dependencies\n\nExtracting info from installed dependencies can provide important insight into inner workings of a package and help avoid some of the licenses. \n\nLicenses are extracted from package metadata and normalized for analysis. Missing labels are marked with `-` and not recognized licenses with `unknown`.\n\nInformation about unrecognized license labels could be provided through `.paa/package_licenses json` file that would contain install package name and corresponding license label.\n\n---\n\n\n```python\nda = DependenciesAnalyser(\n    # optional\n    package_name = 'mocker-db',\n    package_licenses_filepath = '../tests/package_auto_assembler/other/package_licenses.json',\n    allowed_licenses = ['mit', 'apache-2.0', 'lgpl-3.0', 'bsd-3-clause', 'bsd-2-clause', '-', 'mpl-2.0']\n)\n```\n\nfinding installed packages with a list of tags\n\n\n```python\nda.filter_packages_by_tags(tags=['aa-paa-tool'])\n```\n\n\n\n\n    [('comparisonframe', '0.0.0'),\n     ('mocker-db', '0.0.1'),\n     ('package-auto-assembler', '0.0.0'),\n     ('proompter', '0.0.0')]\n\n\n\nextracting some metadata from the installed package\n\n\n```python\npackage_metadata = da.get_package_metadata(\n    package_name = 'mocker-db'\n)\npackage_metadata\n```\n\n\n\n\n    {'keywords': ['aa-paa-tool'],\n     'version': '0.0.1',\n     'author': 'Kyrylo Mordan',\n     'author_email': 'parachute.repo@gmail.com',\n     'classifiers': ['Development Status :: 3 - Alpha',\n      'Intended Audience :: Developers',\n      'Intended Audience :: Science/Research',\n      'Programming Language :: Python :: 3',\n      'Programming Language :: Python :: 3.9',\n      'Programming Language :: Python :: 3.10',\n      'Programming Language :: Python :: 3.11',\n      'License :: OSI Approved :: MIT License',\n      'Topic :: Scientific/Engineering',\n      'PAA-Version :: 0.4.3',\n      'PAA-CLI :: False'],\n     'paa_version': '0.4.3',\n     'paa_cli': 'False',\n     'license_label': 'MIT'}\n\n\n\nextracting package requirements\n\n\n```python\npackage_requirements = da.get_package_requirements(\n    package_name = 'mocker-db'\n)\npackage_requirements\n```\n\n\n\n\n    ['requests',\n     'attrs >=22.2.0',\n     'httpx',\n     'hnswlib ==0.8.0',\n     'gridlooper ==0.0.1',\n     'dill ==0.3.7',\n     'numpy ==1.26.0',\n     \"sentence-transformers ; extra == 'sentence_transformers'\"]\n\n\n\nextracting tree of dependencies\n\n\n```python\nextracted_dependencies_tree = da.extract_dependencies_tree(\n    package_name = 'mocker-db'\n)\nextracted_dependencies_tree\n```\n\n\n\n\n    {'requests': {'charset-normalizer': [],\n      'idna': [],\n      'urllib3': [],\n      'certifi': []},\n     'attrs': {'importlib-metadata': {'zipp': [], 'typing-extensions': []}},\n     'httpx': {'anyio': {'idna': [],\n       'sniffio': [],\n       'exceptiongroup': [],\n       'typing-extensions': []},\n      'certifi': [],\n      'httpcore': {'certifi': [], 'h11': {'typing-extensions': []}},\n      'idna': [],\n      'sniffio': []},\n     'hnswlib': {'numpy': []},\n     'gridlooper': {'dill': [],\n      'attrs': {'importlib-metadata': {'zipp': [], 'typing-extensions': []}},\n      'tqdm': {'colorama': []}},\n     'dill': [],\n     'numpy': []}\n\n\n\naddding license labels to tree of dependencies\n\n\n```python\nextracted_dependencies_tree_license = da.add_license_labels_to_dep_tree(\n    dependencies_tree = extracted_dependencies_tree\n)\nextracted_dependencies_tree_license\n```\n\n\n\n\n    {'requests': 'apache-2.0',\n     'requests.charset-normalizer': '-',\n     'requests.idna': '-',\n     'requests.urllib3': '-',\n     'requests.certifi': 'mpl-2.0',\n     'attrs': '-',\n     'attrs.importlib-metadata': '-',\n     'attrs.importlib-metadata.zipp': '-',\n     'attrs.importlib-metadata.typing-extensions': '-',\n     'httpx': '-',\n     'httpx.anyio': 'mit',\n     'httpx.anyio.idna': '-',\n     'httpx.anyio.sniffio': '-',\n     'httpx.anyio.exceptiongroup': '-',\n     'httpx.anyio.typing-extensions': '-',\n     'httpx.certifi': 'mpl-2.0',\n     'httpx.httpcore': '-',\n     'httpx.httpcore.certifi': 'mpl-2.0',\n     'httpx.httpcore.h11': 'mit',\n     'httpx.httpcore.h11.typing-extensions': '-',\n     'httpx.idna': '-',\n     'httpx.sniffio': '-',\n     'hnswlib': '-',\n     'hnswlib.numpy': 'bsd-3-clause',\n     'gridlooper': '-',\n     'gridlooper.dill': 'bsd-3-clause',\n     'gridlooper.attrs': '-',\n     'gridlooper.attrs.importlib-metadata': '-',\n     'gridlooper.attrs.importlib-metadata.zipp': '-',\n     'gridlooper.attrs.importlib-metadata.typing-extensions': '-',\n     'gridlooper.tqdm': '-',\n     'gridlooper.tqdm.colorama': '-',\n     'dill': 'bsd-3-clause',\n     'numpy': 'bsd-3-clause'}\n\n\n\nprinting extracted tree of dependencies\n\n\n```python\nda.print_flattened_tree(extracted_dependencies_tree_license)\n```\n\n    \u2514\u2500\u2500 requests : apache-2.0\n        \u251c\u2500\u2500 charset-normalizer : -\n        \u251c\u2500\u2500 idna : -\n        \u251c\u2500\u2500 urllib3 : -\n        \u2514\u2500\u2500 certifi : mpl-2.0\n    \u2514\u2500\u2500 attrs : -\n        \u2514\u2500\u2500 importlib-metadata : -\n            \u251c\u2500\u2500 zipp : -\n            \u2514\u2500\u2500 typing-extensions : -\n    \u2514\u2500\u2500 httpx : -\n        \u251c\u2500\u2500 anyio : mit\n            \u251c\u2500\u2500 idna : -\n            \u251c\u2500\u2500 sniffio : -\n            \u251c\u2500\u2500 exceptiongroup : -\n            \u2514\u2500\u2500 typing-extensions : -\n        \u251c\u2500\u2500 certifi : mpl-2.0\n        \u251c\u2500\u2500 httpcore : -\n            \u251c\u2500\u2500 certifi : mpl-2.0\n            \u2514\u2500\u2500 h11 : mit\n                \u2514\u2500\u2500 typing-extensions : -\n        \u251c\u2500\u2500 idna : -\n        \u2514\u2500\u2500 sniffio : -\n    \u2514\u2500\u2500 hnswlib : -\n        \u2514\u2500\u2500 numpy : bsd-3-clause\n    \u2514\u2500\u2500 gridlooper : -\n        \u251c\u2500\u2500 dill : bsd-3-clause\n        \u251c\u2500\u2500 attrs : -\n            \u2514\u2500\u2500 importlib-metadata : -\n                \u251c\u2500\u2500 zipp : -\n                \u2514\u2500\u2500 typing-extensions : -\n        \u2514\u2500\u2500 tqdm : -\n            \u2514\u2500\u2500 colorama : -\n    \u2514\u2500\u2500 dill : bsd-3-clause\n    \u2514\u2500\u2500 numpy : bsd-3-clause\n\n\nfiltering for unexpected licenses in tree of dependencies\n\n\n```python\nallowed_licenses = ['mit', 'apache-2.0', 'lgpl-3.0', 'mpl-2.0', '-']\n\nda.find_unexpected_licenses_in_deps_tree(\n    tree_dep_license = extracted_dependencies_tree_license,\n    # optional\n    allowed_licenses = allowed_licenses,\n    raise_error = True\n)\n```\n\n    {'hnswlib': '', 'gridlooper': ''}\n    \u2514\u2500\u2500 dill : bsd-3-clause\n    \u2514\u2500\u2500 numpy : bsd-3-clause\n    \u2514\u2500\u2500 hnswlib : \n        \u2514\u2500\u2500 numpy : bsd-3-clause\n    \u2514\u2500\u2500 gridlooper : \n        \u2514\u2500\u2500 dill : bsd-3-clause\n\n\n\n    ---------------------------------------------------------------------------\n\n    Exception                                 Traceback (most recent call last)\n\n    Cell In[9], line 3\n          1 allowed_licenses = ['mit', 'apache-2.0', 'lgpl-3.0', 'mpl-2.0', '-']\n    ----> 3 da.find_unexpected_licenses_in_deps_tree(\n          4     tree_dep_license = extracted_dependencies_tree_license,\n          5     # optional\n          6     allowed_licenses = allowed_licenses,\n          7     raise_error = True\n          8 )\n\n\n    File ~/miniforge3/envs/testenv/lib/python3.10/site-packages/package_auto_assembler/package_auto_assembler.py:2670, in DependenciesAnalyser.find_unexpected_licenses_in_deps_tree(self, tree_dep_license, allowed_licenses, raise_error)\n       2668 if raise_error and out != {}:\n       2669     self.print_flattened_tree(flattened_dict = out)\n    -> 2670     raise Exception(\"Found unexpected licenses!\")\n       2671 else:\n       2672     self.logger.info(\"No unexpected licenses found\")\n\n\n    Exception: Found unexpected licenses!\n\n\n### 10. Adding cli interfaces\n\nThe tool allows to make a package with optional cli interfaces. These could be sometimes preferable when a package contains a standalone tool that would be called from script anyway.\n\nAll of the cli logic would need to be included within a `.py` file which should be stored within `cli_dir` provided in `.paa.config`. \nDependencies from these files are extracted in the similar manner to the main module.\n\nTools from main `.py` file could still be imported like the following:\n\n```python\nfrom package_name.package_name import ToBeImported\n```\n\nThe code is wired in `setup.py` via the following automatically assuming that appropriate file with the same name as the package exists within `cli_dir` location.\n\n```python\n...,\nentry_points = {'console_scripts': [\n    '<package_alias> = package_name.cli:cli']} ,\n...\n```\n\nAlias for name could be provided via the following piece of code, defined after imports, otherwise package name would be used.\n\n```python \n__cli_metadata__ = {\n    \"name\" : <package_alias>\n}\n```\n\nPackage-auto-assembler tool itself uses [`click`](https://pypi.org/project/click/) dependency to build that file, use its [cli definition](https://github.com/Kiril-Mordan/reusables/blob/main/cli/package_auto_assembler.py) as example.\n\n\n\n### 11. Adding routes and running FastAPI application\n\nThe tool allows to make a package with optional routes for FastAPI application and run them. Each packages can have one routes file where its logic should be defined. Package-auto-assembler itself can combine multiple routes from packages and filepaths into one application.\n\nA `.py`  file with the same name of the package should be stored within `api_routes_dir` provided in `.paa.config`.\n\nDependencies from these files are extracted in the similar manner to the main module.\n\nTools from main `.py` file could still be imported like the following:\n\n```python\nfrom package_name.package_name import ToBeImported\n```\n\nApi description, middleware and run parameters could be provided via optional `.paa.api.config` file, which for example would look like:\n\n```\nDESCRIPTION : {\n    'version' : 0.0.0\n}\nMIDDLEWARE : {\n    allow_origins : ['*']\n}\nRUN : {\n host : 0.0.0.0\n}\n```\n\nwhere DESCRIPTION contains parameters for `FastAPI`, MIDDLEWARE for `CORSMiddleware` and RUN for `uvicorn.run`\n\n\n### 12. Adding ui and running streamlit application\n\nThe tools allows to make a package with optional [`streamlit`](https://streamlit.io/) application as interface to the packaged code.  Each package can have one streamlit file. Package-auto-assembler itself would then be used to run packaged applications from the package. \n\nA `.py`  file with the same name of the package should be stored within `streamlit_dir` provided in `.paa.config`.\n\nDependencies from these files are extracted in the similar manner to the main module.\n\nTools from main `.py` file could still be imported like the following:\n\n```python\nfrom package_name import ToBeImported\n```\n\nConfig file with server, theme and other settings can be provided via optional `.paa.streamlit.config`. \n\n\n### 13 Adding artifacts to packages\n\nThe tool allows to add files to packages that could be accessed from the package or extracted into selected directory.\n\nThere are different types of artifacts with a package like this:\n\n- `.paa.tracking` : includes some tracking files for the purposes of the tool, added to every package\n- `mkdocs` : optional static mkdocs site \n- `artifacts` contains directories, files and links to files copied from `artifacts_dir/<package_name>` (from `.paa.config`)\n- `tests` contains optional directory with tests with `pytest`, copied from `tests_dir/<package_name>` (from `.paa.config`)\n\n##### 1. Description of default tracking files\n\nTracking files are added automatically of artifacts adding was not turned off. At the moment contains:\n\n- `.paa.config` : config file that specifies how paa show work\n- `.paa.version`: version of `package-auto-assembler` that was used for packaging\n- `release_notes.md` : latest release notes for the package\n- `version_logs.csv` : logs for version updates for all packages in the packaging repo\n- `lsts_package_versions.yml` : latests versions of all packages in the packaging repo\n- `package_mapping.json` : additional user-provided remapping of package import names to install names\n- `package_licenses.json` : additional user-provided license labels to overwrite detected ones\n- `notebook.ipynb` : optional jupyter notebook that was used for package description`\n\n##### 2. Adding files\n\nUser provided artifacts could be provided in two ways:\n\n1. adding directory, file or link to the file under `artifacts_dir/<package_name>`\n\n    These files would be packaged with the packages, and files from links would be downloaded and packaged as well. To add a link, create a file with `.link` extension in the name.\n\n2. adding `artifact_urls` dictionary to `__package_metadata__` within module `.py` file\n\nExample of `__package_metadata__` with these additional dictionary would be:\n\n```python\n__package_metadata__ = {\n    ...,\n    \"artifact_urls\" : {\n        'downloaded.md' : 'https://raw.githubusercontent.com/Kiril-Mordan/reusables/refs/heads/main/docs/module_from_raw_file.md',\n        'downloaded.png' : 'https://raw.githubusercontent.com/Kiril-Mordan/reusables/refs/heads/main/docs/reuse_logo.png'\n    }\n}\n```\n\nwhere key would contain name of the artifact and value its link.\n\nThese files would not be downloaded and only links would be packaged. After package installation both kinds of links could be refreshed/donwloaded using [`cli interface`](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli/) from `package-auto-assembler`.\n\n##### 3. Accessing packaged artifacts\n\nArtifacts packaged within the package could be accessed in two ways:\n\n1. using [`package-auto-assembler` cli tools](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli_tools/#extracting-files-from-packages) to copy a file or files into a selected directory\n\n2. reading packaged artifacts from the package, by the use of similar code that finds path to installed package in your system:\n\n```python\nimport importlib\nimport importlib.metadata\nimport importlib.resources as pkg_resources\n\ninstalled_package_path = pkg_resources.files('<package_name>')\n\nfile_name_path = None\nif 'artifacts' in os.listdir(installed_package_path):\n\n    with pkg_resources.path('<package_name>.artifacts', '<file_name>') as path:\n        file_name_path = path\n```\n\n\n### 14. Preparing module for packaging\n\n#### 1. Preparing code for packaging\n\nTo add/edit a python package with `package-auto-assembler`, its building blocks would need to follow requirements mentioned below. \n\n**Note**: For basic package only `main module` would be required. More about role of optional files could be seen [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/python_packaging_repo/#inputs-and-outputs-of-ppr).\n\n- Main module **[required]**\n\n    Main module is considered to be a `<package_name>.py` file stored in `module_dir` (from `.paa.config`), which can also me called `packaging layer`. \n    This is where most code of the package would be, unless `local dependencies` are used. \n\n    Requirements to this file:\n\n    1. starts with module docstring (will be used in package description)\n    2. contains [`__package_metadata__`](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#4-preparing-metadata) (a way to provide package metadata)\n    3. **[optional]** import from `local dependencies` stored only in `dependencies_dir`\n    4. **[optional]** contains [versions of module dependencies](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#3-extracting-and-merging-requirements) (specifying requirements)\n\n\n- Local dependencies\n\n    Local dependencies are optional modules that other modules from `packaging layer` would import from, and are not packaged on their own. These are useful for segmenting codebase into smaller independent components.\n    They would be stored in subdirectory of `module_dir`, specified as `dependencies_dir` in `.paa.config`. \n\n    Requirements for these files:\n\n    1. stored only in `dependencies_dir` or its subdirectories \n    2. do not import any other moduled stored locally\n    3. **[optional]** contain [versions of module dependencies](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#3-extracting-and-merging-requirements) (specifying requirements)\n\n\n- Cli interface\n\n    Command line interface could be optionally defined for a package by placing `<package_name>.py` file into `cli_dir` (from `.paa.config`). More about adding cli could be found [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#10-adding-cli-interfaces).\n\n    Requirements for this file:\n\n    1. imports and uses [`click`](https://pypi.org/project/click/) to define cli tools\n    2. contains [`__cli_metadata__`](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#10-adding-cli-interfaces) (a way to provide alias for cli tools)\n    3. **[optional]** imports from packaging layer and local dependencies only with `from <package_name>.<package_name> import ToBeImported`\n    4. **[optional]** contains [versions of module dependencies](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#3-extracting-and-merging-requirements) (specifying requirements)\n\n\n\n- API routes\n\n    Routes for FastAPI application could be optionally defined for a package by placing `<package_name>.py` file into `api_routes_dir` (from `.paa.config`). More about adding api routes could be found [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#11-adding-routes-and-running-fastapi-application).\n\n    Requirements for this file:\n\n    1. imports `from fastapi import APIRouter`\n    2. defines `router = APIRouter(prefix = \"/<package-name>\")`\n    3. uses `@router.*` to define endpoints\n    4. **[optional]** import from packaging layer and local dependencies only with `from <package_name>.<package_name> import ToBeImported`\n    5. **[optional]** contain [versions of module dependencies](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#3-extracting-and-merging-requirements) (specifying requirements)\n\n\n- Streamlit app\n\n    Streamlit application could be optionally defined for a package by placing `<package_name>.py` file into `streamlit_dir` (from `.paa.config`). More about adding streamlit app could be found [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#12-adding-ui-and-running-streamlit-application).\n\n    Requirements for this file:\n\n    1. imports [`streamlit`](https://pypi.org/project/streamlit/)\n    2. **[optional]** import from packaging layer and local dependencies only with `from <package_name>.<package_name> import ToBeImported`\n    3. **[optional]** contain [versions of module dependencies](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#3-extracting-and-merging-requirements) (specifying requirements)\n\n\n\n#### 2. Preparing documentation for packaging\n\n- Package description\n\n    Providing package description is a useful way to show what the package is about to the intended audience. By default, [`main_module`](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#preparing-code-for-packaging) docstring would be used for this purpose and stored alongside the package in a `README.md` file, as shown [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/python_packaging_repo/#inputs-and-outputs-of-ppr). \n\n    Optionally, one could provide additional information that would be appended to the package docstring via `<package_name>.ipynb` file, placed into `example_notebooks_path` (from `.paa.config`). In the early stages of development, this file could both serve as a place where code is developed/tested before a release and a way to show usage examples.\n\n\n- Additional documentation\n\n    Package description may not be enough to store documentation. \n    A simple [mkdocs](https://www.mkdocs.org/) static site is built by default for every package with for followig tabs:\n\n    - `intro` contains module docstring and `pypi` link for `github + pypi` type of packaging repository\n    - `description` contains optional content from `<package_name>.ipynb` file, placed into `example_notebooks_path` (from `.paa.config`)\n    - `release notes` contains release notes assembled based on commit messages\n\n    Additional documentation can be provided via the following files:\n\n    1. `<package_name>.drawio` file, placed into `drawio_dir` (from `.paa.config`). Each tab would be turned into `<package_name>-<tab_name>.png`, which if not referenced would be presented as a separate tab;\n    2. `.png`, `.ipynb` or `.md` files placed in `extra_docs_dir/<package_name>` (from `.paa.config`). Each file would be turned into a separate tab, but just like `.png` from drawio, if referenced, would not be presented as a separate tab.\n\n    **Note**: During packaging process files derived from `<package_name>.drawio` conversion and files from `extra_docs_dir/<package_name>` would both be placed into `.paa/docs` with `<package_name>-*` prefix. Make sure not to name drawio tabs and extra docs with the same names. \n\n#### 3. Preparing files for packaging\n\nPackaging files alongside code and documentation could be achieved by placing files  into `artifacts_dir/<package_name>` directory (from `.paa.config`). These files could be referenced from within the package and there is an option to provide links instead of physical files. More about adding artifacts to the package could be found [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/description/#13-adding-artifacts-to-packages).\n\nTests that would be used in ci/cd pipeline are expected to be placed into `tests_dir<package_name>` directory (from `.paa.config`). These would be copied into the package as well. \n\n\n\n\n### 15. Making a package\n\nMain wrapper for the package integrates described above components into a class that could be used to build package building pipelines within python scripts. \n\nTo simplify usage [cli interface](https://kiril-mordan.github.io/reusables/package_auto_assembler/cli/) is recomended instead. \n\n---\n\ninitializing PackageAutoAssembler\n\n\n```python\npaa = PackageAutoAssembler(\n    # required\n    module_name = \"example_module\",\n    module_filepath  = \"../tests/package_auto_assembler/other/example_module.py\",\n    # optional\n    mapping_filepath = \"../env_spec/package_mapping.json\",\n    licenses_filepath = \"../tests/package_auto_assembler/other/package_licenses.json\",\n    allowed_licenses = ['mit', 'apache-2.0', 'lgpl-3.0', 'mpl-2.0', '-'],\n    dependencies_dir = \"../tests/package_auto_assembler/dependancies/\",\n    example_notebook_path = \"./mock_vector_database.ipynb\",\n    versions_filepath = '../tests/package_auto_assembler/other/lsts_package_versions.yml',\n    log_filepath = '../tests/package_auto_assembler/other/version_logs.csv',\n    setup_directory = \"./example_module\",\n    release_notes_filepath = \"../tests/package_auto_assembler/other/release_notes.md\",\n    license_path = \"../LICENSE\",\n    license_label = \"mit\",\n    classifiers = ['Development Status :: 3 - Alpha',\n                    'Intended Audience :: Developers',\n                    'Intended Audience :: Science/Research',\n                    'Programming Language :: Python :: 3',\n                    'Programming Language :: Python :: 3.9',\n                    'Programming Language :: Python :: 3.10',\n                    'Programming Language :: Python :: 3.11',\n                    'License :: OSI Approved :: MIT License',\n                    'Topic :: Scientific/Engineering'],\n    requirements_list = [],\n    execute_readme_notebook = True,\n    python_version = \"3.8\",\n    version_increment_type = \"patch\",\n    default_version = \"0.0.1\",\n    check_vulnerabilities = True,\n    check_dependencies_licenses = False,\n    add_requirements_header = True\n)\n```\n\nadd metadata from module\n\n\n```python\npaa.add_metadata_from_module(\n    # optional\n    module_filepath  = \"../tests/package_auto_assembler/other/example_module.py\"\n)\n```\n\n    Adding metadata ...\n\n\nadd or update version\n\n\n```python\npaa.add_or_update_version(\n    # overwrites auto mode (not suggested)\n    version_increment_type = \"patch\",\n    version = \"1.2.6\",\n    # optional\n    module_name = \"example_module\",\n    versions_filepath = '../tests/package_auto_assembler/lsts_package_versions.yml',\n    log_filepath = '../tests/package_auto_assembler/version_logs.csv'\n)\n```\n\n    Incrementing version ...\n    No relevant commit messages found!\n    ..trying depth 2 !\n    No relevant commit messages found!\n    ..trying depth 3 !\n    No relevant commit messages found!\n    ..trying depth 4 !\n    No relevant commit messages found!\n    ..trying depth 5 !\n    No relevant commit messages found!\n    No messages to clean were provided\n\n\nadd release notes from commit messages\n\n\n```python\npaa.add_or_update_release_notes(\n    # optional\n    filepath=\"../tests/package_auto_assembler/release_notes.md\",\n    version=paa.metadata['version']\n)\n```\n\n    Updating release notes ...\n\n\nprepare setup directory\n\n\n```python\npaa.prep_setup_dir()\n```\n\n    Preparing setup directory ...\n\n\nmerge local dependacies\n\n\n```python\npaa.merge_local_dependacies(\n    # optional\n    main_module_filepath = \"../tests/package_auto_assembler/other/example_module.py\",\n    dependencies_dir= \"../tests/package_auto_assembler/dependancies/\",\n    save_filepath = \"./example_module/example_module.py\"\n)\n```\n\n    Merging ../tests/package_auto_assembler/other/example_module.py with dependecies from ../tests/package_auto_assembler/dependancies/ into ./example_module/example_module.py\n\n\nadd requirements from module\n\n\n```python\npaa.add_requirements_from_module(\n    # optional\n    module_filepath = \"../tests/package_auto_assembler/other/example_module.py\",\n    import_mappings = {'PIL': 'Pillow',\n                        'bs4': 'beautifulsoup4',\n                        'fitz': 'PyMuPDF',\n                        'attr': 'attrs',\n                        'dotenv': 'python-dotenv',\n                        'googleapiclient': 'google-api-python-client',\n                        'sentence_transformers': 'sentence-transformers',\n                        'flask': 'Flask',\n                        'stdlib_list': 'stdlib-list',\n                        'sklearn': 'scikit-learn',\n                        'yaml': 'pyyaml',\n                        'git' : 'gitpython'}\n)\n```\n\n    Adding requirements from ../tests/package_auto_assembler/other/example_module.py\n    No known vulnerabilities found\n    \n\n\n    \n\n\n\n```python\npaa.requirements_list\n```\n\n\n\n\n    ['### example_module.py', 'attrs>=22.2.0']\n\n\n\nmake README out of example notebook\n\n\n```python\npaa.add_readme(\n    # optional\n    example_notebook_path = \"../tests/package_auto_assembler/other/example_module.ipynb\",\n    output_path = \"./example_module/README.md\",\n    execute_notebook=False,\n)\n```\n\n    Adding README from ../tests/package_auto_assembler/other/example_module.ipynb to ./example_module/README.md\n\n\nprepare setup file\n\n\n```python\npaa.prep_setup_file(\n    # optional\n    metadata = {'author': 'Kyrylo Mordan',\n                'version': '0.0.1',\n                'description': 'Example module',\n                'keywords': ['python'],\n                'license' : 'mit'},\n    requirements = ['### example_module.py',\n                    'attrs>=22.2.0'],\n    classifiers = ['Development Status :: 3 - Alpha',\n                    'Intended Audience :: Developers',\n                    'Intended Audience :: Science/Research',\n                    'Programming Language :: Python :: 3',\n                    'Programming Language :: Python :: 3.9',\n                    'Programming Language :: Python :: 3.10',\n                    'Programming Language :: Python :: 3.11',\n                    'License :: OSI Approved :: MIT License',\n                    'Topic :: Scientific/Engineering'],\n    cli_module_filepath = \"../tests/package_auto_assembler/other/cli.py\"\n\n)\n```\n\n    Preparing setup file for example-module package ...\n\n\nmake package\n\n\n```python\npaa.make_package(\n    # optional\n    setup_directory = \"./example_module\"\n)\n```\n\n    Making package from ./example_module ...\n\n\n\n\n\n    CompletedProcess(args=['python', './example_module/setup.py', 'sdist', 'bdist_wheel'], returncode=0, stdout=\"running sdist\\nrunning egg_info\\nwriting example_module.egg-info/PKG-INFO\\nwriting dependency_links to example_module.egg-info/dependency_links.txt\\nwriting entry points to example_module.egg-info/entry_points.txt\\nwriting requirements to example_module.egg-info/requires.txt\\nwriting top-level names to example_module.egg-info/top_level.txt\\nreading manifest file 'example_module.egg-info/SOURCES.txt'\\nwriting manifest file 'example_module.egg-info/SOURCES.txt'\\nrunning check\\ncreating example_module-0.0.0\\ncreating example_module-0.0.0/example_module\\ncreating example_module-0.0.0/example_module.egg-info\\ncopying files to example_module-0.0.0...\\ncopying example_module/__init__.py -> example_module-0.0.0/example_module\\ncopying example_module/cli.py -> example_module-0.0.0/example_module\\ncopying example_module/example_module.py -> example_module-0.0.0/example_module\\ncopying example_module/setup.py -> example_module-0.0.0/example_module\\ncopying example_module.egg-info/PKG-INFO -> example_module-0.0.0/example_module.egg-info\\ncopying example_module.egg-info/SOURCES.txt -> example_module-0.0.0/example_module.egg-info\\ncopying example_module.egg-info/dependency_links.txt -> example_module-0.0.0/example_module.egg-info\\ncopying example_module.egg-info/entry_points.txt -> example_module-0.0.0/example_module.egg-info\\ncopying example_module.egg-info/requires.txt -> example_module-0.0.0/example_module.egg-info\\ncopying example_module.egg-info/top_level.txt -> example_module-0.0.0/example_module.egg-info\\ncopying example_module.egg-info/SOURCES.txt -> example_module-0.0.0/example_module.egg-info\\nWriting example_module-0.0.0/setup.cfg\\nCreating tar archive\\nremoving 'example_module-0.0.0' (and everything under it)\\nrunning bdist_wheel\\nrunning build\\nrunning build_py\\ncopying example_module/example_module.py -> build/lib/example_module\\ncopying example_module/__init__.py -> build/lib/example_module\\ncopying example_module/setup.py -> build/lib/example_module\\ncopying example_module/cli.py -> build/lib/example_module\\ninstalling to build/bdist.linux-x86_64/wheel\\nrunning install\\nrunning install_lib\\ncreating build/bdist.linux-x86_64/wheel\\ncreating build/bdist.linux-x86_64/wheel/example_module\\ncopying build/lib/example_module/example_module.py -> build/bdist.linux-x86_64/wheel/example_module\\ncopying build/lib/example_module/__init__.py -> build/bdist.linux-x86_64/wheel/example_module\\ncopying build/lib/example_module/setup.py -> build/bdist.linux-x86_64/wheel/example_module\\ncopying build/lib/example_module/cli.py -> build/bdist.linux-x86_64/wheel/example_module\\nrunning install_egg_info\\nCopying example_module.egg-info to build/bdist.linux-x86_64/wheel/example_module-0.0.0-py3.10.egg-info\\nrunning install_scripts\\ncreating build/bdist.linux-x86_64/wheel/example_module-0.0.0.dist-info/WHEEL\\ncreating 'dist/example_module-0.0.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it\\nadding 'example_module/__init__.py'\\nadding 'example_module/cli.py'\\nadding 'example_module/example_module.py'\\nadding 'example_module/setup.py'\\nadding 'example_module-0.0.0.dist-info/METADATA'\\nadding 'example_module-0.0.0.dist-info/WHEEL'\\nadding 'example_module-0.0.0.dist-info/entry_points.txt'\\nadding 'example_module-0.0.0.dist-info/top_level.txt'\\nadding 'example_module-0.0.0.dist-info/RECORD'\\nremoving build/bdist.linux-x86_64/wheel\\n\", stderr='warning: sdist: standard file not found: should have one of README, README.rst, README.txt, README.md\\n\\n/home/kyriosskia/miniconda3/envs/testenv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.\\n!!\\n\\n        ********************************************************************************\\n        Please avoid running ``setup.py`` directly.\\n        Instead, use pypa/build, pypa/installer or other\\n        standards-based tools.\\n\\n        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.\\n        ********************************************************************************\\n\\n!!\\n  self.initialize_options()\\n')\n\n\n\n### 16. Making simple MkDocs site\n\nPackage documentation can be presented in a form of mkdocs static site, which could be either served or deployed to something like github packages. \n\nMain module docstring is used as intro package that contains something like optional pypi and license badges. Package description and realease notes are turned into separate tabs. Png with diagrams for example could be provided and displayed as their own separate tabs as well.\n \nThe one for this package can be seen [here](https://kiril-mordan.github.io/reusables/package_auto_assembler/)\n\nIt can be packaged with the package and be displayed in web browser like documentation for api via `<package-name>\\docs` when using included api handling capabilities.\n\n---\n\n##### 1. Preparing inputs\n\n\n```python\npackage_name = \"example_module\"\n\nmodule_content = LongDocHandler().read_module_content(filepath=f\"../tests/package_auto_assembler/{package_name}.py\")\n\ndocstring = LongDocHandler().extract_module_docstring(module_content=module_content)\npypi_link = LongDocHandler().get_pypi_badge(module_name=package_name)\n\n\ndocs_file_paths = {\n    \"../example_module.md\" : \"usage-examples.md\",\n    '../tests/package_auto_assembler/release_notes.md' : 'release_notes.md'\n}\n```\n\n\n```python\nmdh = MkDocsHandler(\n    # required\n    ## name of the package to be displayed\n    package_name = package_name,\n    ## dictionary of markdown files, with path as keys\n    docs_file_paths = docs_file_paths,\n    # optional\n    ## module docstring to be displayed in the index\n    module_docstring = docstring,\n    ## pypi badge to be displayed in the index\n    pypi_badge = pypi_link,\n    ## license badge to be displayed in the index\n    license_badge=\"[![License](https://img.shields.io/github/license/Kiril-Mordan/reusables)](https://github.com/Kiril-Mordan/reusables/blob/main/LICENSE)\",\n    ## name of the project directory\n    project_name = \"temp_project\")\n```\n\n##### 2. Preparing site\n\n\n```python\nmdh.create_mkdocs_dir()\nmdh.move_files_to_docs()\nmdh.generate_markdown_for_images()\nmdh.create_index()\nmdh.create_mkdocs_yml()\nmdh.build_mkdocs_site()\n```\n\n    Created new MkDocs dir: temp_project\n    Copied ../example_module.md to temp_project/docs/usage-examples.md\n    Copied ../tests/package_auto_assembler/release_notes.md to temp_project/docs/release_notes.md\n    index.md has been created with site_name: example-module\n    mkdocs.yml has been created with site_name: Example module\n    Custom CSS created at temp_project/docs/css/extra.css\n\n\n    INFO    -  Cleaning site directory\n    INFO    -  Building documentation to directory: /home/kyriosskia/Documents/nlp/reusables/example_notebooks/temp_project/site\n    INFO    -  Documentation built in 0.12 seconds\n\n\n##### 3. Test-running site\n\n\n```python\nmdh.serve_mkdocs_site()\n```\n",
    "bugtrack_url": null,
    "license": "mit",
    "summary": "A tool to automate package creation within ci based on just .py and optionally .ipynb file.",
    "version": "0.5.23",
    "project_urls": {
        "Homepage": "https://kiril-mordan.github.io/reusables/package_auto_assembler/"
    },
    "split_keywords": [
        "python",
        " packaging",
        " aa-paa-tool"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9eb5ec4a28a6ec5a80e4738c82ed7a47ea1d400d03a52c3992a78cb9743319c2",
                "md5": "dd9066be70ab5c2e201b024bb725be14",
                "sha256": "85d39aae9765e33accf2f8174b0d54165ada23e3bf2ad1df0fd16e26b1c3406f"
            },
            "downloads": -1,
            "filename": "package_auto_assembler-0.5.23-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dd9066be70ab5c2e201b024bb725be14",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 2580265,
            "upload_time": "2024-12-21T23:01:18",
            "upload_time_iso_8601": "2024-12-21T23:01:18.664752Z",
            "url": "https://files.pythonhosted.org/packages/9e/b5/ec4a28a6ec5a80e4738c82ed7a47ea1d400d03a52c3992a78cb9743319c2/package_auto_assembler-0.5.23-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75d19d1ecd93b764d59aba2aa8f89d43d0b0e62f60cb802eb42eaf03f5266a28",
                "md5": "c64316650eb1e78429e239ca48ee1bde",
                "sha256": "3ed8872fca0d2ed6746afdfe9d42b54edcddf261387bb23938e8f569ef8260b0"
            },
            "downloads": -1,
            "filename": "package_auto_assembler-0.5.23.tar.gz",
            "has_sig": false,
            "md5_digest": "c64316650eb1e78429e239ca48ee1bde",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2513619,
            "upload_time": "2024-12-21T23:01:21",
            "upload_time_iso_8601": "2024-12-21T23:01:21.808348Z",
            "url": "https://files.pythonhosted.org/packages/75/d1/9d1ecd93b764d59aba2aa8f89d43d0b0e62f60cb802eb42eaf03f5266a28/package_auto_assembler-0.5.23.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-21 23:01:21",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "package-auto-assembler"
}
        
Elapsed time: 8.99858s