Skip to content

Commit

Permalink
convert setup.py to setup.cfg (#1753)
Browse files Browse the repository at this point in the history
  • Loading branch information
zubenkoivan authored Oct 19, 2021
1 parent 84c97a4 commit 4901de6
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 117 deletions.
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
*
!dist
!platform_api.egg-info
!alembic
!alembic.ini
**/*.pyc
12 changes: 0 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@ updates:
open-pull-requests-limit: 10
ignore:
- dependency-name: sqlalchemy
versions:
- 1.4.0
- 1.4.1
- 1.4.10
- 1.4.2
- 1.4.3
- 1.4.4
- 1.4.5
- 1.4.6
- 1.4.7
- 1.4.8
- 1.4.9
- package-ecosystem: github-actions
directory: /
schedule:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
uses: actions/[email protected]
with:
path: ~/.cache/pip
key: ${{ runner.os }}-py-3.8.10-${{ hashFiles('requirements/*.txt') }}-${{
hashFiles('setup.py') }}
key: ${{ runner.os }}-py-3.8.10-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('setup.cfg') }}
- name: Install dependencies
run: make setup
- name: Lint
Expand Down
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ARG PYTHON_VERSION=3.8.12
ARG PYTHON_BASE=buster

FROM python:${PYTHON_VERSION} AS installer

ENV PATH=/root/.local/bin:$PATH

# Copy to tmp folder to don't pollute home dir
RUN mkdir -p /tmp/dist
COPY dist /tmp/dist

RUN ls /tmp/dist
RUN pip install --user --find-links /tmp/dist platform-api

FROM python:${PYTHON_VERSION}-${PYTHON_BASE} AS service

LABEL org.opencontainers.image.source = "https://github.com/neuro-inc/platform-api"

WORKDIR /app

COPY --from=installer /root/.local/ /root/.local/
COPY alembic.ini alembic.ini
COPY alembic alembic

ENV PATH=/root/.local/bin:$PATH
ENV NP_API_PORT=8080
EXPOSE $NP_API_PORT

CMD platform-api
31 changes: 0 additions & 31 deletions Dockerfile.k8s

This file was deleted.

13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ include k8s.mk

setup:
pip install -U pip
pip install -r requirements/test.txt
pip install -e .[dev]
pre-commit install

lint: format
mypy --show-error-codes platform_api tests setup.py alembic
mypy --show-error-codes platform_api tests alembic

format:
ifdef CI_LINT_RUN
Expand All @@ -52,9 +52,12 @@ test_integration:
pytest -vv --maxfail=3 --cov platform_api --cov-config=setup.cfg --cov-report xml:.coverage-integration.xml tests/integration

docker_build:
python setup.py sdist
docker build -f Dockerfile.k8s -t $(IMAGE_NAME):latest \
--build-arg DIST_FILENAME=`python setup.py --fullname`.tar.gz .
rm -rf build dist
pip install -U build
python -m build
docker build \
--build-arg PYTHON_BASE=slim-buster \
-t $(IMAGE_NAME):latest .

docker_push: docker_build
docker tag $(IMAGE_NAME):latest $(IMAGE_REPO):$(TAG)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ kubectl apply -f tests/k8s/storageclass.yml
python -m venv venv
source venv/bin/activate
```
7. Install testing dependencies:
7. Install dev dependencies:
```shell
pip install -r requirements/test.txt
pip install -e .[dev]
```
8. Run the unit test suite:
```shell
Expand Down
12 changes: 11 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
[build-system]
requires = [
"setuptools>=45",
"wheel",
"setuptools_scm>=6.2",
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
git_describe_command = "git describe --dirty --tags --long --match v*.*.*"

[tool.black]
exclude = '''
/(
\.git
| venv
| __pycache__
| \.tox
)/
'''
8 changes: 0 additions & 8 deletions requirements/syntax.txt

This file was deleted.

8 changes: 0 additions & 8 deletions requirements/test.txt

This file was deleted.

60 changes: 60 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,63 @@
[metadata]
name = platform-api
description = Neu.ro platform api
url = https://github.com/neuro-inc/platform-api
long_description = file: README.md, LICENSE
license = Apache 2
classifiers =
License :: OSI Approved :: Apache 2
Programming Language :: Python :: 3

[options]
zip_safe = False
python_requires = >=3.8
include_package_data = True
packages = find:
platforms = any
install_requires =
aiohttp==3.7.4.post0
iso8601==0.1.16
trafaret==2.1.0
neuro-auth-client==21.9.13.1
cryptography==35.0.0
aiorwlock==1.1.0
neuro-notifications-client==21.9.11.1
neuro-logging==21.9
aiohttp-cors==0.7.0
aiozipkin==1.1.0
asyncpg==0.24.0
sqlalchemy==1.3.23
asyncpgsa==0.27.1
alembic==1.7.4
psycopg2-binary==2.9.1
sentry-sdk==1.4.3
typing-extensions==3.10.0.2
neuro-admin-client==21.9.10

[bdist_wheel]
universal = 1

[options.entry_points]
console_scripts =
platform-api = platform_api.api:main
platform-api-poller = platform_api.poller_main:main

[options.extras_require]
dev =
black==21.9b0
flake8==4.0.1
flake8-isort==4.1.1
isort==5.9.3
mypy==0.910
pre-commit==2.15.0
types-setuptools==57.4.0
aiodocker==0.21.0
codecov==2.1.12
pytest==6.2.5
pytest-asyncio==0.15.1
pytest-cov==3.0.0
requests==2.26.0

[flake8]
ignore = E203,W503
max-line-length = 88
Expand Down
46 changes: 0 additions & 46 deletions setup.py

This file was deleted.

0 comments on commit 4901de6

Please sign in to comment.