Package: pytoolsbrunojatoba
pytoolsbrunojatobaModule is one exemple for biulding projects in Python from the Backend DevPro Course
In this course is taught how contributed in open source projectsLink of the courseDevProThis project has support for Python 3 versionChecklist topics of the course and commands necessary for job:Git:Local and remote branchs verification commandsgit 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) orgit checkout -b main upstream/main (make a new main branch from upstream main branch)make one commitgit 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 makegit 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 availablePycharm files.idea/.classpath.project.settings/bin/*.sqlite3:wq (exit)git config --global core.excludesfile ~/.gitignore_globalPyenv:Install differents Python versions in one PCInstallation: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)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 Pythonpython3 -m venv .venvsource .venv/bin/activatedeativatePip install, Requests and Flake8 libs, requirements.txt file:First activate the virtualenv for use pip installRequests (requirements.txt):pip install requestsFlake8 (requirements-dev.txt):Check errors in the code(various or without spaces)pip install flake8flake8Requeriments:Generate the file txt with libs to be made available in github repositorypip freeze > requirements.txtpip freeze > requirements-dev.txt (flake8, delete requirements libs )Install .venv libs of the requirements-dev.txt filepip install -r requirements-dev.txtGitHub Actions
I'm using in place of the Travis CI
Create .github_actions.yml file in the .github/workflows foldername: Python applicationon: [pull_request]jobs:build:env:PIPENV_NO_INHERIT: 1PIPENV_IGNORE_VIRTUALENVS: 1runs-on: ubuntu-lateststeps:- uses: actions/checkout@v2- name: Set up Python 3.11.2uses: actions/setup-python@v1with:python-version: 3.11.2- name: Install dependenciesrun: |pip install -q -r requirements-dev.txt- name: Lint with flake8.run: |pipenv run flake8 .Pypi:Setup.py filePACKAGE = "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 repositorypip install -e ./pytoolsbrunojatoba/Upload to PypiCreate a new tag and push to upstreamgit tag 0.1git push --tagspip install twinepython 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