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

23 #698

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[flake8]
max-line-length = 120
exclude=.venv
exclude=venv
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: python
python:
- 3.7
-3.10
-2.7
install:
- pip install -q pipenv codecov
- pipenv sync --dev
- pip install -q -r requirements-dev.txt codecov
script:
- flake8
- pytest libpythonpro --cov=libpythonpro
-flake8
-pytest lybpythonproo --cov=libpythonproo
after_success:
- codecov
-codecov
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
include README.md
include LICENSE
include LICENSE

Nesse curso e ensinado como constribuir com projetos de códigos abertos e muito mais sobre Python
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,26 @@ Módulo para exemplificar construção de projetos Python no curso PyTools

Nesse curso é ensinado como contribuir com projetos de código aberto

Link para o curso [Python Pro](https://www.python.pro.br/)
Link para o curso [Python Pro](https://plataforma.dev.pro.br/)

[![Build Status](https://app.travis-ci.com/GuilhermeePires/libpythonpro.svg?branch=master)](https://app.travis-ci.com/GuilhermeePires/libpythonpro)

Suportada versão 3 de python

Para instalar:

'''console
python3 -m venv venv
source venv/bin/activate
pip install -r requirements-dev.txt
'''

Para conferir qualidade do código:

'''
console
flake8
'''

[![Build Status](https://travis-ci.org/pythonprobr/libpythonpro.svg?branch=master)](https://travis-ci.org/pythonprobr/libpythonpro)
[![Updates](https://pyup.io/repos/github/pythonprobr/libpythonpro/shield.svg)](https://pyup.io/repos/github/pythonprobr/libpythonpro/)
Expand Down
2 changes: 1 addition & 1 deletion libpythonpro/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.2'
__version__=0.1
4 changes: 4 additions & 0 deletions libpythonpro/github_api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import requests



def buscar_avatar(usuario):
"""
Busca o avatar de um usuário no Github
Expand All @@ -11,3 +12,6 @@ def buscar_avatar(usuario):
url = f'https://api.github.com/users/{usuario}'
resp = requests.get(url)
return resp.json()['avatar_url']

if __name__ == '__main__':
print(buscar_avatar('GuilhermeePires'))
54 changes: 54 additions & 0 deletions libpythonpro/tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# libpythonpro

Módulo para exemplificar construção de projetos Python no curso PyTools

Nesse curso é ensinado como contribuir com projetos de código aberto

Link para o curso [Python Pro](https://plataforma.dev.pro.br/)

[![Build Status](https://app.travis-ci.com/GuilhermeePires/libpythonpro.svg?branch=master)](https://app.travis-ci.com/GuilhermeePires/libpythonpro)

Suportada versão 3 de python

Para instalar:

'''console
python3 -m venv venv
source venv/bin/activate
pip install -r requirements-dev.txt
'''

Para conferir qualidade do código:

'''
console
flake8
'''

[![Build Status](https://travis-ci.org/pythonprobr/libpythonpro.svg?branch=master)](https://travis-ci.org/pythonprobr/libpythonpro)
[![Updates](https://pyup.io/repos/github/pythonprobr/libpythonpro/shield.svg)](https://pyup.io/repos/github/pythonprobr/libpythonpro/)
[![Python 3](https://pyup.io/repos/github/pythonprobr/libpythonpro/python-3-shield.svg)](https://pyup.io/repos/github/pythonprobr/libpythonpro/)
[![codecov](https://codecov.io/gh/pythonprobr/libpythonpro/branch/master/graph/badge.svg)](https://codecov.io/gh/pythonprobr/libpythonpro)

Suportada versão 3 de Python

Para instalar:

```console
pip install pipenv
pipenv install --dev
```

Para conferir qualidade de código:

```console
pipenv run flake8
```

Tópicos a serem abordados:
1. Git
2. Virtualenv
3. Pip
4. Mock
5. Pipenv

1 change: 1 addition & 0 deletions libpythonpro/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.2'
10 changes: 5 additions & 5 deletions libpythonpro/tests/test_spam/test_github_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
@pytest.fixture
def avatar_url(mocker):
resp_mock = Mock()
url = 'https://avatars3.githubusercontent.com/u/402714?v=4'
url = 'https://avatars.githubusercontent.com/u/102936883?v=4'
resp_mock.json.return_value = {
'login': 'renzo', 'id': 402714,
'login': 'GuilhermeePires', 'id': 102936883,
'avatar_url': url,
}
get_mock = mocker.patch('libpythonpro.github_api.requests.get')
Expand All @@ -19,10 +19,10 @@ def avatar_url(mocker):


def test_buscar_avatar(avatar_url):
url = github_api.buscar_avatar('renzo')
url = github_api.buscar_avatar('GuilhermeePires')
assert avatar_url == url


def test_buscar_avatar_integracao():
url = github_api.buscar_avatar('renzon')
assert 'https://avatars3.githubusercontent.com/u/3457115?v=4' == url
url = github_api.buscar_avatar('GuilhermeePires')
assert 'https://avatars.githubusercontent.com/u/102936883?v=4' == url
24 changes: 24 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
flake8==4.0.1
mccabe==0.6.1
pycodestyle==2.8.0
pyflakes==2.4.0

# Deps do pytest
pytest==7.1.1
attrs==21.4.0
pluggy==1.0.0
atomicwrites==1.4.0
colorama==0.4.4
iniconfig==1.1.1
tomli==2.0.1
packaging==21.3
py==1.11.0
pyparsing==3.0.8
more-itertools-8.12.0
six-1.16.0

#Converage
coverage==6.3.2
pytest-cov==3.0.0

-r requirements.txt
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests==2.27.1
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,20 @@ def find_package_data(
PACKAGE = "libpythonpro"
NAME = PACKAGE
DESCRIPTION = "Módulo para exemplificar construção de projetos Python no curso PyTools"
AUTHOR = "Renzo Nuccitelli"
AUTHOR_EMAIL = "[email protected]"
URL = "https://github.com/pythonprobr/libpythonpro"
AUTHOR = "Guilherme da Silva Pires"
AUTHOR_EMAIL = "[email protected]"
URL = "https://github.com/GuilhermeePires/libpythonpro"
VERSION = __import__(PACKAGE).__version__

setup(
name=NAME,
version=VERSION,
description=DESCRIPTION,
long_description=read('README.md'),
long_description=read("README.md"),
long_description_content_type='text/markdown',
author=AUTHOR,
author_email=AUTHOR_EMAIL,
license="GNU AFFERO GENERAL PUBLIC LICENSE",
license=read('LICENSE'),
url=URL,
packages=find_packages(exclude=["tests.*", "tests"]),
package_data=find_package_data(PACKAGE, only_in_packages=False),
Expand Down