Skip to content

Commit

Permalink
Deprecate Python 3.6 and 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
roo-oliv committed Jul 4, 2024
1 parent 85f5d25 commit dd7c113
Show file tree
Hide file tree
Showing 62 changed files with 660 additions and 571 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.4.7
current_version = 4.0.0

[bumpversion:file:Makefile]
search = CURRENT_VERSION = {current_version}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
max-parallel: 4
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0-rc.1]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Publish new release to PyPI
uses: mariamrf/[email protected]
with:
python_version: 3.7.7
python_version: 3.8.19
env:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_PASSWORD: ${{ secrets.pypi_password }}
3 changes: 2 additions & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Authors
=======

* Rodrigo Martins de Oliveira - https://github.com/allrod5
* Rodrigo Oliveira - https://github.com/roo-oliv
* Craig Minihan - https://github.com/craigminihan
* Teodor Kulej - https://github.com/mt3o
* David Lozano - https://github.com/lozanocampillod
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

4.0.0 (2024-07-04)
------------------
* Drop support for Python version 3.6 and 3.7
* Comply with PEP-593 and support typing.Annotated

3.4.7 (2021-08-15)
------------------

Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: environment
environment: ## create environment
pyenv install -s 3.6.9
pyenv virtualenv 3.6.9 injectable
pyenv install -s 3.8.19
pyenv virtualenv 3.8.19 injectable
pyenv local injectable

.PHONY: requirements
Expand All @@ -24,15 +24,15 @@ black-check: ## check Black code style
@echo "\033[33mBlack Code Style\033[0m"
@echo "\033[33m================\033[0m"
@echo ""
@python -m black --target-version=py36 --check --exclude="build/|buck-out/|dist/|_build/\
@python -m black --target-version=py38 --check --exclude="build/|buck-out/|dist/|_build/\
|pip/|env/|\.pip/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/" . \
&& echo "\n\n\033[32mSuccess\033[0m\n" || (echo "\n\n\033[31mFailure\033[0m\n\n\
\033[34mRun \"\e[4mmake black\e[24m\" to apply style formatting to your code\
\033[0m\n" && exit 1)

.PHONY: black
black: ## apply the Black code style to code
black --target-version=py36 --exclude="build/|buck-out/|dist/|_build/|pip/|env/|\.pip/|\.git/\
black --target-version=py38 --exclude="build/|buck-out/|dist/|_build/|pip/|env/|\.pip/|\.git/\
|\.hg/|\.mypy_cache/|\.tox/|\.venv/" .

.PHONY: tests
Expand Down Expand Up @@ -72,7 +72,7 @@ docs:
make html -B
cp -a build/html/. docs

CURRENT_VERSION = 3.4.7
CURRENT_VERSION = 4.0.0

.PHONY: bump-patch-version
bump-patch-version:
Expand Down
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 608fa2521195fa2771065e2da377c1f9
config: 59603b7feaea2199af3a5ec748336286
tags: 645f666f9bcd5a90fca523b33c5a78b7
8 changes: 4 additions & 4 deletions docs/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Overview: module code &#8212; injectable 3.4.7 documentation</title>
<title>Overview: module code &#8212; injectable 4.0.0 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css" />

Expand All @@ -28,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../index.html">injectable-3.4.7</a> &#187;</li>
<li><a href="../index.html">injectable-4.0.0</a> &#187;</li>
</ul>
</div>

Expand Down Expand Up @@ -108,8 +108,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on Aug 15, 2021.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
Last updated on Jul 04, 2024.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.5.0.
</div>
</body>
</html>
43 changes: 30 additions & 13 deletions docs/_modules/injectable/autowiring/autowired_decorator.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>injectable.autowiring.autowired_decorator &#8212; injectable 3.4.6 documentation</title>
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" />
<title>injectable.autowiring.autowired_decorator &#8212; injectable 3.4.7 documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../../_static/pydoctheme.css" />

<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/language_data.js"></script>

<script src="../../../_static/sidebar.js"></script>

Expand All @@ -29,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">injectable-3.4.6</a> &#187;</li>
<li><a href="../../../index.html">injectable-3.4.7</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand All @@ -49,7 +48,7 @@ <h3>Navigation</h3>
<h1>Source code for injectable.autowiring.autowired_decorator</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">inspect</span>
<span class="kn">from</span> <span class="nn">functools</span> <span class="kn">import</span> <span class="n">wraps</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">TypeVar</span><span class="p">,</span> <span class="n">Callable</span><span class="p">,</span> <span class="n">Any</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">TypeVar</span><span class="p">,</span> <span class="n">Callable</span><span class="p">,</span> <span class="n">Any</span><span class="p">,</span> <span class="n">get_args</span><span class="p">,</span> <span class="n">_AnnotatedAlias</span>

<span class="kn">from</span> <span class="nn">injectable.autowiring.autowired_type</span> <span class="kn">import</span> <span class="n">_Autowired</span>
<span class="kn">from</span> <span class="nn">injectable.errors</span> <span class="kn">import</span> <span class="n">AutowiringError</span>
Expand All @@ -58,7 +57,7 @@ <h1>Source code for injectable.autowiring.autowired_decorator</h1><div class="hi


<div class="viewcode-block" id="autowired"><a class="viewcode-back" href="../../../reference/injectable.html#injectable.autowired">[docs]</a><span class="k">def</span> <span class="nf">autowired</span><span class="p">(</span><span class="n">func</span><span class="p">:</span> <span class="n">T</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">T</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Function decorator to setup dependency injection autowiring.</span>

<span class="sd"> Only parameters annotated with :class:`Autowired &lt;injectable.Autowired&gt;` will be</span>
Expand Down Expand Up @@ -92,7 +91,9 @@ <h1>Source code for injectable.autowiring.autowired_decorator</h1><div class="hi
<span class="n">signature</span> <span class="o">=</span> <span class="n">inspect</span><span class="o">.</span><span class="n">signature</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
<span class="n">autowired_parameters</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">index</span><span class="p">,</span> <span class="n">parameter</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">signature</span><span class="o">.</span><span class="n">parameters</span><span class="o">.</span><span class="n">values</span><span class="p">()):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parameter</span><span class="o">.</span><span class="n">annotation</span><span class="p">,</span> <span class="n">_Autowired</span><span class="p">):</span>
<span class="n">annotation</span> <span class="o">=</span> <span class="n">_get_parameter_annotation</span><span class="p">(</span><span class="n">parameter</span><span class="p">)</span>

<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">annotation</span><span class="p">,</span> <span class="n">_Autowired</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">autowired_parameters</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">parameter</span><span class="o">.</span><span class="n">kind</span> <span class="ow">in</span> <span class="p">[</span>
<span class="n">parameter</span><span class="o">.</span><span class="n">KEYWORD_ONLY</span><span class="p">,</span>
<span class="n">parameter</span><span class="o">.</span><span class="n">VAR_KEYWORD</span><span class="p">,</span>
Expand All @@ -117,7 +118,8 @@ <h1>Source code for injectable.autowiring.autowired_decorator</h1><div class="hi
<span class="k">for</span> <span class="n">parameter</span> <span class="ow">in</span> <span class="n">autowired_parameters</span><span class="p">:</span>
<span class="k">if</span> <span class="n">parameter</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">bound_arguments</span><span class="p">:</span>
<span class="k">continue</span>
<span class="n">dependency</span> <span class="o">=</span> <span class="n">parameter</span><span class="o">.</span><span class="n">annotation</span><span class="o">.</span><span class="n">inject</span><span class="p">()</span>
<span class="n">annotation</span> <span class="o">=</span> <span class="n">_get_parameter_annotation</span><span class="p">(</span><span class="n">parameter</span><span class="p">)</span>
<span class="n">dependency</span> <span class="o">=</span> <span class="n">annotation</span><span class="o">.</span><span class="n">inject</span><span class="p">()</span>
<span class="k">if</span> <span class="n">parameter</span><span class="o">.</span><span class="n">kind</span> <span class="ow">is</span> <span class="n">parameter</span><span class="o">.</span><span class="n">POSITIONAL_ONLY</span><span class="p">:</span>
<span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">dependency</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
Expand All @@ -126,6 +128,20 @@ <h1>Source code for injectable.autowiring.autowired_decorator</h1><div class="hi
<span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

<span class="k">return</span> <span class="n">wrapper</span></div>


<span class="k">def</span> <span class="nf">_get_parameter_annotation</span><span class="p">(</span><span class="n">parameter</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">type</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parameter</span><span class="o">.</span><span class="n">annotation</span><span class="p">,</span> <span class="n">_AnnotatedAlias</span><span class="p">):</span>
<span class="n">autowired_annotations</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span>
<span class="nb">filter</span><span class="p">(</span><span class="k">lambda</span> <span class="n">t</span><span class="p">:</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="n">_Autowired</span><span class="p">),</span> <span class="n">get_args</span><span class="p">(</span><span class="n">parameter</span><span class="o">.</span><span class="n">annotation</span><span class="p">))</span>
<span class="p">)</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">autowired_annotations</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="k">return</span> <span class="n">parameter</span><span class="o">.</span><span class="n">annotation</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">autowired_annotations</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">AutowiringError</span><span class="p">(</span><span class="s2">&quot;Multiple Autowired annotations found&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">autowired_annotations</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>

<span class="k">return</span> <span class="n">parameter</span><span class="o">.</span><span class="n">annotation</span>
</pre></div>

<div class="clearer"></div>
Expand All @@ -141,7 +157,7 @@ <h1>Source code for injectable.autowiring.autowired_decorator</h1><div class="hi
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
Expand All @@ -152,6 +168,7 @@ <h3 id="searchlabel">Quick search</h3>
<li class="toctree-l1"><a class="reference internal" href="../../../installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../usage/index.html">Usage Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../reference/index.html">Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../caveats.html">Caveats</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contributing.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../authors.html">Authors</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../changelog.html">Changelog</a></li>
Expand All @@ -175,8 +192,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on Mar 20, 2021.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.3.1.
Last updated on Jul 04, 2024.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.5.0.
</div>
</body>
</html>
20 changes: 10 additions & 10 deletions docs/_modules/injectable/autowiring/autowired_type.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>injectable.autowiring.autowired_type &#8212; injectable 3.4.6 documentation</title>
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pydoctheme.css" type="text/css" />
<title>injectable.autowiring.autowired_type &#8212; injectable 3.4.7 documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../../_static/pydoctheme.css" />

<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/language_data.js"></script>

<script src="../../../_static/sidebar.js"></script>

Expand All @@ -29,7 +28,7 @@
<h3>Navigation</h3>
<ul>
<li class="responsive-menu"><a href="#sidebar-anchor" title="Navigation">&#9776;</a></li>
<li><a href="../../../index.html">injectable-3.4.6</a> &#187;</li>
<li><a href="../../../index.html">injectable-3.4.7</a> &#187;</li>
<li><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
Expand Down Expand Up @@ -136,7 +135,7 @@ <h1>Source code for injectable.autowiring.autowired_type</h1><div class="highlig


<div class="viewcode-block" id="Autowired"><a class="viewcode-back" href="../../../reference/injectable.html#injectable.Autowired">[docs]</a><span class="k">class</span> <span class="nc">Autowired</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Autowired type annotation marks a parameter to be autowired for injection.</span>

<span class="sd"> Autowired parameters must be last in declaration if there are others which aren&#39;t</span>
Expand Down Expand Up @@ -204,7 +203,7 @@ <h1>Source code for injectable.autowiring.autowired_type</h1><div class="highlig
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
Expand All @@ -215,6 +214,7 @@ <h3 id="searchlabel">Quick search</h3>
<li class="toctree-l1"><a class="reference internal" href="../../../installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../usage/index.html">Usage Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../reference/index.html">Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../caveats.html">Caveats</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../contributing.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../authors.html">Authors</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../changelog.html">Changelog</a></li>
Expand All @@ -238,8 +238,8 @@ <h3>Navigation</h3>

<div class="footer" role="contentinfo">
&#169; Copyright 2018, Rodrigo Martins de Oliveira.
Last updated on Mar 20, 2021.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.3.1.
Last updated on Jul 04, 2024.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.5.0.
</div>
</body>
</html>
Loading

0 comments on commit dd7c113

Please sign in to comment.