Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A reliable distributed scheduler with pluggable storage backends for Async Python.
Minimal installation (just SQLite persistence):
::
pip install pyncette
Full installation (all the backends and Prometheus metrics exporter):
::
pip install pyncette[all]
You can also install the in-development version with::
pip install https://github.com/tibordp/pyncette/archive/master.zip
https://pyncette.readthedocs.io
Simple in-memory scheduler (does not persist state)
.. code:: python
from pyncette import Pyncette, Context
app = Pyncette()
@app.task(schedule='* * * * *')
async def foo(context: Context):
print('This will run every minute')
if __name__ == '__main__':
app.main()
Persistent distributed cron using Redis (coordinates execution with parallel instances and survives restarts)
.. code:: python
from pyncette import Pyncette, Context
from pyncette.redis import redis_repository
app = Pyncette(repository_factory=redis_repository, redis_url='redis://localhost')
@app.task(schedule='* * * * * */10')
async def foo(context: Context):
print('This will run every 10 seconds')
if __name__ == '__main__':
app.main()
See the examples
directory for more examples of usage.
Pyncette is designed for reliable (at-least-once or at-most-once) execution of recurring tasks (think cronjobs) whose lifecycles are managed dynamically, but can work effectively for non-reccuring tasks too.
Example use cases:
Pyncette might not be a good fit if:
Pyncette comes with an implementation for the following backends (used for persistence and coordination) out-of-the-box:
pip install pyncette[redis]
)pip install pyncette[postgres]
)pip install pyncette[mysql]
)pip install pyncette[dynamodb]
)Pyncette imposes few requirements on the underlying datastores, so it can be extended to support other databases or custom storage formats / integrations with existing systems. For best results, the backend needs to provide:
To run integration tests you will need Redis, PostgreSQL, MySQL and Localstack (for DynamoDB) running locally.
To run the all tests run::
tox
Alternatively, there is a Docker Compose environment that will set up all the backends so that integration tests can run seamlessly::
docker-compose up -d
docker-compose run --rm shell
tox
To run just the unit tests (excluding integration tests)::
tox -e py310 # or your Python version of choice
Note, to combine the coverage data from all the tox environments run:
.. list-table:: :widths: 10 90 :stub-columns: 1
- - Windows
- ::
set PYTEST_ADDOPTS=--cov-append
tox
- - Other
- ::
PYTEST_ADDOPTS=--cov-append tox
add_to_context()
to inject static data to contextInMemoryRepository
)poll_interval
before next tick instead of the full amountcontext.args['name']
instead of context.name
FAQs
A reliable distributed scheduler with pluggable storage backends
We found that pyncette demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.