Skip to main content

A tool library created by jaanca that allows measuring the time between two moments in the source code.

Project description

What libraries

  • Python library: A tool library created by jaanca that allows measuring the time between two moments in the source code.
  • Analyze results in database: The output format can be inserted in an INTERVAL attribute for example in PostgreSQL and add the time of several processes.

library installation

pip install jaanca-chronometer --upgrade

Example of use

from jaanca_chronometer import Chronometer
import time

if __name__=="__main__":
    chronometer=Chronometer()

    chronometer.start()
    time.sleep(1)
    chronometer.stop()
    elapsed_time=str(chronometer.get_elapsed_time())
    print(elapsed_time)

Example of inserting elapsed time into PostgreSQL and totaling the results

CREATE TABLE process_execution (
    id SERIAL PRIMARY KEY,
    description VARCHAR(100),
    time INTERVAL
);

INSERT INTO process_execution (description,time) VALUES ('process_simulator','01:30:00'::interval);
INSERT INTO process_execution (description,time) VALUES ('process_simulator','02:15:00'::interval);
INSERT INTO process_execution (description,time) VALUES ('process_simulator','00:45:00'::interval);
INSERT INTO process_execution (description,time) VALUES ('process_simulator','99:45:00'::interval);

SELECT SUM(time) FROM process_execution WHERE description = 'process_simulator';

-- Result:104:15:00

Semantic Versioning

logyca < MAJOR >.< MINOR >.< PATCH >

  • MAJOR: version when you make incompatible API changes
  • MINOR: version when you add functionality in a backwards compatible manner
  • PATCH: version when you make backwards compatible bug fixes

Definitions for releasing versions

  • https://peps.python.org/pep-0440/

    • X.YaN (Alpha release): Identify and fix early-stage bugs. Not suitable for production use.
    • X.YbN (Beta release): Stabilize and refine features. Address reported bugs. Prepare for official release.
    • X.YrcN (Release candidate): Final version before official release. Assumes all major features are complete and stable. Recommended for testing in non-critical environments.
    • X.Y (Final release/Stable/Production): Completed, stable version ready for use in production. Full release for public use.

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Types of changes

  • Added for new features.
  • Changed for changes in existing functionality.
  • Deprecated for soon-to-be removed features.
  • Removed for now removed features.
  • Fixed for any bug fixes.
  • Security in case of vulnerabilities.

[0.0.1rcX] - 2024-05-21

Added

  • First tests using pypi.org in develop environment.
  • Examples of use are added to the documentation of the functions in docstring
  • In the samples folder of this library, there are complete working examples of using the code.

[0.1.0] - 2024-05-21

Added

  • Completion of testing and launch into production.

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

jaanca_chronometer-0.0.1rc3.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

jaanca_chronometer-0.0.1rc3-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

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