Skip to content

Commit

Permalink
Merge pull request #212 from atlanticwave-sdx/206.pyproject-toml
Browse files Browse the repository at this point in the history
Use `pyproject.toml`
  • Loading branch information
sajith authored Jan 29, 2024
2 parents 8216f21 + 579f9ce commit 07f876f
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 68 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
.git/
venv*/
.tox/
10 changes: 6 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ jobs:
run: |
python -m isort --check --profile black .
- name: Lint sdx-controller Dockerfile
uses: hadolint/[email protected]
with:
dockerfile: Dockerfile
# # Disable hadolint check until
# # https://github.com/hadolint/hadolint/issues/943 is solved.
# - name: Lint sdx-controller Dockerfile
# uses: hadolint/[email protected]
# with:
# dockerfile: Dockerfile

- name: Lint bapm-server Dockerfile
uses: hadolint/[email protected]
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

permissions:
contents: read

jobs:
test:

Expand All @@ -28,7 +28,7 @@ jobs:
ports:
- 5672:5672
- 15672:15672

mongodb:
image: mongo:7.0.5
ports:
Expand All @@ -46,10 +46,10 @@ jobs:
- "3.10"

steps:

- name: Check out code
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
SUB_QUEUE: 'sdx-controller-test-queue'
DB_NAME: 'sdx-controllder-test-db'
DB_CONFIG_TABLE_NAME: 'sdx-controller-test-table'
MONGODB_CONNSTRING: 'mongodb://guest:guest@localhost:27017/'
MONGODB_CONNSTRING: 'mongodb://guest:guest@localhost:27017/'
timeout-minutes: 3

- name: Send coverage data to coveralls.io
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,4 @@ dmypy.json
/*.sqlite3-wal

/db/*
/swagger_server/_version.py
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ RUN apt-get update \

WORKDIR /usr/src/app

COPY requirements.txt /usr/src/app/

RUN pip3 install --no-cache-dir -r requirements.txt

WORKDIR /usr/src/app
COPY . /usr/src/app

# In order to make setuptools_scm work during container build, we
# temporarily bind-mount .git. Via
# https://github.com/pypa/setuptools_scm/issues/77#issuecomment-844927695
RUN --mount=source=.git,target=.git,type=bind \
pip install --no-cache-dir .

EXPOSE 8080

ENTRYPOINT ["python3"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ directory:
```console
$ python3 -m venv venv --upgrade-deps
$ source ./venv/bin/activate
$ pip3 install -r requirements.txt
$ pip3 install [--editable] .
$ source .env
$ python3 -m swagger_server
```
Expand Down
64 changes: 63 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,71 @@
[build-system]
requires = [
"setuptools >= 61.0",
# "setuptools-scm >= 6.2",
]
build-backend = "setuptools.build_meta"

[project]
name = "sdx-controller"
description = "AtlanticWave-SDX project's main controller"
dynamic = [ "version" ]
authors = [
{ name = "Yufeng Xin", email = "[email protected]" },
{ name = "Cong Wang", email = "[email protected]" },
{ name = "Sajith Sasidharan", email = "[email protected]" },
]
readme = "README.md"
requires-python = ">=3.8"
license = {file = "LICENSE"}
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent"
]
dependencies = [
"jsonschema == 3.2.0",
"connexion[swagger-ui] >= 2.14.1",
"python_dateutil >= 2.8",
"setuptools >= 21.0.0",
"pika >= 1.2.0",
"dataset",
"pymongo > 3.0",
"sdx-pce @ git+https://github.com/atlanticwave-sdx/[email protected]",
]

[project.optional-dependencies]
test = [
"flask_testing == 0.8.1",
"coverage >= 4.0.3",
"networkx == 2.8.8",
"pytest >= 7.2.0",
"pytest-cov >= 4.0.0",
"pluggy >= 0.3.1",
"py >= 1.4.31",
"randomize >= 0.13",
]
lint = [
"black == 23.*",
"isort == 5.*",
]

[options.packages.find]
where = "swagger_server"

[tool.setuptools]
packages = ["swagger_server", "bapm_server"]

[tool.setuptools_scm]
# Write version info collected from git to a file. This happens when
# we run `python -m build`.
write_to = "swagger_server/_version.py"

[tool.black]
include = '\.py?$'

[tool.isort]
profile = "black"
src_paths = ["setup.py", "swagger_server", "bapm_server"]
src_paths = ["swagger_server", "bapm_server"]

[tool.coverage.run]
branch = true
Expand Down
9 changes: 0 additions & 9 deletions requirements.txt

This file was deleted.

32 changes: 0 additions & 32 deletions setup.py

This file was deleted.

9 changes: 0 additions & 9 deletions test-requirements.txt

This file was deleted.

6 changes: 4 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[tox]
envlist = py3

requires =
tox>=4

[testenv]
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[test]

commands =
pytest --cov swagger_server --cov bapm_server {posargs}
Expand Down

0 comments on commit 07f876f

Please sign in to comment.