Skip to content

iosan/pythondev

Repository files navigation

pythondev

A Python project for parsing, unifying, and comparing timestamps found in various formats, including as substrings in filenames. It includes utilities for finding files with timestamp patterns in subfolders, extracting timestamps, and matching files by unified timestamps.

Features

  • Parses timestamps from strings, numbers, and filenames.
  • Supports formats like ISO, RFC, Unix epoch, YYYY_MM_DD_HH_MM_SS, and DD_MM_YYYY_HH_MM_SS.
  • Recursively finds files with timestamp substrings in subfolders of a base folder.
  • Matches files with identical timestamps across different subfolders.
  • Provides a command-line script for demonstration and testing.
  • Includes unit tests and dummy data generation.

Usage

Create Dummy Files

To generate dummy files for testing, run:

make create-dummy

Run the Parser

To run the parser and see timestamp extraction and matching:

make run

Run Tests

To run all tests (including those using dummy files):

make test

Clean Up

To remove cache and all subfolders/files from the data folder except the dummy file generator:

make clean

All-in-one

To create dummy files, run the parser, test, and clean up:

make all

Project Structure

pythondev/
├── data/
│   ├── create_dummy_files.py
│   └── ... (generated dummy files and subfolders)
├── src/
│   ├── date_parser.py
│   └── formatter.py
├── tests/
│   └── test_date_parser.py
├── Makefile
├── requirements.txt
├── .pre-commit-config.yaml
└── README.md

Development

  • Code formatting and linting are handled by Black and Flake8 via pre-commit hooks.
  • Dummy files are automatically created before running or testing.
  • All timestamp logic is in src/date_parser.py.
  • Tests are in tests/test_date_parser.py.

Dependencies

Install dependencies with uv:

uv pip install -r requirements.txt

Or with pip:

pip install -r requirements.txt

License

This project is open source and free to use.

About

A Python3 Example Project with Tests, Makefile and CleanCode Components

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published