Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

feat!: Handle 0.7 breaking changes and updates [APE-1554] #50

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion .mdformat.toml

This file was deleted.

10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.5.0
hooks:
- id: check-yaml

Expand All @@ -10,24 +10,24 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.12.0
hooks:
- id: black
name: black

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
rev: v1.7.1
hooks:
- id: mypy
additional_dependencies: [types-setuptools, pydantic==1.10.4]

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
rev: 0.7.17
hooks:
- id: mdformat
additional_dependencies: [mdformat-gfm, mdformat-frontmatter]
Expand Down
10 changes: 5 additions & 5 deletions ape_cairo/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import shutil
import subprocess
from pathlib import Path
from typing import Dict, List, Optional, Set, Tuple, cast
from typing import Dict, List, Optional, Sequence, Set, Tuple, cast

from ape.api import CompilerAPI, PluginConfig
from ape.exceptions import CompilerError, ConfigError
from ape.logging import logger
from ape.utils import get_relative_path
from eth_utils import to_hex
from ethpm_types import ContractType, PackageManifest
from semantic_version import Version # type: ignore
from packaging.version import Version # type: ignore

STARKNET_COMPILE = "starknet-compile"
STARKNET_SIERRA_COMPILE = "starknet-sierra-compile"
Expand Down Expand Up @@ -138,7 +138,7 @@ def starknet_sierra_compile(
return _compile(*arguments)

def get_compiler_settings(
self, contract_filepaths: List[Path], base_path: Optional[Path] = None
self, contract_filepaths: Sequence[Path], base_path: Optional[Path] = None
) -> Dict[Version, Dict]:
settings: Dict[Version, Dict] = {}
for version in self.get_versions(contract_filepaths):
Expand Down Expand Up @@ -223,14 +223,14 @@ def load_dependencies(self, base_path: Optional[Path] = None):
destination_path.touch()
destination_path.write_text(source.content)

def get_versions(self, all_paths: List[Path]) -> Set[str]:
def get_versions(self, all_paths: Sequence[Path]) -> Set[str]:
if not all_paths:
return set()

return {"v1.0.0-alpha.7"}

def compile(
self, contract_filepaths: List[Path], base_path: Optional[Path] = None
self, contract_filepaths: Sequence[Path], base_path: Optional[Path] = None
) -> List[ContractType]:
base_path = base_path or self.project_manager.contracts_folder

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ force_grid_wrap = 0
include_trailing_comma = true
multi_line_output = 3
use_parentheses = true

21 changes: 12 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@
extras_require = {
"test": [ # `test` GitHub Action jobs uses this
"pytest>=6.0,<8", # Core testing package
"pytest-xdist", # multi-process runner
"pytest-xdist", # Multi-process runner
"pytest-cov", # Coverage analyzer plugin
"hypothesis>=6.70,<7.0", # Strategy-based fuzzer
],
"lint": [
"black>=23.3.0", # auto-formatter and linter
"mypy>=0.991,<1", # Static type analyzer
"types-setuptools", # Needed due to mypy typeshed
"flake8>=6.0.0,<7", # Style linter
"black>=23.11.0,<24", # Auto-formatter and linter
"mypy>=1.7.1,<2", # Static type analyzer
"types-setuptools", # Needed for mypy type shed
"flake8>=6.1.0,<7", # Style linter
"flake8-breakpoint>=1.1.0,<2", # Detect breakpoints left in code
"flake8-print>=5.0.0,<6", # Detect print statements left in code
"isort>=5.10.1,<6", # Import sorting linter
"mdformat>=0.7.16,<0.8", # Auto-formatter for markdown
"mdformat-gfm>=0.3.5,<0.4", # Needed for formatting GitHub-flavored markdown
"mdformat-frontmatter>=0.4.1,<0.5", # Needed for headers in GH issue templates
"mdformat>=0.7.17", # Auto-formatter for markdown
"mdformat-gfm>=0.3.5", # Needed for formatting GitHub-flavored markdown
"mdformat-frontmatter>=0.4.1", # Needed for frontmatters-style headers in issue templates
"mdformat-pyproject>=0.0.1", # Allows configuring in pyproject.toml
],
"release": [ # `release` GitHub Action job uses this
"setuptools", # Installation tool
Expand Down Expand Up @@ -57,7 +60,7 @@
url="https://github.com/ApeWorX/ape-cairo",
include_package_data=True,
install_requires=[
"eth-ape>=0.6.8,<0.7",
"eth-ape>=0.7.0,<0.8",
"ethpm-types", # Use same version as eth-ape
],
python_requires=">=3.8,<4",
Expand Down
Loading