Skip to main content

APPN Phenomate Project Manager

Project description

APPN Phenomate Project Manager

A Python package for managing project templates, metadata, and file organization using flexible YAML schemas. Designed for research and data projects that require consistent file naming, metadata, and directory structures.

Install

pip install appm

Features

  • Template-driven project structure: Define project layouts, file naming conventions, and metadata in YAML.
  • Automatic project initialization: Create new projects with standardized folders and metadata files.
  • File placement and matching: Automatically determine where files belong based on their names and template rules.
  • Extensible and validated: Uses Pydantic for schema validation and ruamel.yaml for YAML parsing. Installation Or for development:

Usage

  1. Define a Template

Create a YAML template describing your project's structure, naming conventions, and file formats. See examples/template.yaml for the default template.

  1. Initialize a Project
from appm import ProjectManager

pm = ProjectManager.from_template(
    root="projects",
    year=2024,
    summary="Wheat yield trial",
    internal=True,
    researcherName="Jane Doe",
    organisationName="Plant Research Org",
    template="examples/template.yaml"
)
pm.init_project()
  1. Add Files

Files are automatically placed in the correct directory based on the template used.

An example template file:

version: 0.0.8
naming_convention:
  sep: "_"
  structure: ['year', 'summary', 'internal', 'researcherName', 'organisationName']
layout:
  structure: ['sensor', 'date', 'trial', 'procLevel']
  mapping:
    procLevel:
      raw: 'T0-raw'
      proc: 'T1-proc'
      trait: 'T2-trait'
file:
  "*":
    sep: "_"
    default:
      procLevel: raw
    components:
      - sep: "_"
        components:
          - ['date', '\d{4}-\d{2}-\d{2}']
          - ['time', '\d{2}-\d{2}-\d{2}']
      - ['ms', '\d{6}']
      - ['dateshort', '\d{4}']
      - ['trial', '[^_.]+']
      - ['sensor', '[^_.]+']
      - name: 'procLevel'
        pattern: 'T0-raw|T1-proc|T2-trait|raw|proc|trait'
        required: false

Using an input file named: 2025-08-14_06-30-03_393242_0814_test2_jai1_0.bin the above template will output files to the following directory:

jai1/2025-08-14/test2/T0-raw

as per the layout format specified in the file:

structure: ['sensor', 'date', 'trial', 'procLevel']

and the file(s) will have the name:

2025-08-14_06-30-03_393242_0814_test2_jai1_0_preproc-0.jpeg

Programmatically this is done using the following method:

pm.copy_file("data/20240601-120000_SiteA_SensorX_Trial1_T0-raw.csv")

Project Updating version numbers

Version numbers follow the standard pattern of: MAJOR.MINOR.PATCH and the project has been configured to use the Python libray bump-my-version to help automate the change of version numbers that are used in the files within the project.

The following proceedures outline its use:

Make sure mump-my-version is installed

uv pip install  bump-my-version
# add to pyproject.toml 
uv add --dev bump-my-version

This tool uses the file .bumpmyversion.toml for configuring what files get modified.

N.B. If files are added to the project that use an explicit version number, then add the files to .bumpmyversion.toml along with the rules.

Use the tool as follows:

  1. set the current version in .bumpmyversion.toml e.g.
current_version = "0.1.1"

Set the bumpwhat value and run the bump-my-version command:

# uv run bump-my-version -h

export bumpwhat=major | minor | patch
uv run bump-my-version bump $bumpwhat

N.B. For YAML files used in testing, it is easier to modify them using sed

# Check the current version:
find ./tests/fixtures -type f \( -name "*.yaml" -o -name "*.yml" \) -exec grep "version" {} +

# set FINDVERSION to be the version number found in files above:
export FINDVERSION=0.0.10
#  set the replacement string:
export REPVERSION=0.1.0
find ./tests/fixtures -type f \( -name "*.yaml" -o -name "*.yml" \) -exec sed -i -e "s/$FINDVERSION/$REPVERSION/g" {} +

Project Structure

  • appm – Core package (template parsing, project management, utilities)
  • examples – Example YAML templates
  • schema – JSON schema for template validation
  • tests – Unit tests and fixtures

Development

  • Python 3.11+
  • Pydantic
  • ruamel.yaml
  • pytest for testing

Run tests:

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

appm-0.1.1.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

appm-0.1.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file appm-0.1.1.tar.gz.

File metadata

  • Download URL: appm-0.1.1.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for appm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 42a069d914dccd3c5cbe2999c1ffd89b3c8340259591964b6c372eb9c7bb90b0
MD5 147b076d5d21afe315410796a0055ceb
BLAKE2b-256 25b2d404200ec32ea5e4fecb8cfab259985ee0c21c6ce6bcd8a986d27c56004d

See more details on using hashes here.

File details

Details for the file appm-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: appm-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for appm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 af46964c750f8ba195f4591866e1c6f9d089c18f0d9e82ad3d9812eb35f8e3ec
MD5 898eb8d3786ad599170bd479ae54db6c
BLAKE2b-256 c0bc9f2ca905047f231bcb6000f6e48c77b4fe04af5112bc3bf941d02f5a031c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page