continuous-integration

What to tests in ci run vs pytest, and why

What to tests in ci run vs pytest, and why Question: I have a python repo in github. If I understood it correctly there are mainly two ways in which tests can be automated: using run in a ci.yml file using test_… files under a folder called test (at root level) and then execute them …

Total answers: 1

Github Actions don't reuse cache

Github Actions don't reuse cache Question: I have a pretty simple step for CI on Github Actions, which is supposed to cache Python dependencies, so it would save a lot of computing time. some-step: name: ‘Test step’ runs-on: ubuntu-latest steps: – uses: actions/checkout@v3 – run: pipx install poetry – name: Set up Python 3.8 uses: …

Total answers: 2

Github Actions: poetry installs black but CI workflow does not find it

Github Actions: poetry installs black but CI workflow does not find it Question: I am setting up a python code quality workflow locally (pre-commit) and on Github Actions (GHA). Environment is managed with poetry. While the local precommit works fine, the remote GHA workflow fails, saying it does not find black, while looking at the …

Total answers: 1

botocore.exceptions.NoRegionError: You must specify a region. GitHub Actions with CI/CD Pipeline with AWS

botocore.exceptions.NoRegionError: You must specify a region. GitHub Actions with CI/CD Pipeline with AWS Question: I am trying to reproduce, step-by-step, the instructions on this video "Cloud Resume Challenge Sprint (Sept, 2022) – Week 4" from youtube, https://youtu.be/wiyI0Ngn31o, on how to setup GitHub Actions with CD/CI pipeline for Backend testing with Python for SAM Deployment in …

Total answers: 1

Line wrap long `python -c` command to be < 80-chars

Line wrap long `python -c` command to be < 80-chars Question: I have a Python two-liner to set an environment variable, which I run in bash: ENV_VAR=$(python -c "from some_package import some_long_command; print(some_long_command())") In bash, one can use to line wrap long commands. I am looking for an equivalent within python -c. Is there some …

Total answers: 1

GitLab CI Python black formatter says: would reformat, whereas running black does not reformat

GitLab CI Python black formatter says: would reformat, whereas running black does not reformat Question: When I run GitLab CI on this commit with this gitlab-ci.yml: stages: – format – test black_formatting: image: python:3.6 stage: format before_script: # Perform an update to make sure the system is up to date. – sudo apt-get update –fix-missing …

Total answers: 2

How do I check if Alembic migrations need to be generated?

How do I check if Alembic migrations need to be generated? Question: I’m trying to improve CI pipeline to prevent situations where SQLAlchemy models are added or changed, but no Alembic migration is written or generated by the commit author from hitting the production branch. alembic –help doesn’t seem to provide any helpful commands for …

Total answers: 2

Automating Python package release process

Automating Python package release process Question: I’ve just started an open source Python project that I hope might be popular one day. At the moment to release a new version I have to do a few things. Test all the things. Edit mypackage.VERSION variable, which setup.py imports from __init__ Build packages and wheels with python …

Total answers: 3

How to update code from Git to a Docker container

How to update code from Git to a Docker container Question: I have a Docker file trying to deploy Django code to a container FROM ubuntu:latest MAINTAINER { myname } #RUN echo “deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc) main universe” >> /etc/apt/sou$ RUN apt-get update RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tar git curl dialog wget net-tools nano …

Total answers: 5

"No source for code" message in Coverage.py

"No source for code" message in Coverage.py Question: I ran a build last night, successfully. I got up this morning and ran another without changing any configuration or modifying any source code. Now my build is failing with the message “No source for code” when running my nosetests with coverage. NoSource: No source for code: …

Total answers: 10