Skip to content

Commit dbb5845

Browse files
authored
Merge pull request #8 from aahnik/aahnik-patch-1
Packaging, code quality, testing, CI, contrib guide
2 parents d1389ce + 14751a0 commit dbb5845

21 files changed

+1075
-82
lines changed

.github/CONTRIBUTING.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Contributing Guide
2+
3+
Its great to see your here!
4+
5+
- You need to first fork and clone the project to start working on it.
6+
Always work on a new branch, and open a PR to the `main` branch.
7+
Keep the `main` branch of your fork in sync with the origin.
8+
If you are a GitHub beginner, and wondering how to do the above stuff,
9+
then please read [GitHub's documentation](https://docs.github.com/en/get-started/quickstart/fork-a-repo).
10+
11+
- This project uses `poetry` for package management.
12+
It is very simple and intuitive to use.
13+
This guide will show you how to setup your project environment.
14+
If you dont have poetry [install it](https://python-poetry.org/docs/#installation).
15+
16+
- Move into your cloned project directory and run the following commands.
17+
18+
```shell
19+
poetry config virtualenvs.in-project true
20+
poetry install
21+
```
22+
23+
- The virtual environment will be created in a `.venv` folder
24+
inside your project directory.
25+
In your code editor set the python interpretor path to `./.venv/bin/python`
26+
27+
- Activate `poetry` shell.
28+
29+
```shell
30+
poetry shell
31+
```
32+
33+
- Setup pre-commit hooks.
34+
35+
```shell
36+
pre-commit install
37+
```
38+
39+
- Common commands that you will be running.
40+
41+
```shell
42+
make fmt # format your code, and sort your imports
43+
make clean # delete python cache and other such stuff
44+
pre-commit run -a # run pre-commit hooks for all files
45+
pre-commit run # run pre-commit hooks only for staged changes
46+
poetry show --tree # see the dependency graph for the project
47+
pytest # run tests and see the code coverage
48+
# after running pytest open htmlcov/index.html to see coverage report
49+
```
50+
51+
To work on this project you must have some knowledge of Selenium.
52+
An idea about different tools such as pre-commit, tox, black etc will be helpful.
53+
To know more about something, just google search and go through the official docs.

.github/workflows/quality.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Code Quality
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-python@v2
15+
- run: pip install poetry && poetry install
16+
- uses: pre-commit/action@v2.0.0

.github/workflows/test.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
python-version: ['3.8','3.9']
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- run: pip install poetry && poetry install
24+
- name: Build python package
25+
run: poetry build
26+
- name: Run tests
27+
run: poetry run pytest
28+
- uses: codecov/codecov-action@v1
29+
with:
30+
token: ${{ secrets.CODECOV_TOKEN }}
31+
env_vars: OS, PYTHON
32+
fail_ci_if_error: false

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Configuration for code editors
2+
.vscode
3+
4+
# All files like t.py, t.ipynb, t.md etc
5+
t.*
6+
17
# Byte-compiled / optimized / DLL files
28
__pycache__/
39
*.py[cod]

.pre-commit-config.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
repos:
2+
3+
- repo: https://github.com/pycqa/isort
4+
rev: 5.8.0
5+
hooks:
6+
- id: isort
7+
name: isort (python)
8+
- id: isort
9+
name: isort (cython)
10+
types: [cython]
11+
- id: isort
12+
name: isort (pyi)
13+
types: [pyi]
14+
15+
- repo: https://github.com/psf/black
16+
rev: 20.8b1
17+
hooks:
18+
- id: black
19+
language_version: python3
20+
entry: black . --check
21+
22+
- repo: https://github.com/pre-commit/mirrors-mypy
23+
rev: v0.812
24+
hooks:
25+
- id: mypy
26+
27+
- repo: https://github.com/igorshubovych/markdownlint-cli
28+
rev: v0.27.1
29+
hooks:
30+
- id: markdownlint
31+
entry: markdownlint --ignore .github

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Python World
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# lists all available targets
2+
list:
3+
@sh -c "$(MAKE) -p no_targets__ | \
4+
awk -F':' '/^[a-zA-Z0-9][^\$$#\/\\t=]*:([^=]|$$)/ {\
5+
split(\$$1,A,/ /);for(i in A)print A[i]\
6+
}' | grep -v '__\$$' | grep -v 'make\[1\]' | grep -v 'Makefile' | sort"
7+
8+
# required for list
9+
no_targets__:
10+
11+
12+
clean:
13+
@rm -rf build dist .eggs *.egg-info
14+
@rm -rf .benchmarks .coverage coverage.xml htmlcov report.xml .tox
15+
@find . -type d -name '.mypy_cache' -exec rm -rf {} +
16+
@find . -type d -name '__pycache__' -exec rm -rf {} +
17+
@find . -type d -name '*pytest_cache*' -exec rm -rf {} +
18+
@find . -type f -name "*.py[co]" -exec rm -rf {} +
19+
20+
fmt: clean
21+
@poetry run isort .
22+
@poetry run black .
23+
24+
hard-clean: clean
25+
@rm -rf .venv
26+
27+
pypi:
28+
@poetry build && poetry publish

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# Stool
2-
3-
stool is an wrapper over selenium to perform various task.
1+
# s-tool
42

3+
Selenium wrapper to make your life easy.
54

65
## Features
6+
77
- [X] Manage multiple webdrivers.
88
- [X] Click any type of element.
99
- [X] Extract Page source.
10-
- [X] Select different type of elements.
10+
- [X] Select different type of elements.
1111
- [X] Retrive cookies.
1212
- [X] take fullpage and elementwise screenshots.
1313
- [X] display and hide elements.
14-
1514

1615
## TODO
16+
1717
- [ ] Fill information(forms)
1818
- [ ] horizontal and vertical scrolling
1919
- [ ] Handeling alerts and popup

0 commit comments

Comments
 (0)