Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: igorvoltaic/python-cs50
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: patch-1
Choose a base ref
...
head repository: cs50/python-cs50
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 1,260 additions and 245 deletions.
  1. +68 −0 .github/workflows/main.yml
  2. +2 −2 .gitignore
  3. +0 −30 .travis.yml
  4. +6 −0 Dockerfile
  5. +671 −4 LICENSE
  6. +23 −3 README.md
  7. +33 −0 docker-compose.yml
  8. +4 −2 setup.py
  9. +1 −0 src/cs50/__init__.py
  10. +65 −28 src/cs50/cs50.py
  11. +15 −8 src/cs50/flask.py
  12. +275 −142 src/cs50/sql.py
  13. +51 −0 tests/foo.py
  14. +46 −26 tests/sql.py
68 changes: 68 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
on: push
jobs:
deploy:
runs-on: ubuntu-latest
services:
mysql:
image: mysql
env:
MYSQL_DATABASE: test
MYSQL_ALLOW_EMPTY_PASSWORD: yes
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
ports:
- 3306:3306
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
check-latest: true
- name: Setup databases
run: |
pip install .
pip install mysqlclient psycopg2-binary SQLAlchemy
- name: Run tests
run: python tests/sql.py
env:
MYSQL_HOST: 127.0.0.1
POSTGRESQL_HOST: 127.0.0.1

- name: Install pypa/build
run: python -m pip install build --user

- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .

- name: Deploy to PyPI
if: ${{ github.ref == 'refs/heads/main' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Get Version
id: py_version
run: |
echo ::set-output name=version::$(python3 setup.py --version)
- name: Create Release
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: "v${{ steps.py_version.outputs.version }}",
tag_commitish: "${{ github.sha }}"
})
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.*
!/.github/
!.gitignore
!.travis.yml
dist/
build/
*.db
*.egg-info/
*.pyc
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM cs50/cli

RUN sudo apt update && sudo apt install --yes libmysqlclient-dev pgloader pkg-config postgresql
RUN sudo pip3 install mysqlclient psycopg2-binary

WORKDIR /mnt
Loading