#244 vendorizing your Python podcast

Python Bytes - En podcast af Michael Kennedy and Brian Okken - Tirsdage

Kategorier:

Watch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Brandon Braner Brain #1: pip Environmental Variables The problem with snakes on a plane → no internet Situation: want to work on some code on a plane project set up to use tox, which creates venvs, and pip installs dependencies from pypi.org. but… no internet Preflight work: run tox with an internet connection copy everything from all of the “site-packages” directories under “.tox” into a “wheels” directory or whatever you want to call it. set environmental variables: PIP_FIND_LINKS=file:/Users/okken/wheels PIP_NO_INDEX=1 Try this out first BEFORE getting on the plane, to make sure you didn’t miss anything. In flight: tox works fine now, using local dir as index Thanks Paul Ganssle for helping with this. All command line flags for pip are available as env variables: “pip’s command line options can be set with environment variables using the format PIP_[HTML_REMOVED] . Dashes (-) have to be replaced with underscores (_).” Michael #2: Extra, Extra, 6x Extra, hear all about it Michael’s Pydantic talk Little Automation Tools in Python episode A Day in Code- Python: Learn to Code in Python through an Illustrated Story Released by Shari Eskenas TabNine AI complete macOS photos follow up jinja-partials chameleon-partials fastapi-chameleon Brandon #3: Kaggle 30 Days of Machine Learning What is Kaggle Find and publish data sets Explore and build models in a web-based data-science environment(Jupyter Notebooks) Work with other data scientists and machine learning engineers Enter competitions to solve data science challenges. Starts August 2nd, 2021 Has an introduction to Python and covers basic and intermediate machine learning concepts Get some completion certificates Kaggle competition at the end with teams of 3 Brian #4: Building and testing Python with GitHub Actions GitHub Docs This is an incredible resource I suggest starting with Running tests with tox, as it’s a super simple setup. And, you can test all of the tox environments locally. name: Python package on: [push, pull_request] jobs: build: runs-on: ubuntu-latest strategy: matrix: python: [3.7, 3.8, 3.9, 3.10-dev] steps: - uses: actions/checkout@v2 - name: Setup Python uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} - name: Install Tox and any other packages run: pip install tox - name: Run Tox run: tox -e py Michael #5: python-vendorize via Patrick Park Vendoring a dependency means basically copying it into your package or your app rather than installing and importing it externally. Here’s a simple way to do that. python-vendorize allows pure-Python dependencies to be vendorized vendorize.toml might look something like: target = "your_app/_vendor" packages = [ "six", ] run python-vendorize in the same directory as vendorize.toml In your_app.py, six can be imported from _vendor: from ._vendor import six Brandon #6: Supabase and the new Python library Supabase is an open source Firebase Alternative Postgres Database, Authentication, instant APIs, realtime subscriptions and Storage uses: https://postgrest.org/en/stable/ for rest api access to your database GoTrue from Netlify for handling user authentication https://github.com/netlify/gotrue Realtime client built in Elixir to listen to Postgres changes. https://github.com/supabase/realtime Supabase local so you don’t need internet to develop your project https://supabase.io/docs/guides/local-development Extras The Baked Data architectural pattern Simon Willison “Baked Data: bundling a read-only copy of your data alongside the code for your application, as part of the same deployment” Released service - released.sh Joke The (tech) circle of life

Visit the podcast's native language site