77import sys
88import warnings
99from contextlib import contextmanager
10- from functools import partial , wraps
1110from importlib .metadata import version as pkgversion
1211from pathlib import Path
13- from random import sample
14- from tempfile import gettempdir
15- from typing import TYPE_CHECKING , Any , Callable
12+ from typing import TYPE_CHECKING
1613
1714from duty import duty , tools
1815from pysource_codegen import generate
@@ -42,21 +39,6 @@ def _pyprefix(title: str) -> str:
4239 return title
4340
4441
45- def _not_from_insiders (func : Callable ) -> Callable :
46- @wraps (func )
47- def wrapper (ctx : Context , * args : Any , ** kwargs : Any ) -> None :
48- origin = ctx .run ("git config --get remote.origin.url" , silent = True )
49- if "pawamoy-insiders/griffe" in origin :
50- ctx .run (
51- lambda : False ,
52- title = "Not running this task from insiders repository (do that from public repo instead!)" ,
53- )
54- return
55- func (ctx , * args , ** kwargs )
56-
57- return wrapper
58-
59-
6042@contextmanager
6143def _material_insiders () -> Iterator [bool ]:
6244 if "+insiders" in pkgversion ("mkdocs-material" ):
@@ -336,45 +318,20 @@ def docs(ctx: Context, *cli_args: str, host: str = "127.0.0.1", port: int = 8000
336318
337319
338320@duty
339- def docs_deploy (ctx : Context , * , force : bool = False ) -> None :
321+ def docs_deploy (ctx : Context ) -> None :
340322 """Deploy the documentation to GitHub pages.
341323
342324 ```bash
343325 make docs-deploy
344326 ```
345327
346328 Use [MkDocs](https://www.mkdocs.org/) to build and deploy the documentation to GitHub pages.
347-
348- Parameters:
349- force: Whether to force deployment, even from non-Insiders version.
350329 """
351330 os .environ ["DEPLOY" ] = "true"
352331 with _material_insiders () as insiders :
353332 if not insiders :
354333 ctx .run (lambda : False , title = "Not deploying docs without Material for MkDocs Insiders!" )
355- origin = ctx .run ("git config --get remote.origin.url" , silent = True , allow_overrides = False )
356- if "pawamoy-insiders/griffe" in origin :
357- ctx .run (
358- "git remote add upstream git@github.com:mkdocstrings/griffe" ,
359- silent = True ,
360- nofail = True ,
361- allow_overrides = False ,
362- )
363- ctx .run (
364- tools .mkdocs .gh_deploy (remote_name = "upstream" , force = True ),
365- title = "Deploying documentation" ,
366- )
367- elif force :
368- ctx .run (
369- tools .mkdocs .gh_deploy (force = True ),
370- title = "Deploying documentation" ,
371- )
372- else :
373- ctx .run (
374- lambda : False ,
375- title = "Not deploying docs from public repository (do that from insiders instead!)" ,
376- nofail = True ,
377- )
334+ ctx .run (tools .mkdocs .gh_deploy (), title = "Deploying documentation" )
378335
379336
380337@duty
@@ -416,7 +373,6 @@ def build(ctx: Context) -> None:
416373
417374
418375@duty
419- @_not_from_insiders
420376def publish (ctx : Context ) -> None :
421377 """Publish source and wheel distributions to PyPI.
422378
@@ -438,7 +394,6 @@ def publish(ctx: Context) -> None:
438394
439395
440396@duty (post = ["build" , "publish" , "docs-deploy" ])
441- @_not_from_insiders
442397def release (ctx : Context , version : str = "" ) -> None :
443398 """Release a new version of the project.
444399
0 commit comments