diff --git a/certbot-apache/certbot_apache/configurator.py b/certbot-apache/certbot_apache/configurator.py index 3868451f5..6ff7d328e 100644 --- a/certbot-apache/certbot_apache/configurator.py +++ b/certbot-apache/certbot_apache/configurator.py @@ -2345,7 +2345,7 @@ class ApacheConfigurator(common.Installer): Enable the AutoHSTS enhancement for defined domains :param _unused_lineage: Certificate lineage object, unused - :type _unused_lineage: certbot.storage.RenewableCert + :type _unused_lineage: certbot._internal.storage.RenewableCert :param domains: List of domains in certificate to enhance :type domains: str @@ -2470,7 +2470,7 @@ class ApacheConfigurator(common.Installer): and changes the HSTS max-age to a high value. :param lineage: Certificate lineage object - :type lineage: certbot.storage.RenewableCert + :type lineage: certbot._internal.storage.RenewableCert """ self._autohsts_fetch_state() if not self._autohsts: diff --git a/certbot-nginx/local-oldest-requirements.txt b/certbot-nginx/local-oldest-requirements.txt index a959ad44f..3192f8360 100644 --- a/certbot-nginx/local-oldest-requirements.txt +++ b/certbot-nginx/local-oldest-requirements.txt @@ -1,3 +1,3 @@ # Remember to update setup.py to match the package versions below. -acme[dev]==0.29.0 -certbot[dev]==0.36.0 +-e acme[dev] +-e .[dev] diff --git a/certbot-nginx/setup.py b/certbot-nginx/setup.py index f3f0b6640..50febc33a 100644 --- a/certbot-nginx/setup.py +++ b/certbot-nginx/setup.py @@ -9,8 +9,8 @@ version = '1.0.0.dev0' # Remember to update local-oldest-requirements.txt when changing the minimum # acme/certbot version. install_requires = [ - 'acme>=0.29.0', - 'certbot>=0.35.0', + 'acme>=1.0.0.dev0', + 'certbot>=1.0.0.dev0', 'mock', 'PyOpenSSL', 'pyparsing>=1.5.5', # Python3 support; perhaps unnecessary? diff --git a/certbot/_internal/__init__.py b/certbot/_internal/__init__.py new file mode 100644 index 000000000..45ec6ac9c --- /dev/null +++ b/certbot/_internal/__init__.py @@ -0,0 +1,6 @@ +""" +Modules internal to Certbot. + +This package contains modules that are not considered part of Certbot's public +API. They may be changed without updating Certbot's major version. +""" diff --git a/certbot/account.py b/certbot/_internal/account.py similarity index 100% rename from certbot/account.py rename to certbot/_internal/account.py diff --git a/certbot/auth_handler.py b/certbot/_internal/auth_handler.py similarity index 99% rename from certbot/auth_handler.py rename to certbot/_internal/auth_handler.py index a8c8f6e9b..5c037e8dc 100644 --- a/certbot/auth_handler.py +++ b/certbot/_internal/auth_handler.py @@ -13,7 +13,7 @@ from acme.magic_typing import Dict, List, Tuple # pylint: enable=unused-import, no-name-in-module from certbot import achallenges from certbot import errors -from certbot import error_handler +from certbot._internal import error_handler from certbot import interfaces logger = logging.getLogger(__name__) @@ -29,7 +29,7 @@ class AuthHandler(object): :ivar acme.client.BackwardsCompatibleClientV2 acme_client: ACME client API. :ivar account: Client's Account - :type account: :class:`certbot.account.Account` + :type account: :class:`certbot._internal.account.Account` :ivar list pref_challs: sorted user specified preferred challenges type strings with the most preferred challenge listed first diff --git a/certbot/cert_manager.py b/certbot/_internal/cert_manager.py similarity index 99% rename from certbot/cert_manager.py rename to certbot/_internal/cert_manager.py index cd228ac12..ed72b12e5 100644 --- a/certbot/cert_manager.py +++ b/certbot/_internal/cert_manager.py @@ -12,8 +12,8 @@ from acme.magic_typing import List # pylint: disable=unused-import, no-name-in- from certbot import crypto_util from certbot import errors from certbot import interfaces -from certbot import ocsp -from certbot import storage +from certbot._internal import ocsp +from certbot._internal import storage from certbot import util from certbot.compat import os from certbot.display import util as display_util diff --git a/certbot/client.py b/certbot/_internal/client.py similarity index 99% rename from certbot/client.py rename to certbot/_internal/client.py index 91b54b205..7a0daf77b 100644 --- a/certbot/client.py +++ b/certbot/_internal/client.py @@ -18,16 +18,16 @@ from acme import messages from acme.magic_typing import Optional, List # pylint: disable=unused-import,no-name-in-module import certbot -from certbot import account -from certbot import auth_handler +from certbot._internal import account +from certbot._internal import auth_handler from certbot import cli from certbot import constants from certbot import crypto_util from certbot import eff -from certbot import error_handler +from certbot._internal import error_handler from certbot import errors from certbot import interfaces -from certbot import storage +from certbot._internal import storage from certbot import util from certbot.compat import os from certbot.display import enhancements @@ -408,7 +408,7 @@ class Client(object): :param certname: requested name of lineage :type certname: `str` or `None` - :returns: A new :class:`certbot.storage.RenewableCert` instance + :returns: A new :class:`certbot._internal.storage.RenewableCert` instance referred to the enrolled cert lineage, False if the cert could not be obtained, or None if doing a successful dry run. diff --git a/certbot/error_handler.py b/certbot/_internal/error_handler.py similarity index 100% rename from certbot/error_handler.py rename to certbot/_internal/error_handler.py diff --git a/certbot/lock.py b/certbot/_internal/lock.py similarity index 100% rename from certbot/lock.py rename to certbot/_internal/lock.py diff --git a/certbot/main.py b/certbot/_internal/main.py similarity index 99% rename from certbot/main.py rename to certbot/_internal/main.py index 620e33be9..1552131e8 100644 --- a/certbot/main.py +++ b/certbot/_internal/main.py @@ -14,10 +14,10 @@ from acme import errors as acme_errors from acme.magic_typing import Union # pylint: disable=unused-import, no-name-in-module import certbot -from certbot import account -from certbot import cert_manager +from certbot._internal import account +from certbot._internal import cert_manager from certbot import cli -from certbot import client +from certbot._internal import client from certbot import configuration from certbot import constants from certbot import crypto_util @@ -26,10 +26,10 @@ from certbot import errors from certbot import hooks from certbot import interfaces from certbot import log -from certbot import renewal -from certbot import reporter -from certbot import storage -from certbot import updater +from certbot._internal import renewal +from certbot._internal import reporter +from certbot._internal import storage +from certbot._internal import updater from certbot import util from certbot.compat import filesystem from certbot.compat import misc @@ -483,7 +483,7 @@ def _determine_account(config): :returns: Account and optionally ACME client API (biproduct of new registration). - :rtype: tuple of :class:`certbot.account.Account` and :class:`acme.client.Client` + :rtype: tuple of :class:`certbot._internal.account.Account` and :class:`acme.client.Client` :raises errors.Error: If unable to register an account with ACME server diff --git a/certbot/notify.py b/certbot/_internal/notify.py similarity index 100% rename from certbot/notify.py rename to certbot/_internal/notify.py diff --git a/certbot/ocsp.py b/certbot/_internal/ocsp.py similarity index 99% rename from certbot/ocsp.py rename to certbot/_internal/ocsp.py index 1cc1e7529..2a63412a0 100644 --- a/certbot/ocsp.py +++ b/certbot/_internal/ocsp.py @@ -22,7 +22,7 @@ import requests from acme.magic_typing import Optional, Tuple # pylint: disable=unused-import, no-name-in-module from certbot import crypto_util from certbot import errors -from certbot.storage import RenewableCert # pylint: disable=unused-import +from certbot._internal.storage import RenewableCert # pylint: disable=unused-import from certbot import util logger = logging.getLogger(__name__) diff --git a/certbot/renewal.py b/certbot/_internal/renewal.py similarity index 99% rename from certbot/renewal.py rename to certbot/_internal/renewal.py index b9b45ee40..c11e675c1 100644 --- a/certbot/renewal.py +++ b/certbot/_internal/renewal.py @@ -20,8 +20,8 @@ from certbot import crypto_util from certbot import errors from certbot import hooks from certbot import interfaces -from certbot import storage -from certbot import updater +from certbot._internal import storage +from certbot._internal import updater from certbot import util from certbot.compat import os from certbot.plugins import disco as plugins_disco @@ -429,7 +429,7 @@ def handle_renewal_request(config): # pylint: disable=too-many-locals,too-many- # XXX: ensure that each call here replaces the previous one zope.component.provideUtility(lineage_config) renewal_candidate.ensure_deployed() - from certbot import main + from certbot._internal import main plugins = plugins_disco.PluginsRegistry.find_all() if should_renew(lineage_config, renewal_candidate): # Apply random sleep upon first renewal if needed diff --git a/certbot/reporter.py b/certbot/_internal/reporter.py similarity index 100% rename from certbot/reporter.py rename to certbot/_internal/reporter.py diff --git a/certbot/storage.py b/certbot/_internal/storage.py similarity index 99% rename from certbot/storage.py rename to certbot/_internal/storage.py index 9bf85fa0f..f19efe728 100644 --- a/certbot/storage.py +++ b/certbot/_internal/storage.py @@ -15,7 +15,7 @@ import certbot from certbot import cli from certbot import constants from certbot import crypto_util -from certbot import error_handler +from certbot._internal import error_handler from certbot import errors from certbot import util from certbot.compat import os @@ -248,7 +248,7 @@ def _relevant(namespaces, option): :rtype: bool """ - from certbot import renewal + from certbot._internal import renewal return (option in renewal.CONFIG_ITEMS or any(option.startswith(namespace) for namespace in namespaces)) diff --git a/certbot/updater.py b/certbot/_internal/updater.py similarity index 100% rename from certbot/updater.py rename to certbot/_internal/updater.py diff --git a/certbot/cli.py b/certbot/cli.py index 9b116fe3f..7f09f4638 100644 --- a/certbot/cli.py +++ b/certbot/cli.py @@ -438,7 +438,7 @@ class HelpfulArgumentParser(object): def __init__(self, args, plugins, detect_defaults=False): - from certbot import main + from certbot._internal import main self.VERBS = { "auth": main.certonly, "certonly": main.certonly, @@ -1256,7 +1256,7 @@ def prepare_and_parse_args(plugins, args, detect_defaults=False): # pylint: dis def _create_subparsers(helpful): - from certbot.client import sample_user_agent # avoid import loops + from certbot._internal.client import sample_user_agent # avoid import loops helpful.add( None, "--user-agent", default=flag_default("user_agent"), help='Set a custom user agent string for the client. User agent strings allow ' diff --git a/certbot/display/ops.py b/certbot/display/ops.py index b5f3655fe..1a36744a5 100644 --- a/certbot/display/ops.py +++ b/certbot/display/ops.py @@ -75,7 +75,7 @@ def choose_account(accounts): """Choose an account. :param list accounts: Containing at least one - :class:`~certbot.account.Account` + :class:`~certbot._internal.account.Account` """ # Note this will get more complicated once we start recording authorizations diff --git a/certbot/plugins/common_test.py b/certbot/plugins/common_test.py index cdcde2c76..8fa642ced 100644 --- a/certbot/plugins/common_test.py +++ b/certbot/plugins/common_test.py @@ -178,7 +178,7 @@ class InstallerTest(test_util.ConfigTestCase): class AddrTest(unittest.TestCase): - """Tests for certbot.client.plugins.common.Addr.""" + """Tests for certbot._internal.client.plugins.common.Addr.""" def setUp(self): from certbot.plugins.common import Addr diff --git a/certbot/plugins/enhancements.py b/certbot/plugins/enhancements.py index 7ca096610..353ff44d5 100644 --- a/certbot/plugins/enhancements.py +++ b/certbot/plugins/enhancements.py @@ -51,7 +51,7 @@ def enable(lineage, domains, installer, config): Run enable method for each requested enhancement that is supported. :param lineage: Certificate lineage object - :type lineage: certbot.storage.RenewableCert + :type lineage: certbot._internal.storage.RenewableCert :param domains: List of domains in certificate to enhance :type domains: str @@ -112,7 +112,7 @@ class AutoHSTSEnhancement(object): Implementation of this method should increase the max-age value. :param lineage: Certificate lineage object - :type lineage: certbot.storage.RenewableCert + :type lineage: certbot._internal.storage.RenewableCert .. note:: prepare() method inherited from `interfaces.IPlugin` might need to be called manually within implementation of this interface method @@ -126,7 +126,7 @@ class AutoHSTSEnhancement(object): Long max-age value should be set in implementation of this method. :param lineage: Certificate lineage object - :type lineage: certbot.storage.RenewableCert + :type lineage: certbot._internal.storage.RenewableCert """ @abc.abstractmethod @@ -137,7 +137,7 @@ class AutoHSTSEnhancement(object): over the subsequent runs of Certbot renew. :param lineage: Certificate lineage object - :type lineage: certbot.storage.RenewableCert + :type lineage: certbot._internal.storage.RenewableCert :param domains: List of domains in certificate to enhance :type domains: str diff --git a/certbot/tests/account_test.py b/certbot/tests/account_test.py index cad103052..29ec4fc33 100644 --- a/certbot/tests/account_test.py +++ b/certbot/tests/account_test.py @@ -1,4 +1,4 @@ -"""Tests for certbot.account.""" +"""Tests for certbot._internal.account.""" import datetime import json import unittest @@ -19,10 +19,10 @@ KEY = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem")) class AccountTest(unittest.TestCase): - """Tests for certbot.account.Account.""" + """Tests for certbot._internal.account.Account.""" def setUp(self): - from certbot.account import Account + from certbot._internal.account import Account self.regr = mock.MagicMock() self.meta = Account.Meta( creation_host="test.certbot.org", @@ -31,9 +31,9 @@ class AccountTest(unittest.TestCase): self.acc = Account(self.regr, KEY, self.meta) self.regr.__repr__ = mock.MagicMock(return_value="i_am_a_regr") - with mock.patch("certbot.account.socket") as mock_socket: + with mock.patch("certbot._internal.account.socket") as mock_socket: mock_socket.getfqdn.return_value = "test.certbot.org" - with mock.patch("certbot.account.datetime") as mock_dt: + with mock.patch("certbot._internal.account.datetime") as mock_dt: mock_dt.datetime.now.return_value = self.meta.creation_dt self.acc_no_meta = Account(self.regr, KEY) @@ -55,18 +55,18 @@ class AccountTest(unittest.TestCase): "