././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757660725.8556633 zope_deferredimport-6.0/0000755000076600000240000000000015060743066015141 5ustar00m.howitzstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/.pre-commit-config.yaml0000644000076600000240000000132615060743064021422 0ustar00m.howitzstaff# Generated from: # https://github.com/zopefoundation/meta/tree/master/config/pure-python minimum_pre_commit_version: '3.6' repos: - repo: https://github.com/pycqa/isort rev: "6.0.1" hooks: - id: isort - repo: https://github.com/hhatto/autopep8 rev: "v2.3.2" hooks: - id: autopep8 args: [--in-place, --aggressive, --aggressive] - repo: https://github.com/asottile/pyupgrade rev: v3.20.0 hooks: - id: pyupgrade args: [--py39-plus] - repo: https://github.com/isidentical/teyit rev: 0.4.3 hooks: - id: teyit - repo: https://github.com/PyCQA/flake8 rev: "7.3.0" hooks: - id: flake8 additional_dependencies: - flake8-debugger == 4.1.2 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/.readthedocs.yaml0000644000076600000240000000123515060743064020367 0ustar00m.howitzstaff# Generated from: # https://github.com/zopefoundation/meta/tree/master/config/pure-python # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details # Required version: 2 # Set the version of Python and other tools you might need build: os: ubuntu-22.04 tools: python: "3.11" # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/conf.py # We recommend specifying your dependencies to enable reproducible builds: # https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html python: install: - requirements: docs/requirements.txt - method: pip path: . ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/CHANGES.rst0000644000076600000240000000430415060743064016742 0ustar00m.howitzstaff========= Changes ========= 6.0 (2025-09-12) ================ - Replace ``pkg_resources`` namespace with PEP 420 native namespace. 5.1 (2025-08-11) ================ - Add support for Python 3.12, 3.13. - Drop support for Python 3.7, 3.8. 5.0 (2023-06-29) ================ - Drop support for Python 2.7, 3.5, 3.6. - Add support for Python 3.11. 4.4 (2021-12-10) ================ - Add support for Python 3.8, 3.9 and 3.10. - Drop support for Python 3.4. 4.3.1 (2019-08-05) ================== - Avoid race condition in ``deferredmodule.ModuleProxy.__getattr__`` `#8 `_. 4.3 (2018-10-05) ================ - Add support for Python 3.7. 4.2.1 (2017-10-24) ================== - Preserve the docstrings of proxied modules created with ``deprecatedFrom``, ``deferredFrom``, etc. See `issue 5 `_. 4.2.0 (2017-08-08) ================== - Add support for Python 3.5 and 3.6. - Drop support for Python 2.6 and 3.3. - Convert doctests to Sphinx documentation, including building docs and running doctest snippets under ``tox``. 4.1.0 (2014-12-26) ================== - Add support for PyPy. PyPy3 support is blocked on release of fix for: https://bitbucket.org/pypy/pypy/issue/1946 - Add support for Python 3.4. - Add support for testing on Travis. 4.0.0 (2013-02-28) ================== - Add support for Python 3.3. - Drop support for Python 2.4 and 2.5. 3.5.3 (2010-09-25) ================== - Add test extra to declare test dependency on ``zope.testing``. 3.5.2 (2010-05-24) ================== - Fix unit tests broken under Python 2.4 by the switch to the standard library ``doctest`` module. 3.5.1 (2010-04-30) ================== - Prefer the standard library's ``doctest`` module to the one from ``zope.testing``. 3.5.0 (2009-02-04) ================== - Add support to bootstrap on Jython. - Add reference documentation. 3.4.0 (2007-07-19) ================== - Finish release of ``zope.deferredimport``. 3.4.0b1 (2007-07-09) ==================== - Initial release as a separate project, corresponding to the ``zope.deferredimport`` from Zope 3.4.0b1. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/CONTRIBUTING.md0000644000076600000240000000144315060743064017372 0ustar00m.howitzstaff # Contributing to zopefoundation projects The projects under the zopefoundation GitHub organization are open source and welcome contributions in different forms: * bug reports * code improvements and bug fixes * documentation improvements * pull request reviews For any changes in the repository besides trivial typo fixes you are required to sign the contributor agreement. See https://www.zope.dev/developer/becoming-a-committer.html for details. Please visit our [Developer Guidelines](https://www.zope.dev/developer/guidelines.html) if you'd like to contribute code changes and our [guidelines for reporting bugs](https://www.zope.dev/developer/reporting-bugs.html) if you want to file a bug report. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/COPYRIGHT.txt0000644000076600000240000000004015060743064017242 0ustar00m.howitzstaffZope Foundation and Contributors././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/LICENSE.txt0000644000076600000240000000402615060743064016764 0ustar00m.howitzstaffZope Public License (ZPL) Version 2.1 A copyright notice accompanies this license document that identifies the copyright holders. This license has been certified as open source. It has also been designated as GPL compatible by the Free Software Foundation (FSF). Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions in source code must retain the accompanying copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the accompanying copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Names of the copyright holders must not be used to endorse or promote products derived from this software without prior written permission from the copyright holders. 4. The right to distribute this software or to use it for any purpose does not give you the right to use Servicemarks (sm) or Trademarks (tm) of the copyright holders. Use of them is covered by separate agreement with the copyright holders. 5. If any files are modified, you must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. Disclaimer THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/MANIFEST.in0000644000076600000240000000060715060743064016700 0ustar00m.howitzstaff# Generated from: # https://github.com/zopefoundation/meta/tree/master/config/pure-python include *.md include *.rst include *.txt include buildout.cfg include tox.ini include .pre-commit-config.yaml recursive-include docs *.py recursive-include docs *.rst recursive-include docs *.txt recursive-include docs Makefile recursive-include src *.py include *.yaml recursive-include docs *.bat ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757660725.8555634 zope_deferredimport-6.0/PKG-INFO0000644000076600000240000001263215060743066016242 0ustar00m.howitzstaffMetadata-Version: 2.4 Name: zope.deferredimport Version: 6.0 Summary: zope.deferredimport allows you to perform imports names that will only be resolved when used in the code. Home-page: http://github.com/zopefoundation/zope.deferredimport Author: Zope Foundation and Contributors Author-email: zope-dev@zope.dev License: ZPL-2.1 Project-URL: Issue Tracker, https://github.com/zopefoundation/zope.deferredimport/issues Project-URL: Sources, https://github.com/zopefoundation/zope.deferredimport Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Software Development Requires-Python: >=3.9 License-File: LICENSE.txt Requires-Dist: setuptools Requires-Dist: zope.proxy Provides-Extra: test Requires-Dist: zope.testrunner>=6.4; extra == "test" Provides-Extra: docs Requires-Dist: Sphinx; extra == "docs" Requires-Dist: repoze.sphinx.autointerface; extra == "docs" Dynamic: author Dynamic: author-email Dynamic: classifier Dynamic: description Dynamic: home-page Dynamic: license Dynamic: license-file Dynamic: project-url Dynamic: provides-extra Dynamic: requires-dist Dynamic: requires-python Dynamic: summary ========================= ``zope.deferredimport`` ========================= .. image:: https://img.shields.io/pypi/v/zope.deferredimport.svg :target: https://pypi.python.org/pypi/zope.deferredimport/ :alt: Latest release .. image:: https://img.shields.io/pypi/pyversions/zope.deferredimport.svg :target: https://pypi.org/project/zope.deferredimport/ :alt: Supported Python versions .. image:: https://github.com/zopefoundation/zope.deferredimport/actions/workflows/tests.yml/badge.svg :target: https://github.com/zopefoundation/zope.deferredimport/actions/workflows/tests.yml .. image:: https://coveralls.io/repos/github/zopefoundation/zope.deferredimport/badge.svg?branch=master :target: https://coveralls.io/github/zopefoundation/zope.deferredimport?branch=master .. image:: https://readthedocs.org/projects/zopedeferredimport/badge/?version=latest :target: http://zopedeferredimport.readthedocs.io/en/latest/ :alt: Documentation Status Often, especially for package modules, you want to import names for convenience, but not actually perform the imports until necessary. The zope.deferredimport package provided facilities for defining names in modules that will be imported from somewhere else when used. You can also cause deprecation warnings to be issued when a variable is used. Documentation is hosted at https://zopedeferredimport.readthedocs.io/ ========= Changes ========= 6.0 (2025-09-12) ================ - Replace ``pkg_resources`` namespace with PEP 420 native namespace. 5.1 (2025-08-11) ================ - Add support for Python 3.12, 3.13. - Drop support for Python 3.7, 3.8. 5.0 (2023-06-29) ================ - Drop support for Python 2.7, 3.5, 3.6. - Add support for Python 3.11. 4.4 (2021-12-10) ================ - Add support for Python 3.8, 3.9 and 3.10. - Drop support for Python 3.4. 4.3.1 (2019-08-05) ================== - Avoid race condition in ``deferredmodule.ModuleProxy.__getattr__`` `#8 `_. 4.3 (2018-10-05) ================ - Add support for Python 3.7. 4.2.1 (2017-10-24) ================== - Preserve the docstrings of proxied modules created with ``deprecatedFrom``, ``deferredFrom``, etc. See `issue 5 `_. 4.2.0 (2017-08-08) ================== - Add support for Python 3.5 and 3.6. - Drop support for Python 2.6 and 3.3. - Convert doctests to Sphinx documentation, including building docs and running doctest snippets under ``tox``. 4.1.0 (2014-12-26) ================== - Add support for PyPy. PyPy3 support is blocked on release of fix for: https://bitbucket.org/pypy/pypy/issue/1946 - Add support for Python 3.4. - Add support for testing on Travis. 4.0.0 (2013-02-28) ================== - Add support for Python 3.3. - Drop support for Python 2.4 and 2.5. 3.5.3 (2010-09-25) ================== - Add test extra to declare test dependency on ``zope.testing``. 3.5.2 (2010-05-24) ================== - Fix unit tests broken under Python 2.4 by the switch to the standard library ``doctest`` module. 3.5.1 (2010-04-30) ================== - Prefer the standard library's ``doctest`` module to the one from ``zope.testing``. 3.5.0 (2009-02-04) ================== - Add support to bootstrap on Jython. - Add reference documentation. 3.4.0 (2007-07-19) ================== - Finish release of ``zope.deferredimport``. 3.4.0b1 (2007-07-09) ==================== - Initial release as a separate project, corresponding to the ``zope.deferredimport`` from Zope 3.4.0b1. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/README.rst0000644000076600000240000000262615060743064016634 0ustar00m.howitzstaff========================= ``zope.deferredimport`` ========================= .. image:: https://img.shields.io/pypi/v/zope.deferredimport.svg :target: https://pypi.python.org/pypi/zope.deferredimport/ :alt: Latest release .. image:: https://img.shields.io/pypi/pyversions/zope.deferredimport.svg :target: https://pypi.org/project/zope.deferredimport/ :alt: Supported Python versions .. image:: https://github.com/zopefoundation/zope.deferredimport/actions/workflows/tests.yml/badge.svg :target: https://github.com/zopefoundation/zope.deferredimport/actions/workflows/tests.yml .. image:: https://coveralls.io/repos/github/zopefoundation/zope.deferredimport/badge.svg?branch=master :target: https://coveralls.io/github/zopefoundation/zope.deferredimport?branch=master .. image:: https://readthedocs.org/projects/zopedeferredimport/badge/?version=latest :target: http://zopedeferredimport.readthedocs.io/en/latest/ :alt: Documentation Status Often, especially for package modules, you want to import names for convenience, but not actually perform the imports until necessary. The zope.deferredimport package provided facilities for defining names in modules that will be imported from somewhere else when used. You can also cause deprecation warnings to be issued when a variable is used. Documentation is hosted at https://zopedeferredimport.readthedocs.io/ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/buildout.cfg0000644000076600000240000000027715060743064017455 0ustar00m.howitzstaff[buildout] parts = py test develop = . [test] recipe = zc.recipe.testrunner eggs = zope.deferredimport [test] [py] recipe = zc.recipe.egg eggs = zope.deferredimport [test] interpreter = py ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757660725.8520029 zope_deferredimport-6.0/docs/0000755000076600000240000000000015060743066016071 5ustar00m.howitzstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/docs/Makefile0000644000076600000240000001517215060743064017535 0ustar00m.howitzstaff# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " xml to make Docutils-native XML files" @echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/zopeminmax.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/zopeminmax.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/zopeminmax" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/zopeminmax" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." latexpdfja: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through platex and dvipdfmx..." $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." xml: $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml @echo @echo "Build finished. The XML files are in $(BUILDDIR)/xml." pseudoxml: $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml @echo @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/docs/api.rst0000644000076600000240000000022415060743064017370 0ustar00m.howitzstaff================================ :mod:`zope.deferredimport` API ================================ .. automodule:: zope.deferredimport :members: ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/docs/conf.py0000644000076600000240000002110615060743064017366 0ustar00m.howitzstaff#!/usr/bin/env python3 # # zope.deferredimport documentation build configuration file, created by # sphinx-quickstart on Sun Feb 1 12:10:49 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ "sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinx.ext.intersphinx", "sphinx.ext.viewcode", ] # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # The suffix of source filenames. source_suffix = ".rst" # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = "index" # General information about the project. project = "zope.deferredimport" copyright = "2015-2024, Zope Foundation and Contributors" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = "4.1" # The full version, including alpha/beta/rc tags. release = "4.1" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ["_build"] # The reST default role (used for this markup: `text`) to use for all # documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. # keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = "default" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # 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"] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. # html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = "zopedeferredimport" # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ( "index", "zopedeferredimport.tex", "zope.deferredimport Documentation", "Zope Foundation and Contributors", "manual", ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ( "index", "zopedeferredimport", "zope.deferredimport Documentation", ["Zope Foundation and Contributors"], 1, ) ] # If true, show URL addresses after external links. # man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ( "index", "zopedeferredimport", "zope.deferredimport Documentation", "Zope Foundation and Contributors", "zopedeferredimport", "One line description of project.", "Miscellaneous", ), ] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {"python": ("http://docs.python.org/", None)} ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/docs/index.rst0000644000076600000240000000032215060743064017725 0ustar00m.howitzstaff:mod:`zope.deferredimport` ========================== Contents: .. toctree:: :maxdepth: 2 narrative api Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/docs/make.bat0000644000076600000240000001506515060743064017503 0ustar00m.howitzstaff@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. xml to make Docutils-native XML files echo. pseudoxml to make pseudoxml-XML files for display purposes echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) %SPHINXBUILD% 2> nul if errorlevel 9009 ( echo. echo.The 'sphinx-build' command was not found. Make sure you have Sphinx echo.installed, then set the SPHINXBUILD environment variable to point echo.to the full path of the 'sphinx-build' executable. Alternatively you echo.may add the Sphinx directory to PATH. echo. echo.If you don't have Sphinx installed, grab it from echo.http://sphinx-doc.org/ exit /b 1 ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\zopeminmax.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\zopeminmax.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdf" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf cd %BUILDDIR%/.. echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdfja" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf-ja cd %BUILDDIR%/.. echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) if "%1" == "xml" ( %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml if errorlevel 1 exit /b 1 echo. echo.Build finished. The XML files are in %BUILDDIR%/xml. goto end ) if "%1" == "pseudoxml" ( %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml if errorlevel 1 exit /b 1 echo. echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. goto end ) :end ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/docs/narrative.rst0000644000076600000240000002323715060743064020623 0ustar00m.howitzstaff================== Deferred Imports ================== .. testsetup:: import os import sys import warnings import zope.deferredimport __file__ = 'docs/narrative.rst' class OutErr(object): @staticmethod def write(message): sys.stdout.write(message) oldstderr, sys.stderr = sys.stderr, OutErr() tmp_d = os.path.join( os.path.dirname(zope.deferredimport.__file__), 'samples') zope.deferredimport.__path__.append(tmp_d) created_modules = [] def create_module(**modules): #** for name, src in modules.items(): fn = os.path.join(tmp_d, name + '.py') needs_update = True if os.path.exists(fn): with open(fn, 'r') as file: needs_update = file.read() != src if needs_update: with open(fn, 'w') as file: file.write(src) created_modules.append(name) def warn(message, type_, stacklevel): frame = sys._getframe(stacklevel) path = frame.f_globals['__file__'] file = open(path) lineno = frame.f_lineno for i in range(lineno): line = file.readline() file.close() print("%s:%s: %s: %s\n %s" % ( path, frame.f_lineno, type_.__name__, message, line.strip(), )) oldwarn, warnings.warn = warnings.warn, warn Often, especially for package modules, you want to import names for convenience, but not actually perform the imports until necessary. The zope.deferredimport package provided facilities for defining names in modules that will be imported from somewhere else when used. You can also cause deprecation warnings to be issued when a variable is used, but we'll get to that later. The :func:`zope.deferredimport.define` function can be used to define one or more names to be imported when they are accessed. Simply provide names as keyword arguments with import specifiers as values. The import specifiers are given as strings of the form "module:name", where module is the dotted name of the module and name is a, possibly dotted, name of an object within the module. To see how this works, we'll create some sample modules within the zope.deferredimport package. We'll actually use a helper function specific to this document to define the modules inline so we can easily see what's in them. Let's start by defining a module, sample1, that defined some things to be imported: .. doctest:: >>> create_module(sample1 = ''' ... print("Sampe 1 imported!") ... ... x = 1 ... ... ... class C: ... y = 2 ... ... ... z = 3 ... q = 4 ... ''') Note that the module starts by printing a message. This allows us to see when the module is actually imported. Now, let's define a module that imports some names from this module: .. doctest:: >>> create_module(sample2 = ''' ... import zope.deferredimport ... ... zope.deferredimport.define( ... sample1='zope.deferredimport.sample1', ... one='zope.deferredimport.sample1:x', ... two='zope.deferredimport.sample1:C.y', ... ) ... ... three = 3 ... x = 4 ... ... ... def getx(): ... return x ... ''') In this example, we defined the name 'sample1' as the module zope.deferredimport.sample1. The module isn't imported immediately, but will be imported when needed. Similarly, the name 'one' is defined as the 'x' attribute of sample1. The sample1 module prints a message when it is imported. When we import sample2, we don't see a message until we access a variable: .. doctest:: >>> import zope.deferredimport.sample2 >>> print(zope.deferredimport.sample2.one) Sampe 1 imported! 1 >>> import zope.deferredimport.sample1 >>> zope.deferredimport.sample2.sample1 is zope.deferredimport.sample1 True Note that a deferred attribute appears in a module's dictionary *after* it is accessed the first time: .. doctest:: >>> 'two' in zope.deferredimport.sample2.__dict__ False >>> zope.deferredimport.sample2.two 2 >>> 'two' in zope.deferredimport.sample2.__dict__ True When deferred imports are used, the original module is replaced with a proxy. .. doctest:: >>> type(zope.deferredimport.sample2) But we can use the proxy just like the original. We can even update it. .. doctest:: >>> zope.deferredimport.sample2.x=5 >>> zope.deferredimport.sample2.getx() 5 And the inspect module thinks it's a module: .. doctest:: >>> import inspect >>> inspect.ismodule(zope.deferredimport.sample2) True In the example above, the modules were fairly simple. Let's look at a more complicated example. .. doctest:: # >>> create_module(sample3 = ''' # ... # ... import zope.deferredimport # ... import zope.deferredimport.sample4 # ... # ... zope.deferredimport.define( # ... sample1 = 'zope.deferredimport.sample1', # ... one = 'zope.deferredimport.sample1:x', # ... two = 'zope.deferredimport.sample1:C.y', # ... ) # ... # ... x = 1 # ... # ... ''') # >>> create_module(sample4 = ''' # ... import sample3 # ... # ... def getone(): # ... return sample3.one # ... # ... ''') Here, we have a circular import between sample3 and sample4. When sample3 is imported, it imports sample 4, which then imports sample3. Let's see what happens when we use these modules in an unfortunate order: .. code-block:: python # XXX: Relative imports like this are not possible on Python 3 anymore. # PY2 # # >>> import zope.deferredimport.sample3 # >>> import zope.deferredimport.sample4 # # >>> zope.deferredimport.sample4.getone() # Traceback (most recent call last): # ... # AttributeError: 'module' object has no attribute 'one' # #Hm. Let's try accessing one through sample3: # # >>> zope.deferredimport.sample3.one # 1 # #Funny, let's try getone again: # # >>> zope.deferredimport.sample4.getone() # 1 The problem is that sample4 obtained sample3 before sample4 was replaced by a proxy. This example is slightly pathological because it requires a circular import and a relative import, but the bug introduced is very subtle. To guard against this, you should define deferred imports before importing any other modules. Alternatively, you can call the initialize function before importing any other modules, as in: .. doctest:: >>> create_module(sample5 = ''' ... import zope.deferredimport ... zope.deferredimport.initialize() ... ... import zope.deferredimport.sample6 # noqa: E402 import not at top ... ... zope.deferredimport.define( ... sample1='zope.deferredimport.sample1', ... one='zope.deferredimport.sample1:x', ... two='zope.deferredimport.sample1:C.y', ... ) ... ... x = 1 ... ''') >>> create_module(sample6 = ''' ... import zope.deferredimport.sample5 ... ... ... def getone(): ... return zope.deferredimport.sample5.one ... ''') >>> import zope.deferredimport.sample5 >>> import zope.deferredimport.sample6 >>> zope.deferredimport.sample6.getone() 1 Deprecation =========== Deferred attributes can also be marked as deprecated, in which case, a message will be printed the first time they are accessed. Lets define a module that has deprecated attributes defined as deferred imports: .. doctest:: >>> create_module(sample7 = ''' ... import zope.deferredimport ... zope.deferredimport.initialize() ... ... zope.deferredimport.deprecated( ... "Import from sample1 instead", ... x='zope.deferredimport.sample1:x', ... y='zope.deferredimport.sample1:C.y', ... z='zope.deferredimport.sample1:z', ... ) ... ''') Now, if we use one of these variables, we'll get a deprecation warning: .. doctest:: >>> import zope.deferredimport.sample7 >>> zope.deferredimport.sample7.x # doctest: +NORMALIZE_WHITESPACE docs/narrative.rst:1: DeprecationWarning: x is deprecated. Import from sample1 instead ================== 1 but only the first time: .. doctest:: >>> zope.deferredimport.sample7.x 1 Importing multiple names from the same module ============================================= Sometimes, you want to get multiple things from the same module. You can use :func:`~.defineFrom` or :func:`~.deprecatedFrom` to do that: .. doctest:: >>> create_module(sample8 = ''' ... import zope.deferredimport ... ... zope.deferredimport.deprecatedFrom( ... "Import from sample1 instead", ... 'zope.deferredimport.sample1', ... 'x', 'z', 'q', ... ) ... ... zope.deferredimport.defineFrom( ... 'zope.deferredimport.sample9', ... 'a', 'b', 'c', ... ) ... ''') >>> create_module(sample9 = ''' ... print('Imported sample 9') ... a, b, c = range(10, 13) ... ''') >>> import zope.deferredimport.sample8 >>> zope.deferredimport.sample8.q #doctest: +NORMALIZE_WHITESPACE docs/narrative.rst:1: DeprecationWarning: q is deprecated. Import from sample1 instead ================== 4 >>> zope.deferredimport.sample8.c Imported sample 9 12 Note, as in the example above, that you can make multiple deferred-import calls in a module. .. testcleanup:: sys.stderr = oldstderr warnings.warn = oldwarn zope.deferredimport.__path__.pop() for name in created_modules: sys.modules.pop(name, None) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/docs/requirements.txt0000644000076600000240000000000615060743064021347 0ustar00m.howitzstaffSphinx././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/pyproject.toml0000644000076600000240000000121115060743064020046 0ustar00m.howitzstaff# Generated from: # https://github.com/zopefoundation/meta/tree/master/config/pure-python [build-system] requires = [ "setuptools == 78.1.1", "wheel", ] build-backend = "setuptools.build_meta" [tool.coverage.run] branch = true source = ["zope.deferredimport"] [tool.coverage.report] fail_under = 100 precision = 2 ignore_errors = true show_missing = true exclude_lines = [ "pragma: no cover", "pragma: nocover", "except ImportError:", "raise NotImplementedError", "if __name__ == '__main__':", "self.fail", "raise AssertionError", "raise unittest.Skip", ] [tool.coverage.html] directory = "parts/htmlcov" ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757660725.8559237 zope_deferredimport-6.0/setup.cfg0000644000076600000240000000067115060743066016766 0ustar00m.howitzstaff[flake8] doctests = 1 [check-manifest] ignore = .editorconfig .meta.toml docs/_build/html/_sources/* docs/_build/doctest/* [isort] force_single_line = True combine_as_imports = True sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER known_third_party = docutils, pkg_resources, pytz known_zope = known_first_party = default_section = ZOPE line_length = 79 lines_after_imports = 2 [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/setup.py0000644000076600000240000000576215060743064016663 0ustar00m.howitzstaff############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## # This package is developed by the Zope Toolkit project, documented here: # https://zopetoolkit.readthedocs.io/ # When developing and releasing this package, please follow the documented # Zope Toolkit policies as described by this documentation. ############################################################################## """Setup for zope.deferredimport package """ import os from setuptools import setup def read(*rnames): with open(os.path.join(os.path.dirname(__file__), *rnames)) as f: return f.read() TESTS_REQUIRE = [ 'zope.testrunner >= 6.4', ] DOCS_REQUIRE = [ 'Sphinx', 'repoze.sphinx.autointerface', ] setup( name='zope.deferredimport', version='6.0', url='http://github.com/zopefoundation/zope.deferredimport', license='ZPL-2.1', description=('zope.deferredimport allows you to perform imports names ' 'that will only be resolved when used in the code.'), project_urls={ 'Issue Tracker': ('https://github.com/zopefoundation/' 'zope.deferredimport/issues'), 'Sources': 'https://github.com/zopefoundation/zope.deferredimport', }, author='Zope Foundation and Contributors', author_email='zope-dev@zope.dev', long_description=( read('README.rst') + '\n\n' + read('CHANGES.rst') ), classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: Zope Public License', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Natural Language :: English', 'Operating System :: OS Independent', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Software Development', ], python_requires='>=3.9', install_requires=[ 'setuptools', 'zope.proxy', ], extras_require={ 'test': TESTS_REQUIRE, 'docs': DOCS_REQUIRE, }, include_package_data=True, zip_safe=False, ) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757660725.8484402 zope_deferredimport-6.0/src/0000755000076600000240000000000015060743066015730 5ustar00m.howitzstaff././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757660725.8484933 zope_deferredimport-6.0/src/zope/0000755000076600000240000000000015060743066016705 5ustar00m.howitzstaff././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757660725.8535867 zope_deferredimport-6.0/src/zope/deferredimport/0000755000076600000240000000000015060743066021720 5ustar00m.howitzstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/src/zope/deferredimport/__init__.py0000644000076600000240000000061415060743064024030 0ustar00m.howitzstafffrom zope.deferredimport.deferredmodule import define from zope.deferredimport.deferredmodule import defineFrom from zope.deferredimport.deferredmodule import deprecated from zope.deferredimport.deferredmodule import deprecatedFrom from zope.deferredimport.deferredmodule import initialize __all__ = ( 'initialize', 'define', 'defineFrom', 'deprecated', 'deprecatedFrom', ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/src/zope/deferredimport/deferredmodule.py0000644000076600000240000001250115060743064025255 0ustar00m.howitzstaff############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Modules with defered attributes """ import sys import warnings import zope.proxy class Deferred: def __init__(self, name, specifier): self.__name__ = name self.specifier = specifier _import_chicken = {}, {}, ['*'] def get(self): specifier = self.specifier if ':' in specifier: module, name = specifier.split(':') else: module, name = specifier, '' v = __import__(module, *self._import_chicken) if name: for n in name.split('.'): v = getattr(v, n) return v class DeferredAndDeprecated(Deferred): def __init__(self, name, specifier, message): super().__init__(name, specifier) self.message = message def get(self): warnings.warn( self.__name__ + " is deprecated. " + self.message, DeprecationWarning, stacklevel=3) return super().get() class ModuleProxy(zope.proxy.ProxyBase): __slots__ = ('__deferred_definitions__', '__doc__') def __init__(self, module): super().__init__(module) self.__deferred_definitions__ = {} self.__doc__ = module.__doc__ def __getattr__(self, name): try: get = self.__deferred_definitions__[name] except KeyError: raise AttributeError(name) v = get.get() setattr(self, name, v) try: del self.__deferred_definitions__[name] except KeyError: # pragma: no cover pass return v def initialize(level=1): """Prepare a module to support deferred imports. Modules do not need to call this directly, because the `define*` and `deprecated*` functions call it. This is intended to be called from the module to be prepared. The implementation wraps a proxy around the module and replaces the entry in sys.modules with the proxy. It does no harm to call this function more than once for a given module, because this function does not re-wrap a proxied module. The level parameter specifies a relative stack depth. When this function is called directly by the module, level should be 1. When this function is called by a helper function, level should increase with the depth of the stack. Returns nothing when level is 1; otherwise returns the proxied module. """ __name__ = sys._getframe(level).f_globals['__name__'] module = sys.modules[__name__] if type(module) is not ModuleProxy: module = ModuleProxy(module) sys.modules[__name__] = module if level == 1: return return module def define(**names): """Define deferred imports using keyword parameters. Each parameter specifies the importable name and how to import it. Use `module:name` syntax to import a name from a module, or `module` (no colon) to import a module. """ module = initialize(2) __deferred_definitions__ = module.__deferred_definitions__ for name, specifier in names.items(): __deferred_definitions__[name] = Deferred(name, specifier) def defineFrom(from_name, *names): """Define deferred imports from a particular module. The from_name specifies which module to import. The rest of the parameters specify names to import from that module. """ module = initialize(2) __deferred_definitions__ = module.__deferred_definitions__ for name in names: specifier = from_name + ':' + name __deferred_definitions__[name] = Deferred(name, specifier) def deprecated(message, **names): """Define deferred and deprecated imports using keyword parameters. The first use of each name will generate a deprecation warning with the given message. Each parameter specifies the importable name and how to import it. Use `module:name` syntax to import a name from a module, or `module` (no colon) to import a module. """ module = initialize(2) __deferred_definitions__ = module.__deferred_definitions__ for name, specifier in names.items(): __deferred_definitions__[name] = DeferredAndDeprecated( name, specifier, message) def deprecatedFrom(message, from_name, *names): """Define deferred and deprecated imports from a particular module. The first use of each name will generate a deprecation warning with the given message. The from_name specifies which module to import. The rest of the parameters specify names to import from that module. """ module = initialize(2) __deferred_definitions__ = module.__deferred_definitions__ for name in names: specifier = from_name + ':' + name __deferred_definitions__[name] = DeferredAndDeprecated( name, specifier, message) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1757660725.8547952 zope_deferredimport-6.0/src/zope/deferredimport/samples/0000755000076600000240000000000015060743066023364 5ustar00m.howitzstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/src/zope/deferredimport/samples/__init__.py0000644000076600000240000000002215060743064025465 0ustar00m.howitzstaff# Make a package. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/src/zope/deferredimport/samples/sample1.py0000644000076600000240000000010515060743064025272 0ustar00m.howitzstaffprint("Sampe 1 imported!") x = 1 class C: y = 2 z = 3 q = 4 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/src/zope/deferredimport/samples/sample2.py0000644000076600000240000000034615060743064025302 0ustar00m.howitzstaffimport zope.deferredimport zope.deferredimport.define( sample1='zope.deferredimport.sample1', one='zope.deferredimport.sample1:x', two='zope.deferredimport.sample1:C.y', ) three = 3 x = 4 def getx(): return x ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/src/zope/deferredimport/samples/sample5.py0000644000076600000240000000045015060743064025301 0ustar00m.howitzstaffimport zope.deferredimport zope.deferredimport.initialize() import zope.deferredimport.sample6 # noqa: E402 import not at top zope.deferredimport.define( sample1='zope.deferredimport.sample1', one='zope.deferredimport.sample1:x', two='zope.deferredimport.sample1:C.y', ) x = 1 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/src/zope/deferredimport/samples/sample6.py0000644000076600000240000000013615060743064025303 0ustar00m.howitzstaffimport zope.deferredimport.sample5 def getone(): return zope.deferredimport.sample5.one ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/src/zope/deferredimport/samples/sample7.py0000644000076600000240000000037315060743064025307 0ustar00m.howitzstaffimport zope.deferredimport zope.deferredimport.initialize() zope.deferredimport.deprecated( "Import from sample1 instead", x='zope.deferredimport.sample1:x', y='zope.deferredimport.sample1:C.y', z='zope.deferredimport.sample1:z', ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/src/zope/deferredimport/samples/sample8.py0000644000076600000240000000036515060743064025311 0ustar00m.howitzstaffimport zope.deferredimport zope.deferredimport.deprecatedFrom( "Import from sample1 instead", 'zope.deferredimport.sample1', 'x', 'z', 'q', ) zope.deferredimport.defineFrom( 'zope.deferredimport.sample9', 'a', 'b', 'c', ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/src/zope/deferredimport/samples/sample9.py0000644000076600000240000000006315060743064025305 0ustar00m.howitzstaffprint('Imported sample 9') a, b, c = range(10, 13) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/src/zope/deferredimport/tests.py0000644000076600000240000000463615060743064023443 0ustar00m.howitzstaff############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## import unittest class DeferredTests(unittest.TestCase): def _getTargetClass(self): from zope.deferredimport.deferredmodule import Deferred return Deferred def _makeOne(self, *args, **kw): return self._getTargetClass()(*args, **kw) def test_ctor(self): name = 'TESTING' specifier = 'foo:bar' deferred = self._makeOne(name, specifier) self.assertEqual(deferred.__name__, name) self.assertEqual(deferred.specifier, specifier) def test_get_just_module(self): name = 'TESTING' specifier = 'zope.deferredimport.deferredmodule' deferred = self._makeOne(name, specifier) from zope.deferredimport import deferredmodule self.assertIs(deferred.get(), deferredmodule) def test_get_module_and_name(self): name = 'TESTING' specifier = 'zope.deferredimport.deferredmodule:Deferred' deferred = self._makeOne(name, specifier) self.assertIs(deferred.get(), self._getTargetClass()) class TestModuleProxy(unittest.TestCase): def test_getattr_with_no_deferred(self): from zope.deferredimport.deferredmodule import ModuleProxy proxy = ModuleProxy(self) with self.assertRaises(AttributeError): getattr(proxy, 'no_name') def test_preserves_docstring(self): from zope.deferredimport import deferredmodule proxy = deferredmodule.ModuleProxy(deferredmodule) self.assertEqual(deferredmodule.__doc__, proxy.__doc__) def test_preserves_name(self): from zope.deferredimport import deferredmodule proxy = deferredmodule.ModuleProxy(deferredmodule) self.assertEqual(deferredmodule.__name__, proxy.__name__) def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__) ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1757660725.855004 zope_deferredimport-6.0/src/zope.deferredimport.egg-info/0000755000076600000240000000000015060743066023411 5ustar00m.howitzstaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660725.0 zope_deferredimport-6.0/src/zope.deferredimport.egg-info/PKG-INFO0000644000076600000240000001263215060743065024511 0ustar00m.howitzstaffMetadata-Version: 2.4 Name: zope.deferredimport Version: 6.0 Summary: zope.deferredimport allows you to perform imports names that will only be resolved when used in the code. Home-page: http://github.com/zopefoundation/zope.deferredimport Author: Zope Foundation and Contributors Author-email: zope-dev@zope.dev License: ZPL-2.1 Project-URL: Issue Tracker, https://github.com/zopefoundation/zope.deferredimport/issues Project-URL: Sources, https://github.com/zopefoundation/zope.deferredimport Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Software Development Requires-Python: >=3.9 License-File: LICENSE.txt Requires-Dist: setuptools Requires-Dist: zope.proxy Provides-Extra: test Requires-Dist: zope.testrunner>=6.4; extra == "test" Provides-Extra: docs Requires-Dist: Sphinx; extra == "docs" Requires-Dist: repoze.sphinx.autointerface; extra == "docs" Dynamic: author Dynamic: author-email Dynamic: classifier Dynamic: description Dynamic: home-page Dynamic: license Dynamic: license-file Dynamic: project-url Dynamic: provides-extra Dynamic: requires-dist Dynamic: requires-python Dynamic: summary ========================= ``zope.deferredimport`` ========================= .. image:: https://img.shields.io/pypi/v/zope.deferredimport.svg :target: https://pypi.python.org/pypi/zope.deferredimport/ :alt: Latest release .. image:: https://img.shields.io/pypi/pyversions/zope.deferredimport.svg :target: https://pypi.org/project/zope.deferredimport/ :alt: Supported Python versions .. image:: https://github.com/zopefoundation/zope.deferredimport/actions/workflows/tests.yml/badge.svg :target: https://github.com/zopefoundation/zope.deferredimport/actions/workflows/tests.yml .. image:: https://coveralls.io/repos/github/zopefoundation/zope.deferredimport/badge.svg?branch=master :target: https://coveralls.io/github/zopefoundation/zope.deferredimport?branch=master .. image:: https://readthedocs.org/projects/zopedeferredimport/badge/?version=latest :target: http://zopedeferredimport.readthedocs.io/en/latest/ :alt: Documentation Status Often, especially for package modules, you want to import names for convenience, but not actually perform the imports until necessary. The zope.deferredimport package provided facilities for defining names in modules that will be imported from somewhere else when used. You can also cause deprecation warnings to be issued when a variable is used. Documentation is hosted at https://zopedeferredimport.readthedocs.io/ ========= Changes ========= 6.0 (2025-09-12) ================ - Replace ``pkg_resources`` namespace with PEP 420 native namespace. 5.1 (2025-08-11) ================ - Add support for Python 3.12, 3.13. - Drop support for Python 3.7, 3.8. 5.0 (2023-06-29) ================ - Drop support for Python 2.7, 3.5, 3.6. - Add support for Python 3.11. 4.4 (2021-12-10) ================ - Add support for Python 3.8, 3.9 and 3.10. - Drop support for Python 3.4. 4.3.1 (2019-08-05) ================== - Avoid race condition in ``deferredmodule.ModuleProxy.__getattr__`` `#8 `_. 4.3 (2018-10-05) ================ - Add support for Python 3.7. 4.2.1 (2017-10-24) ================== - Preserve the docstrings of proxied modules created with ``deprecatedFrom``, ``deferredFrom``, etc. See `issue 5 `_. 4.2.0 (2017-08-08) ================== - Add support for Python 3.5 and 3.6. - Drop support for Python 2.6 and 3.3. - Convert doctests to Sphinx documentation, including building docs and running doctest snippets under ``tox``. 4.1.0 (2014-12-26) ================== - Add support for PyPy. PyPy3 support is blocked on release of fix for: https://bitbucket.org/pypy/pypy/issue/1946 - Add support for Python 3.4. - Add support for testing on Travis. 4.0.0 (2013-02-28) ================== - Add support for Python 3.3. - Drop support for Python 2.4 and 2.5. 3.5.3 (2010-09-25) ================== - Add test extra to declare test dependency on ``zope.testing``. 3.5.2 (2010-05-24) ================== - Fix unit tests broken under Python 2.4 by the switch to the standard library ``doctest`` module. 3.5.1 (2010-04-30) ================== - Prefer the standard library's ``doctest`` module to the one from ``zope.testing``. 3.5.0 (2009-02-04) ================== - Add support to bootstrap on Jython. - Add reference documentation. 3.4.0 (2007-07-19) ================== - Finish release of ``zope.deferredimport``. 3.4.0b1 (2007-07-09) ==================== - Initial release as a separate project, corresponding to the ``zope.deferredimport`` from Zope 3.4.0b1. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660725.0 zope_deferredimport-6.0/src/zope.deferredimport.egg-info/SOURCES.txt0000644000076600000240000000177315060743065025304 0ustar00m.howitzstaff.pre-commit-config.yaml .readthedocs.yaml CHANGES.rst CONTRIBUTING.md COPYRIGHT.txt LICENSE.txt MANIFEST.in README.rst buildout.cfg pyproject.toml setup.cfg setup.py tox.ini docs/Makefile docs/api.rst docs/conf.py docs/index.rst docs/make.bat docs/narrative.rst docs/requirements.txt src/zope.deferredimport.egg-info/PKG-INFO src/zope.deferredimport.egg-info/SOURCES.txt src/zope.deferredimport.egg-info/dependency_links.txt src/zope.deferredimport.egg-info/not-zip-safe src/zope.deferredimport.egg-info/requires.txt src/zope.deferredimport.egg-info/top_level.txt src/zope/deferredimport/__init__.py src/zope/deferredimport/deferredmodule.py src/zope/deferredimport/tests.py src/zope/deferredimport/samples/__init__.py src/zope/deferredimport/samples/sample1.py src/zope/deferredimport/samples/sample2.py src/zope/deferredimport/samples/sample5.py src/zope/deferredimport/samples/sample6.py src/zope/deferredimport/samples/sample7.py src/zope/deferredimport/samples/sample8.py src/zope/deferredimport/samples/sample9.py././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660725.0 zope_deferredimport-6.0/src/zope.deferredimport.egg-info/dependency_links.txt0000644000076600000240000000000115060743065027456 0ustar00m.howitzstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660725.0 zope_deferredimport-6.0/src/zope.deferredimport.egg-info/not-zip-safe0000644000076600000240000000000115060743065025636 0ustar00m.howitzstaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660725.0 zope_deferredimport-6.0/src/zope.deferredimport.egg-info/requires.txt0000644000076600000240000000013615060743065026010 0ustar00m.howitzstaffsetuptools zope.proxy [docs] Sphinx repoze.sphinx.autointerface [test] zope.testrunner>=6.4 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660725.0 zope_deferredimport-6.0/src/zope.deferredimport.egg-info/top_level.txt0000644000076600000240000000000515060743065026135 0ustar00m.howitzstaffzope ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1757660724.0 zope_deferredimport-6.0/tox.ini0000644000076600000240000000354215060743064016456 0ustar00m.howitzstaff# Generated from: # https://github.com/zopefoundation/meta/tree/master/config/pure-python [tox] minversion = 3.18 envlist = release-check lint py39 py310 py311 py312 py313 pypy3 docs coverage [testenv] usedevelop = true package = wheel wheel_build_env = .pkg deps = setuptools == 78.1.1 commands = zope-testrunner --test-path=src {posargs:-vc} sphinx-build -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest extras = test docs [testenv:setuptools-latest] basepython = python3 deps = git+https://github.com/pypa/setuptools.git\#egg=setuptools [testenv:release-check] description = ensure that the distribution is ready to release basepython = python3 skip_install = true deps = setuptools == 78.1.1 wheel twine build check-manifest check-python-versions >= 0.20.0 wheel commands_pre = commands = check-manifest check-python-versions --only setup.py,tox.ini,.github/workflows/tests.yml python -m build --sdist --no-isolation twine check dist/* [testenv:lint] description = This env runs all linters configured in .pre-commit-config.yaml basepython = python3 skip_install = true deps = pre-commit commands_pre = commands = pre-commit run --all-files --show-diff-on-failure [testenv:docs] basepython = python3 skip_install = false commands_pre = commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest [testenv:coverage] basepython = python3 allowlist_externals = mkdir deps = coverage[toml] commands = mkdir -p {toxinidir}/parts/htmlcov coverage run -m zope.testrunner --test-path=src {posargs:-vc} coverage run -a -m sphinx -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest coverage html coverage report