Skip to content

Commit 4612323

Browse files
committed
Project structure nad basic checks
1 parent 0054dfe commit 4612323

File tree

8 files changed

+1966
-1
lines changed

8 files changed

+1966
-1
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Lint and type checks
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
lint_and_type_checks:
8+
name: Lint and type checks
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: ["3.12"]
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Install dependencies
24+
run: make install-dev
25+
26+
- name: Run lint
27+
run: make lint
28+
29+
- name: Run type checks
30+
run: make type-check

.github/workflows/run_checks.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Code quality checks
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
8+
jobs:
9+
lint_and_type_checks:
10+
name: Run lint and type checks
11+
uses: ./.github/workflows/lint_and_type_checks.yaml

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.idea
2+
.DS_Store
3+
.vscode
4+
5+
apify_storage
6+
storage
7+
8+
.venv/
9+
.env/
10+
__pypackages__
11+
dist/
12+
build/
13+
*.egg-info/
14+
*.egg
15+
16+
__pycache__
17+
18+
.mypy_cache
19+
.dmypy.json
20+
dmypy.json
21+
.pytest_cache
22+
.ruff_cache
23+
24+
.scrapy
25+
*.log
26+
27+
# Added by Apify CLI
28+
node_modules
29+
.venv

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.PHONY: clean install-dev lint type-check check-code format
2+
3+
DIRS_WITH_CODE = src
4+
5+
clean:
6+
rm -rf .venv .mypy_cache .pytest_cache .ruff_cache __pycache__
7+
8+
install-dev:
9+
python3 -m pip install --upgrade pip poetry
10+
poetry install --no-root
11+
12+
lint:
13+
poetry run ruff check $(DIRS_WITH_CODE)
14+
15+
type-check:
16+
poetry run mypy $(DIRS_WITH_CODE)
17+
18+
check-code: lint type-check
19+
20+
format:
21+
poetry run ruff check --fix $(DIRS_WITH_CODE)
22+
poetry run ruff format $(DIRS_WITH_CODE)

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
# actor-RexScraper
1+
# actor-RexScraper
2+
3+
Very simple Apify based product scraper for https://somosrex.com/

poetry.lock

Lines changed: 1779 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
[tool.poetry]
2+
name = "actor-rexscraper"
3+
version = "0.1.0"
4+
description = ""
5+
authors = ["Josef Prochazka <[email protected]>"]
6+
readme = "README.md"
7+
8+
[tool.poetry.dependencies]
9+
python = "^3.12"
10+
setuptools = "^75.3.0"
11+
apify = "^2.0.1"
12+
13+
14+
[tool.poetry.group.dev.dependencies]
15+
mypy = "^1.13.0"
16+
ruff = "^0.7.2"
17+
18+
[build-system]
19+
requires = ["poetry-core"]
20+
build-backend = "poetry.core.masonry.api"
21+
22+
23+
[tool.ruff]
24+
line-length = 120
25+
26+
[tool.ruff.lint]
27+
select = ["ALL"]
28+
ignore = [
29+
"ANN101", # Missing type annotation for `self` in method
30+
"ANN102", # Missing type annotation for `{name}` in classmethod
31+
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {filename}
32+
"ASYNC109", # Async function definition with a `timeout` parameter
33+
"BLE001", # Do not catch blind exception
34+
"C901", # `{name}` is too complex
35+
"COM812", # This rule may cause conflicts when used with the formatter
36+
"D100", # Missing docstring in public module
37+
"D104", # Missing docstring in public package
38+
"D107", # Missing docstring in `__init__`
39+
"EM", # flake8-errmsg
40+
"G004", # Logging statement uses f-string
41+
"ISC001", # This rule may cause conflicts when used with the formatter
42+
"FIX", # flake8-fixme
43+
"PGH003", # Use specific rule codes when ignoring type issues
44+
"PLR0911", # Too many return statements
45+
"PLR0913", # Too many arguments in function definition
46+
"PLR0915", # Too many statements
47+
"PTH", # flake8-use-pathlib
48+
"PYI034", # `__aenter__` methods in classes like `{name}` usually return `self` at runtime
49+
"PYI036", # The second argument in `__aexit__` should be annotated with `object` or `BaseException | None`
50+
"S102", # Use of `exec` detected
51+
"S105", # Possible hardcoded password assigned to
52+
"S106", # Possible hardcoded password assigned to argument: "{name}"
53+
"S301", # `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
54+
"S303", # Use of insecure MD2, MD4, MD5, or SHA1 hash function
55+
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
56+
"TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...
57+
"TRY003", # Avoid specifying long messages outside the exception class
58+
]
59+
60+
[tool.ruff.format]
61+
quote-style = "single"
62+
indent-style = "space"
63+
64+
[tool.ruff.lint.flake8-quotes]
65+
docstring-quotes = "double"
66+
inline-quotes = "single"
67+
68+
[tool.ruff.lint.pydocstyle]
69+
convention = "google"
70+
71+
[tool.ruff.lint.isort]
72+
known-first-party = ["apify"]
73+
74+
[tool.pytest.ini_options]
75+
addopts = "-ra"
76+
asyncio_mode = "auto"
77+
timeout = 1200
78+
79+
[tool.mypy]
80+
python_version = "3.12"
81+
plugins = ["pydantic.mypy"]
82+
files = ["src"]
83+
check_untyped_defs = true
84+
disallow_incomplete_defs = true
85+
disallow_untyped_calls = true
86+
disallow_untyped_decorators = true
87+
disallow_untyped_defs = true
88+
no_implicit_optional = true
89+
warn_redundant_casts = true
90+
warn_return_any = true
91+
warn_unreachable = true
92+
warn_unused_ignores = true

src/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)