A feature flipper for Django

Related tags

Testingdjango-waffle
Overview
Comments
  • Added autocreate settings to fix #44

    Added autocreate settings to fix #44

    This patch makes it possible for Waffles to automatically create switches upon usage so you don't have to manually create them.

    This fixes ticket https://github.com/jsocol/django-waffle/issues/44

    opened by wolph 22
  • Django 3 support.

    Django 3 support.

    Closes #354.

    Django 3 "remove[s] private Python 2 compatibility APIs", which is to say it removes a number of utility methods that were either already provided by six or otherwise were used in bridging the old and the new python. This pull request makes django-waffle work with Django 3 by making just 3 changes.

    1. Add six to the requirements.
    2. Replace the result of callingavailable_attrs with functools.WRAPPER_ASSIGNMENTS (cf https://docs.djangoproject.com/en/2.2/_modules/django/utils/decorators/)
    3. Use the python_2_unicode_compatible provided by six rather than the one vendored with django.

    Not sure what the protocol is on bumping the version and amending the changelog; would be happy to do both.

    opened by heydenberk 21
  • Ensure flags, switches, and samples are read from write DB

    Ensure flags, switches, and samples are read from write DB

    In an environment with sufficiently high traffic and DB replication set up, there is a race condition with switches and samples where when an update is immediately followed by a read, the read will get a stale value from the DB replica and cache it.

    This fixes the race condition by ensuring that switches and samples are always read from the write DB.

    opened by dtao 18
  • Django 1.7 compatibility

    Django 1.7 compatibility

    • Export signals handling to models.py
    • Export all settings to one unique file
    • Export keyfmt to utils.py
    • We are not importing models anymore in init.py which can cause in several cases multiple fails from django.apps Registry
    • Refactor unittests using django own DiscoverRunner

    Currently all tests pass except SwitchTests.test_no_query which I'm missing something why we should make on query as we don't cache query from Django itself (we only cache proxies from waffle.__init__.py).

    I'm available if you want more information.

    This PR is currently under development and not available to merge btw.

    opened by thoas 15
  • Fix Django 1.5 User model importing

    Fix Django 1.5 User model importing

    I get a circular import problem in my Django 1.5 app caused by waffle getting the user model incorrectly.

    From the docs:

    When you define a foreign key or many-to-many relations to the User model, you should specify the custom model using the AUTH_USER_MODEL setting.

    waffle.compat.User is used to define a ManyToManyField.

    stale 
    opened by izquierdo 12
  • Cleanup and fix management commands.

    Cleanup and fix management commands.

    • Ensure that new switch is not created unless the --create flag is passed.
    • Add tests to ensure no regression for the --create fix on all commands.
    • Add separate positional arguments for commands (instead of "positionals") to improve the --help documentation.
    opened by villiers-s 11
  • Call for Maintainer Help

    Call for Maintainer Help

    To answer @clintonb's question in #245—perhaps it's already obvious—this project has not been high on my list lately, due to any number of factors (I don't write a lot of Python day-to-day at the moment, weekends have been nice outside lately, others).

    To keep the project alive will need the support of more maintainers. I love to add two or three folks to GitHub and PyPI who

    1. use Waffle in their day jobs / active projects;
    2. have at least opened a PR, even if I haven't merged it;
    3. want to see Waffle improve, hopefully beyond their immediate needs; and
    4. care about making open source a welcoming and inclusive space.

    If you'd like to help out (I suspect a couple of folks from #245, #243, #241, #226 and other recent issues might be willing, but don't want to assume) please comment here or email me, and let me know your PyPI username.

    opened by jsocol 11
  • Add Django 1.10.x test environment and fix broken tests

    Add Django 1.10.x test environment and fix broken tests

    Hi James,

    Just a small one here to get the project's test suite up to current speed.

    Tox now runs the test suite successfully under the latest Django 1.10.x and Python 3.6 environments.

    As part of making the tests run under the new environement, the tests were updated to account for deprecated behaviour in Django. Only thing of note really is that render_to_response was removed in favour of render as render_to_response is 'likely pending deprecation' as of Django 1.10.

    Thanks for all your work on this, we use it extensively at Yunojuno. If the 1.10 stuff could get a release on PyPI that'd be super; if there's anything blocking that just let us know.

    Fixes #224.

    cheers, Darian

    opened by djm 11
  • Spaces in Flag/Switch/Sample's fail when using Memcache

    Spaces in Flag/Switch/Sample's fail when using Memcache

    If you're using Memcache as your cache backend and have a space in your Flag, Switch or Sample name memcache throws and error on saving. MemcachedKeyCharacterError: Control characters not allowed

    This is because with Memcache you can't have spaces in the key.

    opened by silent1mezzo 11
  • Allow to overwrite the template tag's name to avoid conflicts.

    Allow to overwrite the template tag's name to avoid conflicts.

    Avoid conflicts with other tags for example the switch/case template tag.

    This can be done by defining WAFFLE_FLAG_TAG_NAME, WAFFLE_SWITCH_TAG_NAME and/or WAFFLE_SAMPLE_TAG_NAME in the settings.py. This is all optional.

    opened by philippeowagner 10
  • Optionally create missing Flags, Samples and Switches

    Optionally create missing Flags, Samples and Switches

    Flags, Switches and Samples may be scattered throughout templates, backend code or across mulitple frontend clients. This patch provides a user with the option of having waffle create a missing Flag, Sample or Switch when one is requested but does not exist.

    The goal of this change is to save operators time by removing the need to search through code for flag/switch/sample names and to reduce communication requirements accross teams with of multiple developers with multiple environments that might require the creation of a flag/switch/sample in the database of every environment code is run in.

    Behavior Changes

    Old Behavior

    1. Flag/Switch/Sample is requested 2a. If found in db evaulate what the value should be for request 2b. If missing return (FLAG|SWITCH|SAMPLE)_DEFAULT value

    New Behavior

    1. Flag/Switch/Sample is requested 2a. If found in db evaulate what the value should be for request 2b. Create Flag/Switch/Sample with value (FLAG|SWITCH|SAMPLE)_DEFAULT
    2. Return (FLAG|SWITCH|SAMPLE)_DEFAULT for this request, subsequent requests will be served using the value from the cache/db

    Further Discussion

    • #44 (https://github.com/jsocol/django-waffle/issues/44)
    • #50 (https://github.com/jsocol/django-waffle/issues/50)

    Future Work

    This change intentionally narrowly scoped and as such does not provide a mechanism to set a default value other than (FLAG|SWITCH|SAMPLE)_DEFAULT for individual objects that are not in the database although it could be expanded in the future to do so.

    opened by adamhaney 9
  • Consolidate config settings for handling missing entities

    Consolidate config settings for handling missing entities

    The problem

    I ran into an error that occured due to a typo in the name of a waffle flag in my code. It would have been much better (IMO), and the bug would have been picked up much earlier, had flat_is_active failed hard for non-existent flags. Failing silently can be dangerous, and whilst I appreciate I can set WAFFLE_LOG_MISSING_FLAGS to logging.ERROR to increase visibility, this will still not cause a request to fail hard. In development environments, I tend not to pay particular attention to logs unless I'm specifically looking for something. However, a hard failure would pick up the typo before it makes it way to production.

    Is this configuration bloat??

    Obviously, not everyone would want the behaviour I suggest above (quite apart from the fact that it would be a breaking change). As such, an extra configuration setting such as WAFFLE_RAISE_MISSING_FLAGS would be needed. There are currently quite a lot of configuration settings for waffle. For each of FLAG, SWITCH and SAMPLE we have:

    • WAFFLE_*_DEFAULT
    • WAFFLE_CREATE_MISSING_*S
    • WAFFLE_LOG_MISSING_*S

    With this in mind, we probably do not want an extra configuration setting. There are no doubt other behaviours that other uses would wish for in the case of a missing flag, and it's untenable to provide a new setting for each of them.

    A proposed solution

    Instead of introducing a new config setting, I propose that we replace WAFFLE_CREATE_MISSING_*S and WAFFLE_LOG_MISSING_*S with a new setting WAFFLE_HANDLE_MISSING_*S which would be a string that points to a function that would be called when an entity is missing. For example:

    # settings.py
    WAFFLE_HANDLE_MISSING_FLAGS = "some_file.handle_missing_flags"
    
    # some_file.py
    def handle_missing_flags(name):
        # potentially log a message, create a flag and do anything else you want
        # optionally return a flag
    

    (If a flag is returned the flag would be cached, and the value from the flag would be used, otherwise the default value would be used - as is the current behaviour).

    This would have several advantages.

    • The default function would use the existing WAFFLE_CREATE_MISSING_*S and WAFFLE_LOG_MISSING_*S settings so that introducing the setting would result in no change in behaviour.
    • We can then utilise the django checks framework to provide warnings that the old settings will eventually be deprecated, and in time update those warnings to errors. Suitable documentation could also be provided to guide migration to the new system (although this should be reasonably straight-forward). This will mean a pleasant deprecation timeline.
    • This allows users greater flexibility to provide the individual functionality they want.
    • This actually reduces the number of configuration settings whilst protecting against future settings bloat.

    (Part of me would like to subsume WAFFLE_*_DEFAULT into the new setting too, but seeing as the default values are used in WaffleJS this would be difficult.)

    If there is support for this proposition I would be more than happy to submit a PR. I look forward to any feedback on the above.

    opened by tim-mccurrach 0
  • feat: Allow override_flag testutil to set different checks

    feat: Allow override_flag testutil to set different checks

    Up until now, the override_flag test util was only useful to completely activate or deactivate a flag. It didn't allow to provide more customization for all the internal checks it makes, like evaluating if the request user is authenticated or staff.

    This change provides that functionality, without breaking the current API, to avoid breaking changes. Now, users can provide more granular arguments to override_flag, for a more flexible flag testing.

    Closes #439.

    opened by adamantike 0
  • TypeError: is_active() got an unexpected keyword argument 'read_only'

    TypeError: is_active() got an unexpected keyword argument 'read_only'

    I am upgrading from django-waffle==0.19.0 to current django-waffle on Django 3.1. I am getting the above TypeError which seems to be related to the changes made in #447. Are there any hints on how to modify existing code the deal with the read_only change?

    opened by cclauss 1
  • `WAFFLE_SWITCH_MODEL` is missing from the

    `WAFFLE_SWITCH_MODEL` is missing from the "Configuring Waffle" docs page

    The setting WAFFLE_SWITCH_MODEL allows using a custom switch model. It's documented on the Switches page but not on the Configuring Waffle page. For comparison, the equivalent setting for flags, WAFFLE_FLAG_MODEL, is documented on both the Flags and Configuring Waffle pages.

    Perhaps there are other settings missing from the Configuring Waffle page? I haven't checked.

    opened by allanlewis 2
  • Enable pytest support for django waffle

    Enable pytest support for django waffle

    It would be very useful if testing utils such as override_switch and override_flag were available for pytest style classes as class decorators. Is this feature somewhere on the road map?

    opened by rievva-aleksandra 3
  • New view to expose flag state as JSON

    New view to expose flag state as JSON

    Waffle currently has a view to expose flag state as Javascript via the WaffleJS endpoint.

    But there are a number of use cases, e.g. backend API calls, where it would be preferable to expose that state in a serialized format like JSON.

    For use cases like an audit dashboard, the view might also expose metadata such as the total number of active and and inactive flags of each type, and the number of stale flags (i.e. more than X days since last toggled).

    I propose a new backend function that queries the database and returns this data, and a new endpoint that returns the data as JSON.

    opened by shaungallagher 3
Releases(v3.0.0)
  • v3.0.0(Aug 30, 2022)

    What's Changed

    • Update Github actions by @ulgens in https://github.com/django-waffle/django-waffle/pull/459
    • Pluggable Switch and Sample models #456 by @cole-jacobs in https://github.com/django-waffle/django-waffle/pull/457
    • Remove support for EOL Python versions by @ulgens in https://github.com/django-waffle/django-waffle/pull/460
    • Update Django versions by @ulgens in https://github.com/django-waffle/django-waffle/pull/461

    New Contributors

    • @ulgens made their first contribution in https://github.com/django-waffle/django-waffle/pull/459
    • @cole-jacobs made their first contribution in https://github.com/django-waffle/django-waffle/pull/457

    Full Changelog: https://github.com/django-waffle/django-waffle/compare/v2.7.0...v3.0.0

    Source code(tar.gz)
    Source code(zip)
  • v2.7.0(Aug 22, 2022)

    What's Changed

    • Expose JSON endpoint for Waffle flag/switch/sample state by @shaungallagher in https://github.com/django-waffle/django-waffle/pull/452

    Full Changelog: https://github.com/django-waffle/django-waffle/compare/v2.6.0...v2.7.0

    Source code(tar.gz)
    Source code(zip)
  • v2.6.0(Jul 20, 2022)

    What's Changed

    • Fixed Django 4.0 compatibility by @triopter in https://github.com/django-waffle/django-waffle/pull/446
    • Added support for custom Sample and Switch models by @shaungallagher in https://github.com/django-waffle/django-waffle/pull/448
    • Added ability to determine if flag is active without persisting new state by @triopter in https://github.com/django-waffle/django-waffle/pull/447
    • Added support for Python 3.10 by @clintonb in https://github.com/django-waffle/django-waffle/pull/450

    New Contributors

    • @triopter made their first contribution in https://github.com/django-waffle/django-waffle/pull/446
    • @shaungallagher made their first contribution in https://github.com/django-waffle/django-waffle/pull/448

    Full Changelog: https://github.com/django-waffle/django-waffle/compare/v2.5.0...v2.6.0

    Source code(tar.gz)
    Source code(zip)
  • v2.5.0(Jun 5, 2022)

    What's Changed

    • fix wording error by @simonkern in https://github.com/django-waffle/django-waffle/pull/440
    • Add config to support disabling admin pages by default. by @onurhunce-planetly in https://github.com/django-waffle/django-waffle/pull/444

    New Contributors

    • @onurhunce-planetly made their first contribution in https://github.com/django-waffle/django-waffle/pull/444

    Full Changelog: https://github.com/django-waffle/django-waffle/compare/v2.4.1...v2.5.0

    Source code(tar.gz)
    Source code(zip)
  • v2.4.1(Mar 28, 2022)

  • v2.4.0(Mar 28, 2022)

    • Preventing exceptions for template use cases where a request is not available
    • Creating missing flags for all attempts to access the missing flag
    • Added Italian translations
    • Removed universal wheel
    Source code(tar.gz)
    Source code(zip)
  • v2.3.0(Jan 10, 2022)

  • v2.2.1(Jul 13, 2021)

  • v2.2.0(May 21, 2021)

  • v2.1.0(Jan 22, 2021)

  • v2.0.0(Sep 3, 2020)

  • v1.0.0(Jun 22, 2020)

  • v0.20.0(Feb 15, 2020)

  • v0.19.0(Jan 9, 2020)

    • Dropped support for Django 2.0 and 2.1, and Python 3.4
    • Made tests for Jinja2 optional while waiting for django-jinja to be compatible with Django 3.0.
    • Add support for Django 3.0 by removing use of deprecated functionality from Django 2.2.
    Source code(tar.gz)
    Source code(zip)
  • v0.18.0(Nov 3, 2019)

    • Updated MIDDLEWARE setting name for Django 1.10+
    • Improved cache performance for is_active_for_user
    • Corrected log formatting
    • Added log entries for admin quick link actions
    • Added permissions for admin actions
    Source code(tar.gz)
    Source code(zip)
  • v0.17.0(Jul 1, 2019)

  • v0.16.0(Apr 4, 2019)

    • Added support for Django 2.1 and 2.2
    • Flushing cache after modifying flags' groups and users
    • Removed redundant log line
    • Corrected version in waffle/__init__.py
    • Fixed bug in tests
    • Using strings as cache keys instead of bytes
    • Passing effects of test decorator to child classes
      • NOTE: This introduced a backwards-incompatible change for the testutils override decorators. See https://github.com/django-waffle/django-waffle/pull/331 for details.
    Source code(tar.gz)
    Source code(zip)
  • v0.15.1(Jan 9, 2019)

    • Optionally logging missing flags, samples, and switches
    • Added --users option to waffle_flag management command
    • Updated testutils to flush caches
    • Improved admin site for users and groups
    • Fixed global cache thread safety issues
    Source code(tar.gz)
    Source code(zip)
  • v0.15.0(Nov 5, 2018)

    • Dropped support for Django < 1.11
    • Dropped support for Python 3.3
    • Added settings WAFFLE_CREATE_MISSING_(FLAG|SWITCHES|SAMPLES) to optionally create missing objects in the database automatically
    • Allow serializing/de-serializing waffle models by natural key
    • Added pluggable Flag model
    Source code(tar.gz)
    Source code(zip)
  • v0.14.0(Mar 6, 2018)

  • v0.13.0(Jan 24, 2018)

    • Added support for Django 2.0.
    • Added support for search the name and notes fields in Django admin.
    • Fixed small bugs in management commands.
    • Fixed small documentation issues.
    • Updated waffle_flag management command to accept user groups.
    • Added setting WAFFLE_READ_FROM_WRITE_DB to read from write DB on cache miss.
    Source code(tar.gz)
    Source code(zip)
  • v0.12.0a1(May 30, 2016)

    This alpha contains a little more than half of the changes expected to go into 0.12, but it does not contain the settings/API changes from #182.

    Definitely looking for feedback on this version, especially with the caching changes from #211. Those look to significantly simplify how caching works, and will have the most noticeable performance improvements while using wafflejs (see #77, #170).

    To install, you can use pip:

    pip install https://github.com/jsocol/django-waffle/archive/v0.12.0a1.zip
    

    Please file issues and mention this version.

    Source code(tar.gz)
    Source code(zip)
WIP SAT benchmarking tooling, written with only my personal use in mind.

SAT Benchmarking Some early work in progress tooling for running benchmarks and keeping track of the results when working on SAT solvers and related t

Jannis Harder 1 Dec 26, 2021
PyAutoEasy is a extension / wrapper around the famous PyAutoGUI, a cross-platform GUI automation tool to replace your boooring repetitive tasks.

PyAutoEasy PyAutoEasy is a extension / wrapper around the famous PyAutoGUI, a cross-platform GUI automation tool to replace your boooring repetitive t

Dingu Sagar 7 Oct 27, 2022
A Django plugin for pytest.

Welcome to pytest-django! pytest-django allows you to test your Django project/applications with the pytest testing tool. Quick start / tutorial Chang

pytest-dev 1.1k Dec 31, 2022
Pynguin, The PYthoN General UnIt Test geNerator is a test-generation tool for Python

Pynguin, the PYthoN General UnIt test geNerator, is a tool that allows developers to generate unit tests automatically.

Chair of Software Engineering II, Uni Passau 997 Jan 06, 2023
Getting the most out of your hobby servo

ServoProject by Adam Bäckström Getting the most out of your hobby servo Theory The control system of a regular hobby servo looks something like this:

209 Dec 20, 2022
PacketPy is an open-source solution for stress testing network devices using different testing methods

PacketPy About PacketPy is an open-source solution for stress testing network devices using different testing methods. Currently, there are only two c

4 Sep 22, 2022
a wrapper around pytest for executing tests to look for test flakiness and runtime regression

bubblewrap a wrapper around pytest for assessing flakiness and runtime regressions a cs implementations practice project How to Run: First, install de

Anna Nagy 1 Aug 05, 2021
An improbable web debugger through WebSockets

wdb - Web Debugger Description wdb is a full featured web debugger based on a client-server architecture. The wdb server which is responsible of manag

Kozea 1.6k Dec 09, 2022
A Python program that will log into your scheduled Google Meets hands free

Chrome GMautomation General Information This Python program will open up Chrome and log into your scheduled Google Meet with camera and mic turned off

Jonathan Leow 5 Dec 31, 2021
A Library for Working with Sauce Labs

Robotframework - Sauce Labs Plugin This is a plugin for the SeleniumLibrary to help with using Sauce Labs. This library is a plugin extension of the S

joshin4colours 6 Oct 12, 2021
A Simple Unit Test Matcher Library for Python 3

pychoir - Python Test Matchers for humans Super duper low cognitive overhead matching for Python developers reading or writing tests. Implemented in p

Antti Kajander 15 Sep 14, 2022
pytest plugin for manipulating test data directories and files

pytest-datadir pytest plugin for manipulating test data directories and files. Usage pytest-datadir will look up for a directory with the name of your

Gabriel Reis 191 Dec 21, 2022
A pytest plugin to skip `@pytest.mark.slow` tests by default.

pytest-skip-slow A pytest plugin to skip @pytest.mark.slow tests by default. Include the slow tests with --slow. Installation $ pip install pytest-ski

Brian Okken 19 Jan 04, 2023
Automates hiketop+ crystal earning using python and appium

hikepy Works on poco x3 idk about your device deponds on resolution Prerquests Android sdk java adb Setup Go to https://appium.io/ Download and instal

4 Aug 26, 2022
Repository for JIDA SNP Browser Web Application: Local Deployment

JIDA JIDA is a web application that retrieves SNP information for a genomic region of interest in Homo sapiens and calculates specific summary statist

3 Mar 03, 2022
Akulaku Create NewProduct Automation using Selenium Python

Akulaku-Create-NewProduct-Automation Akulaku Create NewProduct Automation using Selenium Python Usage: 1. Install Python 3.9 2. Open CMD on Bot Folde

Rahul Joshua Damanik 1 Nov 22, 2021
Find index entries in $INDEX_ALLOCATION attributes

INDXRipper Find index entries in $INDEX_ALLOCATION attributes Timeline created using mactime.pl on the combined output of INDXRipper and fls. See: sle

32 Nov 05, 2022
This project demonstrates selenium's ability to extract files from a website.

This project demonstrates selenium's ability to extract files from a website. I've added the challenge of connecting over TOR. This package also includes a personal archive site built in NodeJS and A

2 Jan 16, 2022
Connexion-faker - Auto-generate mocks from your Connexion API using OpenAPI

Connexion Faker Get Started Install With poetry: poetry add connexion-faker # a

Erle Carrara 6 Dec 19, 2022
pytest_pyramid provides basic fixtures for testing pyramid applications with pytest test suite

pytest_pyramid pytest_pyramid provides basic fixtures for testing pyramid applications with pytest test suite. By default, pytest_pyramid will create

Grzegorz Śliwiński 12 Dec 04, 2022