Skip to content

Commit

Permalink
Refactor: pyproject.toml (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaveman authored Aug 1, 2023
2 parents a06c096 + 3880b7e commit ce3acab
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 69 deletions.
16 changes: 9 additions & 7 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM eligibility_server:latest

# install python tooling
COPY .devcontainer/requirements.txt .devcontainer/requirements.txt
RUN pip install --no-cache-dir -r .devcontainer/requirements.txt
# install devcontainer requirements
RUN pip install -e .[dev,test]

# install docs tooling
# docs requirements are in a separate file for the GitHub Action
COPY docs/requirements.txt docs/requirements.txt
RUN pip install --no-cache-dir -r docs/requirements.txt

# install test tooling
COPY tests/requirements.txt tests/requirements.txt
RUN pip install -r tests/requirements.txt
# install pre-commit environments in throwaway Git repository
# https://stackoverflow.com/a/68758943
COPY .pre-commit-config.yaml .
RUN git init . && \
pre-commit install-hooks && \
rm -rf .git
3 changes: 0 additions & 3 deletions .devcontainer/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/" # requirements.txt
directory: "/" # pyproject.toml
schedule:
interval: "daily"
commit-message:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ jobs:
- name: Install package and dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements.txt
pip install -r requirements.txt
pip install -e .[test]
- name: Load environment variables
uses: cardinalby/export-env-action@v2
Expand Down
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ FROM ghcr.io/cal-itp/docker-python-web:main

ENV FLASK_APP=eligibility_server/app.py

# install python app dependencies
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# upgrade pip
RUN python -m pip install --upgrade pip

# copy source files
COPY bin/ bin/
COPY bin bin
COPY eligibility_server/ eligibility_server/
COPY *.py .
COPY README.md .
COPY pyproject.toml pyproject.toml

# install source as a package
RUN pip install -e .
Expand Down
3 changes: 3 additions & 0 deletions eligibility_server/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__version__ = "2023.06.1"

VERSION = __version__
45 changes: 40 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,46 @@
# Configuration for Black.
[build-system]
requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"

# NOTE: you have to use single-quoted strings in TOML for regular expressions.
# It's the equivalent of r-strings in Python. Multiline strings are treated as
# verbose regular expressions by Black. Use [ ] to denote a significant space
# character.
[project]
classifiers = ["Programming Language :: Python :: 3 :: Only"]
description = "Server implementation of the Eligibility Verification API"
dependencies = [
"eligibility-api==2023.6.1",
"Flask==2.3.2",
"Flask-RESTful==0.3.10",
"Flask-SQLAlchemy==3.0.5",
"requests==2.31.0"
]
dynamic = ["version"]
keywords = ["flask"]
license = { file = "LICENSE" }
name = "eligibility-server"
readme = "README.md"
requires-python = ">=3.9"

[project.optional-dependencies]
dev = [
"black",
"flake8",
"pre-commit",
]
test = [
"coverage",
"pytest",
"pytest-mock",
]

[project.urls]
Code = "https://github.com/cal-itp/eligibility-server"
Documentation = "https://docs.calitp.org/eligibility-server"
Issues = "https://github.com/cal-itp/eligibility-server/issues"

# Configuration for black
[tool.black]
line-length = 127
target-version = ['py310']
include = '\.pyi?$'

[tool.setuptools]
packages = ["eligibility_server"]
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

37 changes: 0 additions & 37 deletions setup.py

This file was deleted.

3 changes: 0 additions & 3 deletions tests/requirements.txt

This file was deleted.

0 comments on commit ce3acab

Please sign in to comment.