{"id":19428294,"url":"https://github.com/computationalcore/facially-edge","last_synced_at":"2025-04-24T18:30:41.732Z","repository":{"id":52299246,"uuid":"233995289","full_name":"computationalcore/facially-edge","owner":"computationalcore","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-08T03:27:56.000Z","size":56,"stargazers_count":5,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-16T01:55:03.891Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/computationalcore.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-15T04:03:59.000Z","updated_at":"2024-04-16T01:55:03.892Z","dependencies_parsed_at":"2023-01-25T04:15:12.794Z","dependency_job_id":null,"html_url":"https://github.com/computationalcore/facially-edge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/computationalcore%2Ffacially-edge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/computationalcore%2Ffacially-edge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/computationalcore%2Ffacially-edge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/computationalcore%2Ffacially-edge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/computationalcore","download_url":"https://codeload.github.com/computationalcore/facially-edge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223961173,"owners_count":17232251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T14:14:54.443Z","updated_at":"2024-11-10T14:14:55.010Z","avatar_url":"https://github.com/computationalcore.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"facially-edge\n================\n\n.. image:: https://travis-ci.org/computationalcore/facially-edge.svg?branch=master\n    :target: https://travis-ci.org/computationalcore/facially-edge\n    \n.. image:: https://img.shields.io/lgtm/grade/python/g/computationalcore/facially-edge.svg?logo=lgtm\u0026logoWidth=18\n    :target: https://lgtm.com/projects/g/computationalcore/facially-edge/context:python\n\n\n\n(Work in progress)\nAn edge app, part of Facially-targeted Ads Platform, that is responsible for running a \nneural network model for inference data based on facial features, estimate age, gender, \nemotions and head-pose, send this data to a web service in order to get the appropriate \nads for that particular audience, and display it on the screen. \nThe app will run on a device with a video camera attached, and internally will use \nIntel® Distribution of OpenVINO™ toolkit for DNN inference.\n\nRequirements\n------------\n\nPython 3.5+.\n\n.. note::\n\n    Because `Python 2.7 supports ended January 1, 2020 \u003chttps://pythonclock.org/\u003e`_, new projects\n    should consider supporting Python 3 only, which is simpler than trying to support both.\n    As a result, support for Python 2.7 in this example project has been dropped.\n\nWindows Support\n---------------\n\nSummary: On Windows, use ``py`` instead of ``python3`` for many of the examples in this\ndocumentation.\n\nThis package fully supports Windows, along with Linux and macOS, but Python is typically\n`installed differently on Windows \u003chttps://docs.python.org/3/using/windows.html\u003e`_.\nWindows users typically access Python through the\n`py \u003chttps://www.python.org/dev/peps/pep-0397/\u003e`_ launcher rather than a ``python3``\nlink in their ``PATH``. Within a virtual environment, all platforms operate the same and use a\n``python`` link to access the Python version used in that virtual environment.\n\n\nInstallation\n------------\n\nTo install and run the program without development environment folloe the instruction\n\nCreate and start the virtual environment (Check section \"Virtual Environments\"  for more details)\n.. code:: bash\n\n    $ python3 -m venv venv\n    $ source venv/bin/activate\n\nInstall the requirements\n    $ pip -r requirements.txt\n\nTo execute the cli (example)\n.. code:: bash\n\n    $ cd src\n    $ python -m facially.cli -s World\n\nPackaging\n---------\n\nThis project is designed as a Python package, meaning that it can be bundled up and redistributed\nas a single compressed file.\n\nPackaging is configured by:\n\n- ``setup.py``\n\n- ``MANIFEST.in``\n\nSource Distribution\n^^^^^^^^^^^^^^^^^^^\n\nTo package the project as a\n`source distribution \u003chttps://docs.python.org/3/distutils/sourcedist.html\u003e`_:\n\n.. code-block:: bash\n\n    $ python3 setup.py sdist\n\nThis will generate ``dist/facially-0.0.1.tar.gz``.\n\nDependencies\n------------\n\nDependencies are defined in:\n\n- ``requirements.in``\n\n- ``requirements.txt``\n\n- ``dev-requirements.in``\n\n- ``dev-requirements.txt``\n\nVirtual Environments\n^^^^^^^^^^^^^^^^^^^^\n\nIt is best practice during development to create an isolated\n`Python virtual environment \u003chttps://docs.python.org/3/library/venv.html\u003e`_ using the\n``venv`` standard library module. This will keep dependant Python packages from interfering\nwith other Python projects on your system.\n\nOn \\*Nix:\n\n.. code-block:: bash\n\n    $ python3 -m venv venv\n    $ source venv/bin/activate\n\nOn Windows ``cmd``:\n\n.. code-block:: bash\n\n    \u003e py -m venv venv\n    \u003e venv\\Scripts\\activate.bat\n\nOnce activated, it is good practice to update ``pip`` to the latest version.\n\n.. code-block:: bash\n\n    (venv) $ pip install --upgrade pip\n\n(Applications Only) Locking Dependencies\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis project uses `pip-tools \u003chttps://github.com/jazzband/pip-tools\u003e`_ to lock project\ndependencies and create reproducible virtual environments.\n\n**Note:** *Library* projects should not lock their ``requirements.txt``. Since ``python-blueprint``\nalso has a CLI application, this end-user application example is used to demonstrate how to\nlock application dependencies.\n\nTo update dependencies:\n\n.. code-block:: bash\n\n    (venv) $ pip install pip-tools\n    (venv) $ pip-compile --upgrade\n    (venv) $ pip-compile --upgrade dev-requirements.in\n\nAfter upgrading dependencies, run the unit tests as described in the `Unit Testing`_ section\nto ensure that none of the updated packages caused incompatibilities in the current project.\n\nSyncing Virtual Environments\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nTo cleanly install your dependencies into your virtual environment:\n\n.. code-block:: bash\n\n    (venv) $ pip-sync requirements.txt dev-requirements.txt\n\nTesting\n-------\n\nAutomated testing is performed using `tox \u003chttps://tox.readthedocs.io/en/latest/index.html\u003e`_.\ntox will automatically create virtual environments based on ``tox.ini`` for unit testing,\nPEP8 style guide checking, and documentation generation.\n\n.. code-block:: bash\n\n    # Install tox (only needed once).\n    $ python3 -m pip install tox\n\n    # Run all environments.\n    #   To only run a single environment, specify it like: -e pep8\n    $ tox\n\nUnit Testing\n^^^^^^^^^^^^\n\nUnit testing is performed with `pytest \u003chttps://pytest.org/\u003e`_. pytest has become the defacto\nPython unit testing framework. Some key advantages over the built in\n`unittest \u003chttps://docs.python.org/3/library/unittest.html\u003e`_ module are:\n\n#. Significantly less boilerplate needed for tests.\n\n#. PEP8 compliant names (e.g. ``pytest.raises()`` instead of ``self.assertRaises()``).\n\n#. Vibrant ecosystem of plugins.\n\npytest will automatically discover and run tests by recursively searching for folders and ``.py``\nfiles prefixed with ``test`` for any functions prefixed by ``test``.\n\nThe ``tests`` folder is created as a Python package (i.e. there is an ``__init__.py`` file\nwithin it) because this helps ``pytest`` uniquely namespace the test files. Without this,\ntwo test files cannot be named the same, even if they are in different sub-directories.\n\nCode coverage is provided by the `pytest-cov \u003chttps://pytest-cov.readthedocs.io/en/latest/\u003e`_\nplugin.\n\nWhen running a unit test tox environment (e.g. ``tox``, ``tox -e py37``, etc.), a data file\n(e.g. ``.coverage.py37``) containing the coverage data is generated. This file is not readable on\nits own, but when the ``coverage`` tox environment is run (e.g. ``tox`` or ``tox -e -coverage``),\ncoverage from all unit test environments is combined into a single data file and an HTML report is\ngenerated in the ``htmlcov`` folder showing each source file and which lines were executed during\nunit testing. Open ``htmlcov/index.html`` in a web browser to view the report. Code coverage \nreports help identify areas of the project that are currently not tested.\n\nCode coverage is configured in the ``.coveragerc`` file.\n\n\nCode Style Checking\n^^^^^^^^^^^^^^^^^^^\n\n`PEP8 \u003chttps://www.python.org/dev/peps/pep-0008/\u003e`_ is the universally accepted style\nguide for Python code. PEP8 code compliance is verified using `flake8 \u003chttp://flake8.pycqa.org/\u003e`_.\nflake8 is configured in the ``[flake8]`` section of ``tox.ini``. Three extra flake8 plugins\nare also included:\n\n- ``pep8-naming``: Ensure functions, classes, and variables are named with correct casing.\n- ``flake8-quotes``: Ensure that ``' '`` style string quoting is used consistently.\n- ``flake8-import-order``: Ensure consistency in the way imports are grouped and sorted.\n\nProject Structure\n-----------------\n\nTraditionally, Python projects place the source for their packages in the root of the project\nstructure, like:\n\n.. code-block::\n\n    root_folder\n    ├── facially\n    │   ├── __init__.py\n    │   ├── cli.py\n    │   └── lib.py\n    ├── tests\n    │   ├── __init__.py\n    │   └── test_generate.py\n    ├── tox.ini\n    └── setup.py\n\nHowever, this structure is `known\n\u003chttps://docs.pytest.org/en/latest/goodpractices.html#tests-outside-application-code\u003e`_ to have bad\ninteractions with ``pytest`` and ``tox``, two standard tools maintaining Python projects. The\nfundamental issue is that tox creates an isolated virtual environment for testing. By installing\nthe distribution into the virtual environment, ``tox`` ensures that the tests pass even after the\ndistribution has been packaged and installed, thereby catching any errors in packaging and\ninstallation scripts, which are common. Having the Python packages in the project root subverts\nthis isolation for two reasons:\n\n#. Calling ``python`` in the project root (for example, ``python -m pytest tests/``) `causes Python\n   to add the current working directory\n   \u003chttps://docs.pytest.org/en/latest/pythonpath.html#invoking-pytest-versus-python-m-pytest\u003e`_\n   (the project root) to ``sys.path``, which Python uses to find modules. Because the source\n   package ``facially`` is in the project root, it shadows the ``facially`` package installed in the tox\n   environment.\n\n#. Calling ``pytest`` directly anywhere that it can find the tests will also add the project root\n   to ``sys.path`` if the ``tests`` folder is a a Python package (that is, it contains a\n   ``__init__.py`` file). `pytest adds all folders containing packages\n   \u003chttps://docs.pytest.org/en/latest/goodpractices.html#conventions-for-python-test-discovery\u003e`_\n   to ``sys.path`` because it imports the tests like regular Python modules.\n\nIn order to properly test the project, the source packages must not be on the Python path. To\nprevent this, there are three possible solutions:\n\n#. Remove the ``__init__.py`` file from ``tests`` and run ``pytest`` directly as a tox command.\n\n#. Remove the ``__init__.py`` file from tests and change the working directory of\n   ``python -m pytest`` to ``tests``.\n\n#. Move the source packages to a dedicated ``src`` folder.\n\nThe dedicated ``src`` directory is the `recommended solution\n\u003chttps://docs.pytest.org/en/latest/pythonpath.html#test-modules-conftest-py-files-inside-packages\u003e`_\nby ``pytest`` when using tox and the solution this blueprint promotes because it is the least\nbrittle even though it deviates from the traditional Python project structure. It results is a\ndirectory structure like:\n\n.. code-block::\n\n    root_folder\n    ├── src\n    │   └── facially\n    │       ├── __init__.py\n    │       ├── cli.py\n    │       └── lib.py\n    ├── tests\n    │   ├── __init__.py\n    │   └── test_generate.py\n    ├── tox.ini\n    └── setup.py\n\nLicensing\n---------\n\nLicensing for the project is defined in:\n\n- ``LICENSE.txt``\n\n- ``setup.py``\n\nThis project uses a common permissive license, the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomputationalcore%2Ffacially-edge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomputationalcore%2Ffacially-edge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomputationalcore%2Ffacially-edge/lists"}