Skip to main content

Codi Cooperatiu internal tools

Project description

codi-cooperatiu-internal-tools

Internal tools and modules of Codi Cooperatiu

flowbite_css

flowbite_css automatically applies form customizations. These customizations use Flowbite styles, a customization of Tailwind.

Configuration

To use these customizations, you need to add the flowbite_css app to the INSTALLED_APPS parameter in the settings.py file.

CODI_COOP_ENABLE_MONKEY_PATCH

The CODI_COOP_ENABLE_MONKEY_PATCH parameter in the settings.py file controls whether a monkey patch is applied to Django's form fields within your application.

By default, the CODI_COOP_ENABLE_MONKEY_PATCH parameter is disabled (False). This means the monkey patch will not be applied. If you want to enable the monkey patch, you need to add the CODI_COOP_ENABLE_MONKEY_PATCH parameter to the settings.py file and set it to True.

Examples:

Enable monkey patching:

# settings.py

CODI_COOP_ENABLE_MONKEY_PATCH = True

When this parameter is enabled (True), Django form fields such as CharField, EmailField, IntegerField, ChoiceField, MultipleChoiceField, and BooleanField will use the custom fields defined in your application (CharBoundField, BooleanBoundField, etc.), enabling custom styling and behavior in your forms.

Disable monkey patching:

# settings.py

CODI_COOP_ENABLE_MONKEY_PATCH = False  # Default value

If this parameter is disabled (False), Django's form fields will work with their default behavior and styling, without additional customizations.

FORM_RENDERER

You can also use a custom template to render all the HTML associated with the fields (<label /> and any other HTML) with Flowbite classes. In this case, you need to use the CustomFormRenderer form renderer by configuring the FORM_RENDERER parameter in the settings.py file:

# settings.py

FORM_RENDERER = "flowbite_css.renderers.CustomFormRenderer"

Contribution

Install Requirements

Make sure you are using python >3.10.

Install the development dependencies by navigating to the "codi-cooperatiu-internal-tools" folder and running:

pip install -r requirements.txt

In addition to these requirements, you also need to install Django. To install the current version of Django:

pip install django

The code comes with git hook scripts. These can be installed by running:

pre-commit install

The pre-commit hook will now run automatically when making a git commit, checking adherence to the style guide (black, isort, and flake8).

Run Tests

Before submitting a pull request, run the full test suite of "codi-cooperatiu-internal-tools" using:

make test

If you do not have make installed, the test suite can also be executed using:

pytest --ds=tests.test_settings --cov=flowbite_classes

Run linting, formatting and tests using tox

Install tox in a isolated environment, for exampel if you use pip, run:

python -m pip install --user tox

Then you can run it with:

python -m tox

One of the tox commands is the linter, you can run it alone with:

python -m tox -e lint

Note that tox is meant to be run in the github action that will provide different python versions, but if you run it like that it will only run in the version that you have in your environment.

Publishing a New Version to PyPI

To release a new version of the library to PyPI, follow these steps:

  1. Prepare a Release Branch:

    • Ensure all changes are merged into the master branch.
    • Create a new branch named after the release version (e.g., v1.2.3).
    • Update the version field in the project section of the pyproject.toml file to the new release version.
    • Commit the changes with a message like Version <release-version>.
    • Push the branch to the remote repository and create a pull request titled Version <release-version>.
  2. Tag the Release:

    • Once the pull request has been reviewed and merged, create a Git tag for the release. Use the following command:
      git tag -a <release-version> <commit> -m "Release <release-version>"
      
      Replace <release-version> with the version number (e.g., v1.2.3) and <commit> with the commit hash of the merged pull request.
    • Push the tag to the remote repository:
      git push origin <release-version>
      
  3. Create a GitHub Release:

    • Open the GitHub Releases page.
    • Click "Draft a new release."
    • In the Tag version field, select the previously pushed tag <release-version>.
    • Use <release-version> as the release title.
    • In the description, list the changes introduced in this release compared to the previous version.
    • Click "Publish release."
  4. Automatic Deployment:

    • Once the release is published, GitHub Actions will automatically trigger the deployment process and publish the new version of the library to PyPI, as configured in the repository.

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

codi_cooperatiu_internal_tools-0.2.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codi_cooperatiu_internal_tools-0.2-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file codi_cooperatiu_internal_tools-0.2.tar.gz.

File metadata

File hashes

Hashes for codi_cooperatiu_internal_tools-0.2.tar.gz
Algorithm Hash digest
SHA256 44be362b5604a98e98fc3fed182d36eaa72f5becff2c079d3f8c6fc85ab81b32
MD5 ff634020bcb581fb8d2d2ae44e9135a0
BLAKE2b-256 a69de1a74f9750d3c622996ed610a1a42cb1d7086d489ec510a7abdbd461d580

See more details on using hashes here.

File details

Details for the file codi_cooperatiu_internal_tools-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for codi_cooperatiu_internal_tools-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 de8de2d5ad07003e88242b788cca4c2543c7b2fe6a9f073a6be3f0312b4616db
MD5 178786310e453d29cd5502d4f9b3bde8
BLAKE2b-256 cb6250441b1cd9fc43fe92dd04a0f78590d8592310ee5b381ad832acd9fa063d

See more details on using hashes here.

Supported by

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