Skip to content

Commit

Permalink
Refactored reqs (#603)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Clark <[email protected]>
  • Loading branch information
Anton-Shutik and chrisclark authored Apr 18, 2024
1 parent 3744bc2 commit e5cabf6
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 40 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
recursive-include explorer *
recursive-exclude * *.pyc __pycache__ .DS_Store
recursive-include requirements *
include package.json
include vite.config.js
include README.rst
6 changes: 2 additions & 4 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Django>=3.2
sqlparse>=0.4.0
coverage
factory-boy>=3.1.0
requests~=2.31.0
sql_metadata>=2.10
requests>=2.2
9 changes: 9 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-r ./base.txt
-r ./extra/assistant.txt
-r ./extra/charts.txt
-r ./extra/snapshots.txt
-r ./extra/xls.txt

importlib-metadata<5.0; python_version <= '3.7'
coverage
factory-boy>=3.1.0
3 changes: 3 additions & 0 deletions requirements/extra/assistant.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
openai>=1.6.1
sql_metadata>=2.10
tiktoken>=0.6
2 changes: 2 additions & 0 deletions requirements/extra/charts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
matplotlib<4
seaborn<0.12
2 changes: 2 additions & 0 deletions requirements/extra/snapshots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
boto3>=1.20.0
celery>=4.0
1 change: 1 addition & 0 deletions requirements/extra/xls.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xlsxwriter>=1.3.6
10 changes: 0 additions & 10 deletions requirements/optional.txt

This file was deleted.

29 changes: 9 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
release = get_version(True)


def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def requirements(fname):
path = os.path.join(os.path.dirname(__file__), "requirements", fname)
with open(path) as f:
return f.read().splitlines()


if sys.argv[-1] == "build":
Expand Down Expand Up @@ -74,26 +76,13 @@ def read(fname):
],
python_requires=">=3.8",
install_requires=[
"Django>=3.2",
"sqlparse>=0.4.0",
"requests>=2.2",
requirements("base.txt"),
],
extras_require={
"charts": [
"matplotlib<4",
"seaborn<0.12"
],
"snapshots": [
"boto3>=1.20.0",
"celery>=4.0"
],
"xls": [
"xlsxwriter>=1.3.6"
],
"assistant": [
"openai>=1.6.1",
"tiktoken>=0.6"
]
"charts": requirements("extra/charts.txt"),
"snapshots": requirements("extra/snapshots.txt"),
"xls": requirements("extra/xls.txt"),
"assistant": requirements("extra/assistant.txt"),
},
cmdclass={
"build_sphinx": BuildDoc,
Expand Down
3 changes: 1 addition & 2 deletions test_project/start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

pip install -r ../requirements/base.txt
pip install -r ../requirements/optional.txt
pip install -r ../requirements/dev.txt
pip install django

python ../manage.py migrate
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
envlist =
flake8
isort
{base-reqs,optional}-py{310,311,312}-dj{32,42,50}
{base-reqs,optional}-py{311,312}-dj{50,main}
{base-reqs,dev}-py{310,311,312}-dj{32,42,50}
{base-reqs,dev}-py{311,312}-dj{50,main}

skip_missing_interpreters=True

[testenv]
allowlist_externals = coverage
deps =
base-reqs: -r requirements/base.txt
base-reqs: -r requirements/dev.txt
dj32: django>=3.2,<4.0
dj42: django>=4.2,<5.0
dj50: django>=5.0,<5.1
djmain: https://github.com/django/django/archive/main.tar.gz
optional: -r requirements/optional.txt
dev: -r requirements/dev.txt
commands =
{envpython} --version
{env:COMMAND:coverage} run manage.py test --settings=tests.settings --noinput
Expand Down

0 comments on commit e5cabf6

Please sign in to comment.