Skip to content

Commit

Permalink
Remove unnecessary thread binding for audio driver
Browse files Browse the repository at this point in the history
Remove condition check for API call's request method
Upgrade to pydantic v2
Improve pre-commit hooks
Bump version
  • Loading branch information
dormant-user committed Oct 8, 2023
1 parent 52c6ee4 commit 625bcc3
Show file tree
Hide file tree
Showing 32 changed files with 545 additions and 356 deletions.
81 changes: 58 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,72 @@
fail_fast: true
exclude: ^docs/
repos:
-
repo: https://github.com/PyCQA/flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-byte-order-marker
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-shebang-scripts-are-executable
- id: pretty-format-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-aws-credentials
- id: detect-private-key
- id: end-of-file-fixer
- id: file-contents-sorter
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: name-tests-test
- id: requirements-txt-fixer
- id: sort-simple-yaml
- id: trailing-whitespace

- repo: https://github.com/PyCQA/flake8
rev: '6.1.0'
hooks:
-
id: flake8
- id: flake8
additional_dependencies:
- flake8-docstrings
- flake8-sfs
args: [--max-line-length=120, --extend-ignore=SFS3 D107 SFS301 D100 D104 D401 SFS101 SFS201]
args: [ --max-line-length=120, --extend-ignore=SFS3 D107 SFS301 D100 D104 D401 SFS101 SFS201 ]

- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black

-
repo: https://github.com/PyCQA/isort
- repo: https://github.com/PyCQA/isort
rev: '5.12.0'
hooks:
-
id: isort
- id: isort
name: isort (python)
args: [ --profile, black ]

# - repo: local
# hooks:
# -
# id: pytest
# name: pytest
# entry: cd tests pytest
# language: system
# pass_filenames: false
# always_run: true
#
-
repo: local
# - repo: local
# hooks:
# -
# id: pytest
# name: pytest
# entry: cd tests pytest
# language: system
# pass_filenames: false
# always_run: true
#
- repo: local
hooks:
-
id: docs
- id: docs
name: docs
entry: /bin/bash gen_docs.sh
language: system
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Vignesh Sivanandha Rao
Copyright (c) 2020 Vignesh Rao

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Env vars are loaded from a `.env` file and validated using `pydantic`
<details>
<summary><strong><i>To use custom .env files</i></strong></summary>

If the filename is anything other than `.env`, set the filename as an env var `env_file` before importing `jarvis_ui`
To use a custom `.env` file, set the filename to the env var `env_file` before importing `jarvis_ui` module.

```python
import os
Expand All @@ -44,7 +44,7 @@ if __name__ == '__main__':
</details>

#### Mandatory
- **REQUEST_URL**: URL to which the API call has to be made. Can be `localhost` or a `tunneled` URL behind a reverse proxy/CDN.
- **SERVER_URL**: Endpoint URL to which the API call has to be made. Can be `localhost` or a `tunneled` URL behind a reverse proxy/CDN.
- **TOKEN**: Authentication token.

#### Optional
Expand Down Expand Up @@ -92,7 +92,7 @@ Sample settings (formatted as JSON object)<br>
### Coding Standards
Docstring format: [`Google`](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) <br>
Styling conventions: [`PEP 8`](https://www.python.org/dev/peps/pep-0008/) <br>
Clean code with pre-commit hooks: [`flake8`](https://flake8.pycqa.org/en/latest/) and
Clean code with pre-commit hooks: [`flake8`](https://flake8.pycqa.org/en/latest/) and
[`isort`](https://pycqa.github.io/isort/)

### [Release Notes](https://github.com/thevickypedia/Jarvis_UI/blob/main/release_notes.rst)
Expand Down Expand Up @@ -133,6 +133,6 @@ pre-commit run --all-files

### License & copyright

&copy; Vignesh Sivanandha Rao
&copy; Vignesh Rao

Licensed under the [MIT License](https://github.com/thevickypedia/Jarvis_UI/blob/main/LICENSE)
34 changes: 16 additions & 18 deletions doc_generator/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
import os
import sys

sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))


# -- Project information -----------------------------------------------------

project = 'Jarvis UI'
copyright = '2022, Vignesh Sivanandha Rao'
author = 'Vignesh Sivanandha Rao'
project = "Jarvis UI"
copyright = "2022, Vignesh Rao"
author = "Vignesh Rao"


# -- General configuration ---------------------------------------------------
Expand All @@ -29,47 +29,45 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.napoleon', # certain styles of doc strings
'sphinx.ext.autodoc', # generates from doc strings
'recommonmark', # supports markdown integration
"sphinx.ext.napoleon", # certain styles of doc strings
"sphinx.ext.autodoc", # generates from doc strings
"recommonmark", # supports markdown integration
]

# https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html#configuration
napoleon_google_docstring = True
napoleon_use_param = False

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# https://www.sphinx-doc.org/en/master/usage/theming.html#builtin-themes
html_theme = 'classic'
html_theme_options = {
"body_max_width": "80%"
}
html_theme = "classic"
html_theme_options = {"body_max_width": "80%"}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]


# Add docstrings from __init__ method
# Reference: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autoclass_content
autoclass_content = 'both'
autoclass_content = "both"

# Add support to mark down files in sphinx documentation
# Reference: https://www.sphinx-doc.org/en/1.5.3/markdown.html
source_suffix = {
'.rst': 'restructuredtext',
'.txt': 'markdown',
'.md': 'markdown',
".rst": "restructuredtext",
".txt": "markdown",
".md": "markdown",
}
8 changes: 4 additions & 4 deletions docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ <h2>Kick off<a class="headerlink" href="#kick-off" title="Permalink to this head
<h2>Environment Variables<a class="headerlink" href="#environment-variables" title="Permalink to this heading"></a></h2>
<p>Env vars are loaded from a <code class="docutils literal notranslate"><span class="pre">.env</span></code> file and validated using <code class="docutils literal notranslate"><span class="pre">pydantic</span></code></p>
<details>
<summary><strong><i>To use custom .env files</i></strong></summary><p>If the filename is anything other than <code class="docutils literal notranslate"><span class="pre">.env</span></code>, set the filename as an env var <code class="docutils literal notranslate"><span class="pre">env_file</span></code> before importing <code class="docutils literal notranslate"><span class="pre">jarvis_ui</span></code></p>
<summary><strong><i>To use custom .env files</i></strong></summary><p>To use a custom <code class="docutils literal notranslate"><span class="pre">.env</span></code> file, set the filename to the env var <code class="docutils literal notranslate"><span class="pre">env_file</span></code> before importing <code class="docutils literal notranslate"><span class="pre">jarvis_ui</span></code> module.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">os</span>
<span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;env_file&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&quot;jarvis_ui.env&quot;</span>

Expand All @@ -81,7 +81,7 @@ <h2>Environment Variables<a class="headerlink" href="#environment-variables" tit
</details><section id="mandatory">
<h3>Mandatory<a class="headerlink" href="#mandatory" title="Permalink to this heading"></a></h3>
<ul class="simple">
<li><p><strong>REQUEST_URL</strong>: URL to which the API call has to be made. Can be <code class="docutils literal notranslate"><span class="pre">localhost</span></code> or a <code class="docutils literal notranslate"><span class="pre">tunneled</span></code> URL behind a reverse proxy/CDN.</p></li>
<li><p><strong>SERVER_URL</strong>: Endpoint URL to which the API call has to be made. Can be <code class="docutils literal notranslate"><span class="pre">localhost</span></code> or a <code class="docutils literal notranslate"><span class="pre">tunneled</span></code> URL behind a reverse proxy/CDN.</p></li>
<li><p><strong>TOKEN</strong>: Authentication token.</p></li>
</ul>
</section>
Expand Down Expand Up @@ -167,7 +167,7 @@ <h2>Runbook<a class="headerlink" href="#runbook" title="Permalink to this headin
</section>
<section id="license-copyright">
<h2>License &amp; copyright<a class="headerlink" href="#license-copyright" title="Permalink to this heading"></a></h2>
<p>© Vignesh Sivanandha Rao</p>
<p>© Vignesh Rao</p>
<p>Licensed under the <a class="reference external" href="https://github.com/thevickypedia/Jarvis_UI/blob/main/LICENSE">MIT License</a></p>
</section>
</section>
Expand Down Expand Up @@ -243,7 +243,7 @@ <h3>Navigation</h3>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2022, Vignesh Sivanandha Rao.
&#169; Copyright 2022, Vignesh Rao.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.1.1.
</div>
</body>
Expand Down
8 changes: 4 additions & 4 deletions docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Env vars are loaded from a `.env` file and validated using `pydantic`
<details>
<summary><strong><i>To use custom .env files</i></strong></summary>

If the filename is anything other than `.env`, set the filename as an env var `env_file` before importing `jarvis_ui`
To use a custom `.env` file, set the filename to the env var `env_file` before importing `jarvis_ui` module.

```python
import os
Expand All @@ -44,7 +44,7 @@ if __name__ == '__main__':
</details>

#### Mandatory
- **REQUEST_URL**: URL to which the API call has to be made. Can be `localhost` or a `tunneled` URL behind a reverse proxy/CDN.
- **SERVER_URL**: Endpoint URL to which the API call has to be made. Can be `localhost` or a `tunneled` URL behind a reverse proxy/CDN.
- **TOKEN**: Authentication token.

#### Optional
Expand Down Expand Up @@ -92,7 +92,7 @@ Sample settings (formatted as JSON object)<br>
### Coding Standards
Docstring format: [`Google`](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) <br>
Styling conventions: [`PEP 8`](https://www.python.org/dev/peps/pep-0008/) <br>
Clean code with pre-commit hooks: [`flake8`](https://flake8.pycqa.org/en/latest/) and
Clean code with pre-commit hooks: [`flake8`](https://flake8.pycqa.org/en/latest/) and
[`isort`](https://pycqa.github.io/isort/)

### [Release Notes](https://github.com/thevickypedia/Jarvis_UI/blob/main/release_notes.rst)
Expand Down Expand Up @@ -133,6 +133,6 @@ pre-commit run --all-files

### License & copyright

&copy; Vignesh Sivanandha Rao
&copy; Vignesh Rao

Licensed under the [MIT License](https://github.com/thevickypedia/Jarvis_UI/blob/main/LICENSE)
38 changes: 29 additions & 9 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,15 @@ <h2 id="E">E</h2>
</li>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.Config.env_prefix">env_prefix (jarvis_ui.modules.models.EnvConfig.Config attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig">EnvConfig (class in jarvis_ui.modules.models)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.Config">EnvConfig.Config (class in jarvis_ui.modules.models)</a>
</li>
<li><a href="index.html#jarvis_ui.executables.starter.Activator.executor">executor() (jarvis_ui.executables.starter.Activator method)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.FileIO.extn_">extn_ (jarvis_ui.modules.models.FileIO attribute)</a>
</li>
</ul></td>
</tr></table>
Expand Down Expand Up @@ -176,10 +178,12 @@ <h2 id="I">I</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#jarvis_ui.main.initiator">initiator() (in module jarvis_ui.main)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.peripherals.ChannelType.input_channels">input_channels (jarvis_ui.modules.peripherals.ChannelType attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#jarvis_ui.modules.peripherals.ChannelType.input_channels">input_channels (jarvis_ui.modules.peripherals.ChannelType attribute)</a>
<li><a href="index.html#jarvis_ui.modules.models.Settings.interactive">interactive (jarvis_ui.modules.models.Settings attribute)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.exceptions.InvalidEnvVars">InvalidEnvVars</a>
</li>
Expand Down Expand Up @@ -296,6 +300,22 @@ <h2 id="M">M</h2>
</li>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.microphone_index">microphone_index (jarvis_ui.modules.models.EnvConfig attribute)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.model_config">model_config (jarvis_ui.modules.models.EnvConfig attribute)</a>

<ul>
<li><a href="index.html#jarvis_ui.modules.models.FileIO.model_config">(jarvis_ui.modules.models.FileIO attribute)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.Settings.model_config">(jarvis_ui.modules.models.Settings attribute)</a>
</li>
</ul></li>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.model_fields">model_fields (jarvis_ui.modules.models.EnvConfig attribute)</a>

<ul>
<li><a href="index.html#jarvis_ui.modules.models.FileIO.model_fields">(jarvis_ui.modules.models.FileIO attribute)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.Settings.model_fields">(jarvis_ui.modules.models.Settings attribute)</a>
</li>
</ul></li>
<li>
module

Expand Down Expand Up @@ -356,6 +376,8 @@ <h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.parse_microphone_index">parse_microphone_index() (jarvis_ui.modules.models.EnvConfig class method)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.FileIO.path">path (jarvis_ui.modules.models.FileIO attribute)</a>
</li>
<li><a href="index.html#jarvis_ui.executables.starter.process_request">process_request() (in module jarvis_ui.executables.starter)</a>
</li>
Expand All @@ -374,12 +396,10 @@ <h2 id="R">R</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.recognizer_settings">recognizer_settings (jarvis_ui.modules.models.EnvConfig attribute)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.timer.RepeatedTimer">RepeatedTimer (class in jarvis_ui.modules.timer)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.request_url">request_url (jarvis_ui.modules.models.EnvConfig attribute)</a>
<li><a href="index.html#jarvis_ui.modules.timer.RepeatedTimer">RepeatedTimer (class in jarvis_ui.modules.timer)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.FileIO.restart">restart (jarvis_ui.modules.models.FileIO attribute)</a>
</li>
Expand All @@ -389,8 +409,6 @@ <h2 id="R">R</h2>
<h2 id="S">S</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#jarvis_ui.modules.exceptions.SegmentationError">SegmentationError</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.Sensitivity">Sensitivity (class in jarvis_ui.modules.models)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.sensitivity">sensitivity (jarvis_ui.modules.models.EnvConfig attribute)</a>
Expand All @@ -399,6 +417,8 @@ <h2 id="S">S</h2>
<li><a href="index.html#jarvis_ui.modules.models.Sensitivity.sensitivity">(jarvis_ui.modules.models.Sensitivity attribute)</a>
</li>
</ul></li>
<li><a href="index.html#jarvis_ui.modules.models.EnvConfig.server_url">server_url (jarvis_ui.modules.models.EnvConfig attribute)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.Settings">Settings (class in jarvis_ui.modules.models)</a>
</li>
<li><a href="index.html#jarvis_ui.modules.models.FileIO.shutdown">shutdown (jarvis_ui.modules.models.FileIO attribute)</a>
Expand Down Expand Up @@ -506,7 +526,7 @@ <h3>Navigation</h3>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2022, Vignesh Sivanandha Rao.
&#169; Copyright 2022, Vignesh Rao.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.1.1.
</div>
</body>
Expand Down
Loading

0 comments on commit 625bcc3

Please sign in to comment.