Skip to content

Commit

Permalink
Build project with build & pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder authored and waxlamp committed Feb 7, 2024
1 parent 54a67fe commit 11e61dd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/backend-production-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ jobs:
run: heroku plugins:install heroku-builds

- name: Build app into tarball
run: python setup.py sdist --formats=gztar
run: |
pip install build
python -m build --sdist
- name: Create Heroku Build
run: heroku builds:create -a dandi-api --source-tar=dist/$(python setup.py --fullname).tar.gz
run: heroku builds:create -a dandi-api --source-tar dist/*.tar.gz
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }}
6 changes: 4 additions & 2 deletions .github/workflows/backend-staging-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ jobs:
run: heroku plugins:install heroku-builds

- name: Build app into tarball
run: python setup.py sdist --formats=gztar
run: |
pip install build
python -m build --sdist
- name: Create Heroku Build
run: heroku builds:create -a dandi-api-staging --source-tar=dist/$(python setup.py --fullname).tar.gz
run: heroku builds:create -a dandi-api-staging --source-tar dist/*.tar.gz
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }}
3 changes: 2 additions & 1 deletion dev/django.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ RUN apt-get update && \
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Only copy the setup.py and setup.cfg, it will still force all install_requires to be installed,
# Only copy the pyproject.toml, setup.py, and setup.cfg. It will still force all install_requires to be installed,
# but find_packages() will find nothing (which is fine). When Docker Compose mounts the real source
# over top of this directory, the .egg-link in site-packages resolves to the mounted directory
# and all package modules are importable.
COPY ./pyproject.toml /opt/django-project/pyproject.toml
COPY ./setup.cfg /opt/django-project/setup.cfg
COPY ./setup.py /opt/django-project/setup.py

Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[tool.mypy]
ignore_missing_imports = true
show_error_codes = true
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
description='',
# Determine version with scm
use_scm_version={'version_scheme': 'post-release'},
setup_requires=['setuptools_scm'],
long_description=long_description,
long_description_content_type='text/markdown',
license='Apache 2.0',
Expand Down

0 comments on commit 11e61dd

Please sign in to comment.