Skip to main content

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

Project description

pytoolsbrunojatoba

Module is one exemple for biulding projects in Python from the Backend DevPro Course In this course is taught how contributed in open source projects

Link of the course DevPro

This project has support for Python 3 version

Updates

Python 3

Checklist topics of the course and commands necessary for job:

  1. Git:

Local and remote branchs verification commands

git branch -all (check all branchs)
git remote -v (check all remotes branchs)

Steps for job local:

git fetch upstream (search for local branch updates of one remote repository)
git branch 1 (add a new local branch)
git checkout 1 (change from a main branch to branch 1) or
git checkout -b main upstream/main (make a new main branch from upstream main branch)
make one commit
git push upstream main (send the update to be accept in the GitHub forked repository of outher programmer)
git push origin main (send the code update only for your repositorio and after being submitted in upstream repository)
if accept make
git branch -D 1 (delete local branch 1)
git push --delete upstream 1(delete remote branch 1)
git push --delete origin 1(delete remote branch 1)

Final job:

git fetch upstream (search update in the repository)
git merge (download code update)

.gitignore file:

Hide what should not be made available

Pycharm files
.idea/
.classpath
.project
.settings/
bin/
*.sqlite3
:wq (exit)
git config --global core.excludesfile ~/.gitignore_global
  1. Pyenv:

Install differents Python versions in one PC

Installation:

bash <(curl -sSL https://raw.githubusercontent.com/zaemiel/ubuntu-pyenv-installer/master/ubuntu-pyenv-installer.sh) 

Edit the .bashrc file final in the vim:

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"

vim commands:

vim .bashrc (open)
i (edition)
:wq (clone and save)

Commands:

pyenv install -l (list everything that can be installed)
pyenv install 3.11.2 (Python 3.11.2 install)
pyenv versions (list all python versions avaliable for use)
pyenv global 3.11.2 (define global python the version 3.11.2)
which python (check which the global python path defined)
python -V (display how global python activated)
  1. VirtualEnv:

Works with another python separate from system python The aim is to create one virtual envieronmental for be install libs differents of the O.S Python

python3 -m venv .venv
source .venv/bin/activate
deativate
  1. Pip install, Requests and Flake8 libs, requirements.txt file:

First activate the virtualenv for use pip install

Requests (requirements.txt):

pip install requests

Flake8 (requirements-dev.txt):

Check errors in the code(various or without spaces)

pip install flake8
flake8

Requeriments:

Generate the file txt with libs to be made available in github repository

pip freeze > requirements.txt
pip freeze > requirements-dev.txt (flake8, delete requirements libs )

Install .venv libs of the requirements-dev.txt file

pip install -r requirements-dev.txt
  1. GitHub Actions I'm using in place of the Travis CI Create .github_actions.yml file in the .github/workflows folder
name: Python application

on: [pull_request]

jobs:
  build:
    env:
      PIPENV_NO_INHERIT: 1
      PIPENV_IGNORE_VIRTUALENVS: 1
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Set up Python 3.11.2
        uses: actions/setup-python@v1
        with:
          python-version: 3.11.2

      - name: Install dependencies
        run: |
          pip install -q -r requirements-dev.txt
      - name: Lint with flake8.
        run: |
          pipenv run flake8 .
  1. Pypi:

Setup.py file

PACKAGE = "pytoolsbrunojatoba"
NAME = "pytoolsbrunojatoba"
DESCRIPTION = "Módulo para exemplificar construção de projetos Python no curso PyTools"
AUTHOR = "Bruno Jatobá"
AUTHOR_EMAIL = "brjatoba92@djangosolutions.com"
URL = "https://github.com/brjatoba92/pytoolsbrunojatoba"
long_description=read('README.md'),
long_description_content_type='text/markdown',
license=read('LICENSE'),
classifiers=[
        "Development Status :: 2 - Pre-Alpha",
        "Environment :: Console",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
        "Operating System :: OS Independent",
        "Programming Language :: Python",
        #"Programming Language :: Python :: 3.11.2",
        "Framework :: Pytest",
install_requires=[
        'requests'

Create a new .venv out of the repository

pip install -e ./pytoolsbrunojatoba/

Upload to Pypi

Create a new tag and push to upstream

git tag 0.1
git push --tags
pip install twine
python setup.py sdist (generate the dist folder)
twine upload dist/* (set the username and password)
  • Rename in setup.py the option,before was the specified python version of venv(3.11.2)
Classifier 'Programming Language :: Python

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytoolsbrunojatoba-0.2.tar.gz (42.7 kB view details)

Uploaded Source

File details

Details for the file pytoolsbrunojatoba-0.2.tar.gz.

File metadata

  • Download URL: pytoolsbrunojatoba-0.2.tar.gz
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for pytoolsbrunojatoba-0.2.tar.gz
Algorithm Hash digest
SHA256 d8e1196fd2ec53ae1c3bc4c864b86f9ba6388ecf04a82d305be9f556c3444959
MD5 595844c10e2f3be00a80a87233572269
BLAKE2b-256 636d52966341f764899e34cc8aacf31c22eb3e75b68af9ac95992e8640a3874a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page