diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..9740b2b --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,32 @@ +name: Docs + +on: + push: + branches: [main] + release: + types: [released] + pull_request: + types: [opened, synchronize] + +jobs: + docs: + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # NOTE: This also serves as a test for the action. + - name: Docs + uses: apeworx/sphinx-ape@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3b654d3..59b951b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,6 +32,34 @@ pre-commit install Committing will now automatically run the local hooks and ensure that your commit passes all lint checks. +## Running the docs locally + +First, make sure you have the docs-related tooling installed: + +```bash +pip install -e .'[doc]' +``` + +Then, run the following from the root project directory: + +```bash +sphinx-ape build . +``` + +For the best viewing experience, use a local server: + +```bash +sphinx-ape serve . +``` + +Then, open your browser to `127.0.0.1:1337` and click the `ape` directory link. + +You can also use the `--open` flag to automatically open the docs: + +```bash +sphinx-ape serve . --open +``` + ## Pull Requests Pull requests are welcomed! Please adhere to the following: diff --git a/ape_vyper/__init__.py b/ape_vyper/__init__.py index ebd7db4..d1037e8 100644 --- a/ape_vyper/__init__.py +++ b/ape_vyper/__init__.py @@ -11,3 +11,10 @@ def config_class(): @plugins.register(plugins.CompilerPlugin) def register_compiler(): return tuple(e.value for e in FileType), VyperCompiler + + +__all__ = [ + "FileType", + "VyperCompiler", + "VyperConfig", +] diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..9181c1d --- /dev/null +++ b/docs/conf.py @@ -0,0 +1 @@ +extensions = ["sphinx_ape"] diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..b559066 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1 @@ +.. dynamic-toc-tree:: diff --git a/docs/methoddocs/compiler.md b/docs/methoddocs/compiler.md new file mode 100644 index 0000000..aed2379 --- /dev/null +++ b/docs/methoddocs/compiler.md @@ -0,0 +1,6 @@ +# Compiler + +```{eval-rst} +.. automodule:: ape_vyper.compiler + :members: +``` diff --git a/docs/methoddocs/exceptions.md b/docs/methoddocs/exceptions.md new file mode 100644 index 0000000..5bc2108 --- /dev/null +++ b/docs/methoddocs/exceptions.md @@ -0,0 +1,6 @@ +# Exceptions + +```{eval-rst} +.. automodule:: ape_vyper.exceptions + :members: +``` diff --git a/docs/methoddocs/interface.md b/docs/methoddocs/interface.md new file mode 100644 index 0000000..49d1854 --- /dev/null +++ b/docs/methoddocs/interface.md @@ -0,0 +1,6 @@ +# Interface + +```{eval-rst} +.. automodule:: ape_vyper.interface + :members: +``` diff --git a/docs/userguides/quickstart.md b/docs/userguides/quickstart.md new file mode 100644 index 0000000..c7719d8 --- /dev/null +++ b/docs/userguides/quickstart.md @@ -0,0 +1,2 @@ +```{include} ../../README.md +``` diff --git a/setup.py b/setup.py index 2870aa1..641703a 100644 --- a/setup.py +++ b/setup.py @@ -21,6 +21,7 @@ "mdformat-frontmatter>=0.4.1", # Needed for frontmatters-style headers in issue templates "mdformat-pyproject>=0.0.1", # Allows configuring in pyproject.toml ], + "doc": ["sphinx-ape"], "release": [ # `release` GitHub Action job uses this "setuptools", # Installation tool "wheel", # Packaging tool diff --git a/tests/conftest.py b/tests/conftest.py index e2ce182..8c8c7de 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,6 +7,7 @@ import pytest import vvm # type: ignore from ape.contracts import ContractContainer +from ape.logging import LogLevel, logger from ape.utils import create_tempdir from click.testing import CliRunner @@ -41,6 +42,14 @@ } +@pytest.fixture(scope="session", autouse=True) +def set_loglevel(): + """ + This keeps the pytest output more relevant. + """ + logger.set_level(LogLevel.WARNING) + + @pytest.fixture(scope="session", autouse=True) def from_tests_dir(): # Makes default project correct. @@ -208,11 +217,14 @@ def cli_runner(): def _get_tb_contract(version: str, project, account): - project.load_contracts() - registry_type = project.get_contract(f"registry_{version}") assert isinstance(registry_type, ContractContainer), "Setup failed - couldn't get container" registry = account.deploy(registry_type) contract = project.get_contract(f"traceback_contract_{version}") + + # Workaround until https://github.com/ApeWorX/ape/pull/2270 is released. + # Use a different account. + account2 = ape.accounts.test_accounts[1] + assert isinstance(contract, ContractContainer), "Setup failed - couldn't get container" - return account.deploy(contract, registry) + return account2.deploy(contract, registry)