Convert Figma logo to code with AI

fengsp logoplan

Crontab jobs management in Python

1,175
98
1,175
5

Top Related Projects

15,334

Asynchronous HTTP client/server framework for asyncio and Python

68,546

The Python micro framework for building web applications.

78,621

FastAPI framework, high performance, easy to learn, fast to code, ready for production

18,206

Accelerate your web app development | Build fast. Run fast.

Quick Overview

The plan project is a Python library that provides a simple and intuitive way to create and manage cron-like schedules. It allows developers to define schedules for tasks or events to be executed at specific intervals or on specific dates.

Pros

  • Simplicity: The library has a straightforward and easy-to-use API, making it accessible for developers of all skill levels.
  • Flexibility: plan supports a wide range of scheduling options, including intervals, specific dates, and complex scheduling patterns.
  • Extensibility: The library can be easily integrated into larger projects and can be extended to fit specific use cases.
  • Cross-platform: plan is designed to work across different platforms, including Windows, macOS, and Linux.

Cons

  • Limited Documentation: The project's documentation could be more comprehensive, making it harder for new users to get started.
  • Lack of Active Maintenance: The project appears to have a low level of active maintenance, with the last commit being over a year ago.
  • Limited Community: The project has a relatively small community, which may limit the availability of support and resources.
  • Potential Compatibility Issues: As the project is not actively maintained, there may be compatibility issues with newer versions of Python or other dependencies.

Code Examples

Here are a few examples of how to use the plan library:

from plan import Plan

# Create a new plan
plan = Plan()

# Schedule a task to run every minute
plan.every(1).minute.do(my_task)

# Schedule a task to run at a specific time
plan.at('10:30').do(another_task)

# Schedule a task to run on a specific date
plan.on('2023-05-01').do(special_task)

In this example, we create a new Plan object and schedule three different tasks: one to run every minute, one to run at 10:30 AM, and one to run on a specific date.

from plan import Plan

# Create a new plan
plan = Plan()

# Schedule a task to run on a specific day of the week
plan.every().monday.at('12:00').do(weekly_task)

# Schedule a task to run on the first of every month
plan.on('1st').of_each.month.do(monthly_task)

# Schedule a task to run on the last day of the month
plan.on('last').of_each.month.do(end_of_month_task)

In this example, we schedule three tasks with more complex scheduling patterns: one to run every Monday at 12:00 PM, one to run on the first of every month, and one to run on the last day of every month.

Getting Started

To get started with the plan library, follow these steps:

  1. Install the library using pip:
pip install plan
  1. Import the Plan class from the plan module:
from plan import Plan
  1. Create a new Plan object and start scheduling tasks:
plan = Plan()
plan.every(1).minute.do(my_task)
plan.at('10:30').do(another_task)
plan.on('2023-05-01').do(special_task)
  1. Run the plan to execute the scheduled tasks:
plan.run()

That's it! You can now use the plan library to create and manage your cron-like schedules in your Python projects.

Competitor Comparisons

15,334

Asynchronous HTTP client/server framework for asyncio and Python

Pros of aiohttp

  • aiohttp is a powerful and feature-rich asynchronous web framework for Python, providing a robust set of tools for building high-performance web applications.
  • It supports a wide range of features, including HTTP client and server, WebSockets, and middleware, making it a versatile choice for a variety of web development tasks.
  • The library is actively maintained and has a large and supportive community, ensuring ongoing development and improvements.

Cons of aiohttp

  • aiohttp has a steeper learning curve compared to Plan, as it requires a deeper understanding of asynchronous programming concepts.
  • The library's extensive feature set can be overkill for simpler web development tasks, where Plan's lightweight and focused approach may be more suitable.
  • The documentation for aiohttp, while comprehensive, can be less beginner-friendly than Plan's straightforward documentation.

Code Comparison

Plan (fengsp/plan):

from plan import Plan

app = Plan()

@app.route('/')
def index():
    return 'Hello, World!'

if __name__ == '__main__':
    app.run()

aiohttp (aio-libs/aiohttp):

import aiohttp
from aiohttp import web

async def handle(request):
    name = request.match_info.get('name', "Anonymous")
    text = "Hello, " + name
    return web.Response(text=text)

app = web.Application()
app.add_routes([web.get('/', handle),
                web.get('/{name}', handle)])

if __name__ == '__main__':
    web.run_app(app)
68,546

The Python micro framework for building web applications.

Pros of Flask

  • Extensive Documentation: Flask has a comprehensive and well-organized documentation, making it easier for developers to get started and find solutions to common problems.
  • Flexibility: Flask is a micro-framework, allowing developers to build applications with only the necessary components, making it more lightweight and flexible than some other web frameworks.
  • Large and Active Community: Flask has a large and active community of developers, providing a wealth of resources, third-party libraries, and support.

Cons of Flask

  • Limited Functionality: As a micro-framework, Flask may not provide as much built-in functionality as some other web frameworks, requiring developers to rely on third-party libraries for certain features.
  • Steeper Learning Curve: Compared to Plan, Flask may have a slightly steeper learning curve, especially for developers new to web development or Python.

Code Comparison

Flask (Pallets/Flask):

from flask import Flask, render_template, request

app = Flask(__name__)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/submit', methods=['POST'])
def submit():
    data = request.form['data']
    # Process the submitted data
    return 'Data submitted successfully'

Plan (fengsp/plan):

from plan import Plan

app = Plan()

@app.route('/')
def index():
    return 'Hello, World!'

@app.route('/submit', methods=['POST'])
def submit():
    data = request.form['data']
    # Process the submitted data
    return 'Data submitted successfully'
78,621

FastAPI framework, high performance, easy to learn, fast to code, ready for production

Pros of FastAPI

  • FastAPI is a modern, fast (high-performance), web framework for building APIs with Python, based on standard Python type hints.
  • FastAPI provides automatic documentation generation using Swagger UI and ReDoc, making it easy to document and share your API.
  • FastAPI has built-in support for asynchronous programming, allowing for efficient handling of concurrent requests.

Cons of FastAPI

  • FastAPI is a relatively new framework, with a smaller community and ecosystem compared to more established options like Flask or Django.
  • The learning curve for FastAPI may be steeper, as it relies heavily on type hints and asynchronous programming concepts.
  • FastAPI may not be as flexible or customizable as some other Python web frameworks, depending on your specific requirements.

Code Comparison

FastAPI:

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_root():
    return {"Hello": "World"}

Plan:

from plan import Plan

app = Plan()

@app.route("/")
def index():
    return "Hello, World!"
18,206

Accelerate your web app development | Build fast. Run fast.

Pros of Sanic

  • Sanic is an asynchronous web framework, which can provide better performance and scalability compared to the synchronous nature of Plan.
  • Sanic has a larger and more active community, with more contributors and a wider range of plugins and extensions available.
  • Sanic provides built-in support for WebSockets, which can be useful for real-time applications.

Cons of Sanic

  • Plan is a more lightweight and minimalist framework, which may be preferred for simpler projects or those with more specific requirements.
  • The documentation for Plan may be more comprehensive and easier to navigate compared to Sanic's documentation.
  • Plan has a smaller and more focused community, which may be a pro or a con depending on your needs.

Code Comparison

Plan (fengsp/plan):

from plan import Plan

app = Plan()

@app.route('/')
def index(request):
    return 'Hello, World!'

if __name__ == '__main__':
    app.run()

Sanic (sanic-org/sanic):

from sanic import Sanic
from sanic.response import text

app = Sanic("MyApp")

@app.route('/')
async def test(request):
    return text('Hello, World!')

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8000)

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Plan

Plan is a Python package for writing and deploying cron jobs.  Plan will 
convert Python code to cron syntax.  You can easily manage your cron jobs
with Plan like a charm.  It is designed for elegancy and writing cron jobs
with as little amount of code as possible.  It's extensible but comes with
serveral good useful job types out of the box.

The purpose is making writing cronfile fun and without causing mistakes.

Plan has following goods:

-   one command to create a quickstart example schedule.py file
-   easy to define your task, every frequency, at moment, running path,
    running bash environment, task output
-   handle communicate with your crontab process with features like write,
    update or clear

Read the docs at http://plan.readthedocs.org/

If you feel anything wrong, feedbacks or pull requests are welcome.

NPM DownloadsLast 30 Days