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: cs50/python-cs50
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.0.0
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,608 additions and 758 deletions.
  1. +68 −0 .github/workflows/main.yml
  2. +2 −3 .gitignore
  3. +0 −30 .travis.yml
  4. +6 −0 Dockerfile
  5. +671 −4 LICENSE
  6. +19 −22 README.md
  7. +34 −0 docker-compose.yml
  8. +4 −2 setup.py
  9. +18 −3 src/cs50/__init__.py
  10. +0 −48 src/cs50/_logger.py
  11. +0 −80 src/cs50/_session.py
  12. +0 −269 src/cs50/_statement.py
  13. +127 −61 src/cs50/cs50.py
  14. +13 −4 src/cs50/flask.py
  15. +622 −73 src/cs50/sql.py
  16. +9 −6 tests/foo.py
  17. +15 −2 tests/sql.py
  18. +0 −151 tests/test_cs50.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.7'
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 }}"
})
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
.*
!/.github/
!.gitignore
!.travis.yml
build/
*.db
*.egg-info/
*.pyc
dist/
test.db
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 postgresql
RUN sudo pip3 install mysqlclient psycopg2-binary

WORKDIR /mnt
Loading