Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: initialize documentation #129

Merged
merged 27 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -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 }}
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions ape_vyper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extensions = ["sphinx_ape"]
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. dynamic-toc-tree::
6 changes: 6 additions & 0 deletions docs/methoddocs/compiler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Compiler

```{eval-rst}
.. automodule:: ape_vyper.compiler
:members:
```
6 changes: 6 additions & 0 deletions docs/methoddocs/exceptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Exceptions

```{eval-rst}
.. automodule:: ape_vyper.exceptions
:members:
```
6 changes: 6 additions & 0 deletions docs/methoddocs/interface.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Interface

```{eval-rst}
.. automodule:: ape_vyper.interface
:members:
```
2 changes: 2 additions & 0 deletions docs/userguides/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../../README.md
```
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 15 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Loading