Skip to content

Commit 620b51a

Browse files
authored
Merge pull request #2 from thobiast/dev
Dev
2 parents c7e1fc4 + 8c87bb5 commit 620b51a

File tree

13 files changed

+503
-415
lines changed

13 files changed

+503
-415
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,23 @@
11
name: build
2-
on:
3-
pull_request:
4-
push:
5-
branches: [main]
2+
on: [push]
3+
64
jobs:
7-
lint:
8-
runs-on: ubuntu-latest
9-
steps:
10-
- uses: actions/checkout@v2
11-
- name: Set up Python
12-
uses: actions/setup-python@v2
13-
with:
14-
python-version: '3.x'
15-
- name: Display Python version
16-
run: python -c "import sys; print(sys.version)"
17-
- name: Install tox
18-
run: pip install --upgrade tox black
19-
- name: Run tox flake8
20-
run: tox -e flake8
21-
- name: Run tox black
22-
run: tox -e black
23-
test:
24-
needs: lint
5+
build:
6+
257
runs-on: ubuntu-latest
268
strategy:
279
matrix:
28-
python-version: [3.7, 3.8, 3.9]
10+
python-version: ["3.10", "3.11", "3.12"]
11+
2912
steps:
30-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
3114
- name: Set up Python ${{ matrix.python-version }}
32-
uses: actions/setup-python@v2
15+
uses: actions/setup-python@v5
3316
with:
3417
python-version: ${{ matrix.python-version }}
3518
- name: Display Python version
3619
run: python -c "import sys; print(sys.version)"
37-
- name: install tox
38-
run: python -m pip install --upgrade tox virtualenv setuptools pip
39-
- name: run tox tests
40-
run: tox -e py
41-
- name: Upload coverage to Codecov
42-
uses: codecov/codecov-action@v1
43-
with:
44-
file: ./coverage.xml
45-
flags: unittests
46-
env_vars: OS,PYTHON
47-
fail_ci_if_error: true
20+
- name: Install dependencies
21+
run: python -m pip install --upgrade pre-commit tox virtualenv setuptools pip
22+
- name: run tox
23+
run: tox

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ jobs:
66
deploy:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v4
1010
- name: Set up Python
11-
uses: actions/setup-python@v2
11+
uses: actions/setup-python@v5
1212
with:
1313
python-version: '3.x'
1414
- name: Install dependencies

.pre-commit-config.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: end-of-file-fixer
6+
- id: check-yaml
7+
- id: trailing-whitespace
8+
- id: debug-statements
9+
10+
- repo: https://github.com/psf/black
11+
rev: 25.1.0
12+
hooks:
13+
- id: black
14+
args: ["--diff", "--check"]
15+
16+
- repo: https://github.com/PyCQA/bandit
17+
rev: 1.8.3
18+
hooks:
19+
- id: bandit
20+
exclude: ^tests/
21+
22+
- repo: https://github.com/PyCQA/flake8
23+
rev: 7.1.2
24+
hooks:
25+
- id: flake8
26+
additional_dependencies: [flake8-bugbear, pep8-naming]
27+
args: [--max-line-length=131]
28+
29+
- repo: https://github.com/PyCQA/isort
30+
rev: 6.0.0
31+
hooks:
32+
- id: isort
33+
34+
- repo: https://github.com/PyCQA/pylint
35+
rev: v3.3.4
36+
hooks:
37+
- id: pylint
38+
args: ["--disable=W0601"]
39+
additional_dependencies:
40+
- "requests"
41+
- "pandas"
42+
- "pytest"

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# magicformulabr - Script que implementa a magic formula de Joel Greenblatt para empresas listadas na Bovespa.
1+
# magicformulabr - Script que implementa a magic formula de Joel Greenblatt para classificar empresas listadas na Bovespa.
22

3-
![build](https://github.com/thobiast/magicformulabr/workflows/build/badge.svg)
3+
[![Build and Test](https://github.com/thobiast/magicformulabr/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/thobiast/magicformulabr/actions/workflows/build.yml)
44
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/magicformulabr)
5-
[![codecov](https://codecov.io/gh/thobiast/magicformulabr/branch/main/graph/badge.svg)](https://codecov.io/gh/thobiast/magicformulabr)
65
[![GitHub License](https://img.shields.io/github/license/thobiast/magicformulabr)](https://github.com/thobiast/magicformulabr/blob/main/LICENSE)
76
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
87

@@ -20,9 +19,12 @@ pip install magicformulabr
2019

2120
## Uso
2221

22+
O magicformulabr armazena os dados baixados em um arquivo local "*data_cache.json*" por 24 horas
23+
para evitar requisições desnecessárias. Use `--force-update` para atualizar os dados.
24+
2325
```bash
2426
$ magicformulabr -h
25-
usage: magicformulabr [-h] [-d] [-v] [-m {1,2,3}] [-t TOP]
27+
usage: magicformulabr [-h] [-d] [-v] [-m {1,2,3}] [-t TOP] [--force-update]
2628

2729
Gera rank de acoes usando a magic formula
2830

@@ -33,6 +35,7 @@ optional arguments:
3335
-m {1,2,3}, --method {1,2,3}
3436
Campos usados para o calculo da magic formula
3537
-t TOP, --top TOP Numero de empresas para mostrar no rank
38+
--force-update Forca a atualizacao do cache
3639

3740
Methods disponiveis:
3841
1 - P/L e ROE

pyproject.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[project]
2+
name = "magicformulabr"
3+
description = "Magic Formula script for companies listed at Bovespa."
4+
readme = "README.md"
5+
license = {file = "LICENSE"}
6+
dynamic = ["version", "dependencies"]
7+
requires-python = ">=3.7"
8+
authors = [
9+
{name = "Thobias Salazar Trevisan"},
10+
]
11+
12+
[project.scripts]
13+
magicformulabr = "magicformulabr.main:main"
14+
15+
[project.urls]
16+
"Homepage" = "https://github.com/thobiast/magicformulabr"
17+
"Source" = "https://github.com/thobiast/magicformulabr"
18+
19+
[build-system]
20+
requires = ["setuptools>=61", "wheel"]
21+
build-backend = "setuptools.build_meta"
22+
23+
[tool.setuptools]
24+
package-dir = {"" = "src"}
25+
packages = ["magicformulabr"]
26+
27+
[tool.setuptools.dynamic]
28+
version = {attr = "magicformulabr.__version__"}
29+
dependencies = {file = ["requirements.txt"]}

setup.py

Lines changed: 0 additions & 61 deletions
This file was deleted.

src/__init__.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/__version__.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)