Coder Social home page Coder Social logo

abeltavares / pysertive Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 101 KB

✔️ Assertive python design by contract toolkit for software validation. Simplify preconditions, postconditions, and invariants with easy-to-use decorators.

License: MIT License

Python 100.00%
dbc design-by-contract postconditions preconditions python assertions code-maintainability error-checking pypi-package python-decorators

pysertive's Introduction

Hey 👋🏽

I'm an Engineer, really into coding and making technology work for business.

What I Do

  • 🔍 I analyze data, integrate systems, manage big data, and build software.
  • 💻 I'm all about Python, SQL, and a bunch of data software tools.
  • 🌐 Committed to automation, innovation and global collaboration.

Curious about my journey? 🧭

Peek into my personal page for the story.

Build, Blog and Learn 🔨

Dive into Insights, technical guides, and my experiences with technology on Abels's Blog.

Stay Connected


'Code is like humor. When you have to explain it, it’s bad.' – Cory House

'In God we trust; all others bring data.' – W. Edwards Deming


Dream big, work hard, stay focused

pysertive's People

Contributors

abeltavares avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

pysertive's Issues

Implement Global Configuration for Pysertive

Description

Introduce a global configuration system to enable or disable contract checks across the entire application. This will facilitate different environments like development, testing, and production.

Suggested Implementation

Create a Config class with attributes to control the enforcement of preconditions, postconditions, and invariants. Update decorators to respect the global configuration settings.

Acceptance Criteria

  • Config class is created with appropriate attributes.
  • Decorators are updated to respect global configuration settings.
  • Unit tests are written to ensure global configuration works as expected.

Add Type Hints to Core Decorator Functions

Description

Enhance the existing core decorator functions (pre_condition, post_condition, and invariant) by adding type hints to their parameters and return types. This will improve code clarity and facilitate static type checking with tools like MyPy.

Suggested Implementation

Add type hints to the parameters and return types of the core decorator functions. Ensure that type hints cover all parameters, including check, exception_type, and message.

Acceptance Criteria

  • Type hints are added to all core decorator functions.
  • Type hints cover all parameters and return types.
  • Unit tests are written to ensure the type hints are correct.

Improve Documentation and Provide Detailed Examples

Description

Improve the documentation with more detailed examples, covering edge cases and advanced usage scenarios. Deploy the documentation on a GitHub Page for easy access.

Suggested Implementation

Document each decorator with descriptions and usage examples. Include advanced cases and edge cases in the documentation. Set up GitHub Pages to host the documentation.

Acceptance Criteria

  • Documentation includes detailed descriptions and usage examples for each decorator.
  • Advanced cases and edge cases are covered in the documentation.
  • Documentation is deployed on GitHub Pages.

Create an `@assert_types` Decorator for Pysertive

Description

Extend Pysertive to work seamlessly with MyPy, ensuring that contract checks also consider type hints. This will enhance type safety and static analysis.

Suggested Implementation

Create a new decorator @assert_types that validates type hints for function arguments and return values.

Acceptance Criteria

  • @assert_types decorator is created to enforce type hints.
  • @assert_types works alongside existing decorators.
  • Unit tests are written to ensure type hinting works as expected.

Add Support for Async Functions in Decorators

Description

Extend pre_condition, post_condition, and invariant decorators to support asynchronous functions. This will make Pysertive suitable for modern Python applications using async/await.

Suggested Implementation

Update the decorators to handle async def functions. Ensure that the conditions are checked correctly in an asynchronous context.

Acceptance Criteria

  • pre_condition, post_condition, and invariant decorators support asynchronous functions.
  • Conditions are checked correctly for async functions.
  • Unit tests are written to ensure the async support works as expected.

Add Multi-condition Support for Decorators

Description

We need to extend the existing pre_condition, post_condition, and invariant decorators to support multiple conditions. This will provide a more flexible and powerful way to enforce rules.

Suggested Implementation

Modify the decorators to accept multiple conditions as a list or tuple and validate all of them. If any condition fails, the decorator should raise an exception.

Acceptance Criteria

  • pre_condition, post_condition, and invariant decorators can accept and handle multiple conditions.
  • Exceptions are raised when any of the conditions fail.
  • Unit tests are written to ensure the multi-condition support works as expected.

Optimize Performance of Contract Checks

Description

Implement lazy evaluations and selective enforcement to optimize the performance of contract checks. This will balance between performance and safety.

Suggested Implementation

Introduce lazy evaluations to check conditions only when necessary. Allow users to selectively enable or disable specific contract checks.

Acceptance Criteria

  • Lazy evaluations are implemented for contract checks.
  • Users can selectively enable or disable specific contract checks.
  • Unit tests are written to ensure performance optimizations work as expected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.