unicef / iogt

BSD 2-Clause "Simplified" License
25 stars 36 forks source link

QoL improvements for development #1500

Open sheralim012 opened 1 year ago

sheralim012 commented 1 year ago

Tests

Most tests require a basic structure (pre-requisites) e.g., site, site settings, home page, etc. It would be better to create a mixin for it. It will remove a lot of duplications in the tests. Also, Django unit tests and selenium tests can use this. CSS selectors are another example that can be extracted and both Django and selenium tests can share.

Formatting

There are a few places where the code isn't formatted and it would be better to automate this task. I suggest we should integrate pre-commit for it. What this will do is before creating an actual commit either format the code or ask the user to resolve (if necessary).

Package management

As discussed in #1008

Documentation

Add technical documentation for non-obvious changes—for example, double header, top-level-section menu etc.

Alihassanc5 commented 1 year ago

Pip-tools:

Pros:

Suppose you have a Python project with several dependencies, and you want to manage them using pip-tools. You can create a requirements.in file, specify the dependencies and their versions, and then use the pip-compile command to generate a requirements.txt file. If you want to upgrade a dependency, you can run pip-compile --upgrade, and pip-tools will automatically update the version of the dependency in the requirements.txt file.

Cons:

Suppose you have two dependencies, A and B, that are required by your project. Dependency A requires version 1.0 of another package, while dependency B requires version 2.0 of the same package. If you add both dependencies to your requirements.in file, pip-compile will fail to generate a requirements.txt file because of the version conflict. You'll have to manually resolve the conflict by specifying a compatible version in the requirements.in file.

PDM:

Pros:

Suppose you have a large Python project with many dependencies, and you want to manage them using PDM. You can create a pyproject.toml file and specify the dependencies and their versions. PDM can automatically resolve and install the dependencies, taking care of version conflicts and other issues so you don't need to manually resolve the version conflicts as PDM will do it for you.. If you want to add a new dependency, you can use the PDM add command, and PDM will handle the installation and integration with your project.

Cons:

Suppose your project has a complex dependency tree with conflicting versions of some packages. PDM may require additional configuration to resolve the conflicts properly. You may have to manually specify the version of a package in your pyproject.toml file or use PDM's advanced features to customize the dependency resolution process (PDM can automatically resolve most dependencies, there may be cases where manual intervention is necessary).

Conclusion:

Pip-tools is a simpler, lightweight and more straightforward option for basic dependency management needs. Pip-tools would be a good choice for the IoGT project because it provides a simple and easy-to-understand workflow for managing dependencies, supports multiple environments with different dependencies by using separate requirements files, and can automatically update dependency versions using the pip-compile --upgrade command. It also has a large community and is widely used, making it a reliable choice.