Skip to content

Commit 59e3e86

Browse files
Migrate setup.py to pyproject.toml #11057
1 parent 3bc2f75 commit 59e3e86

File tree

25 files changed

+152
-347
lines changed

25 files changed

+152
-347
lines changed

.github/workflows/main.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ jobs:
4242
- name: Install Python packages
4343
run: |
4444
python -m pip install --upgrade pip
45-
pip install .
46-
pip install -r ${{ github.event.repository.name }}/install/requirements.txt
47-
pip install -r ${{ github.event.repository.name }}/install/requirements_dev.txt
45+
pip install '.[dev]'
4846
echo Python packages installed
4947
5048
- uses: ankane/setup-elasticsearch@v1
@@ -144,9 +142,7 @@ jobs:
144142
- name: Install Python packages
145143
run: |
146144
python -m pip install --upgrade pip
147-
pip install .
148-
pip install -r ${{ github.event.repository.name }}/install/requirements.txt
149-
pip install -r ${{ github.event.repository.name }}/install/requirements_dev.txt
145+
pip install '.[dev]'
150146
echo Python packages installed
151147
152148
- uses: ankane/setup-elasticsearch@v1

.travis.yml

-116
This file was deleted.

Dockerfile

+2-12
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ FROM base as wheelbuilder
1414

1515
WORKDIR ${WHEELS}
1616

17-
# Install pip requirements files
18-
COPY ./arches/install/requirements.txt ${WHEELS}/requirements.txt
19-
COPY ./arches/install/requirements_dev.txt ${WHEELS}/requirements_dev.txt
20-
2117
# Install packages required to build the python libs, then remove them
2218
RUN set -ex \
2319
&& BUILD_DEPS=" \
@@ -42,9 +38,7 @@ RUN set -ex \
4238
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
4339
&& python3.8 get-pip.py
4440

45-
RUN pip3 wheel --no-cache-dir -b /tmp -r ${WHEELS}/requirements.txt \
46-
&& pip3 wheel --no-cache-dir -b /tmp -r ${WHEELS}/requirements_dev.txt \
47-
&& pip3 wheel --no-cache-dir -b /tmp gunicorn \
41+
RUN pip3 wheel --no-cache-dir -b /tmp gunicorn \
4842
&& pip3 wheel --no-cache-dir -b /tmp django-auth-ldap
4943

5044
# Add Docker-related files
@@ -100,10 +94,6 @@ RUN python3.8 -m venv ENV \
10094
&& pip install requests \
10195
&& pip install -f ${WHEELS} django-auth-ldap \
10296
&& pip install -f ${WHEELS} gunicorn \
103-
&& pip install -r ${WHEELS}/requirements.txt \
104-
-f ${WHEELS} \
105-
&& pip install -r ${WHEELS}/requirements_dev.txt \
106-
-f ${WHEELS} \
10797
&& rm -rf ${WHEELS} \
10898
&& rm -rf /root/.cache/pip/*
10999

@@ -115,7 +105,7 @@ COPY . ${ARCHES_ROOT}
115105
WORKDIR ${ARCHES_ROOT}
116106

117107
RUN . ../ENV/bin/activate \
118-
&& pip install -e . --no-binary :all:
108+
&& pip install -e '.[dev]' --no-binary :all:
119109

120110
# Set default workdir
121111
WORKDIR ${ARCHES_ROOT}

MANIFEST.in

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
recursive-include arches *
22
include README.md
33
exclude Dockerfile
4+
exclude manage.py
45
exclude arches/logs/*.txt
56
exclude arches/settings_local.py
67
exclude .*
78
exclude *.yml
89
recursive-exclude .eggs *
910
recursive-exclude .github *
1011
recursive-exclude .idea *
12+
recursive-exclude contributing *
13+
recursive-exclude cypress *
1114
recursive-exclude docker *
15+
recursive-exclude node_modules *
16+
recursive-exclude releases *
1217
recursive-exclude tests *
1318
recursive-exclude docs *
1419
recursive-exclude virtualenv *
15-
recursive-exclude arches/elasticsearch *
20+
recursive-exclude webpack *
1621
recursive-exclude arches/uploadedfiles *
17-
recursive-exclude arches/tileserver *
18-
recursive-exclude arches/app/media/packages *
19-
recursive-exclude arches/app/media/js/docs *
22+
recursive-exclude arches/staticfiles *
23+
recursive-exclude arches/app/media/build *
2024
global-exclude *.log
2125
global-exclude *.pyc
2226
global-exclude *.zip

arches/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import absolute_import
2-
from arches.setup import get_version
2+
from arches.version import get_version
33

44
try:
55
# This will make sure the app is always imported when

arches/app/utils/data_management/resources/importer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from arches.app.models.system_settings import settings
3434
from arches.app.utils.betterJSONSerializer import JSONSerializer, JSONDeserializer
3535
from arches.app.utils.i18n import capitalize_region
36-
from arches.setup import unzip_file
36+
from arches.app.utils.zip import unzip_file
3737
from .formats.csvfile import CsvReader
3838
from .formats.archesfile import ArchesFileReader
3939
import ctypes

arches/app/utils/zip.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
"""
1818

19-
import os
19+
import tarfile
2020
import zipfile
21-
import datetime
2221
from io import BytesIO
23-
from arches.app.models import models
22+
2423
from django.http import HttpResponse
2524

2625

@@ -54,3 +53,15 @@ def zip_response(files_for_export, zip_file_name=None, filekey="outputfile"):
5453
response["Content-Type"] = "application/zip"
5554
response.write(zip_stream)
5655
return response
56+
57+
58+
def unzip_file(file_name, unzip_location):
59+
try:
60+
# first assume you have a .tar.gz file
61+
tar = tarfile.open(file_name, "r:gz")
62+
tar.extractall(path=unzip_location)
63+
tar.close()
64+
except:
65+
# next assume you have a .zip file
66+
with zipfile.ZipFile(file_name, "r") as myzip:
67+
myzip.extractall(unzip_location)

arches/install/arches-templates/.github/workflows/main.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ jobs:
4242
- name: Install Python packages
4343
run: |
4444
python -m pip install --upgrade pip
45-
pip install .
46-
pip install -r ${{ github.event.repository.name }}/install/requirements.txt
47-
pip install -r ${{ github.event.repository.name }}/install/requirements_dev.txt
45+
pip install '.[dev]'
4846
echo Python packages installed
4947
5048
- uses: ankane/setup-elasticsearch@v1
@@ -144,9 +142,7 @@ jobs:
144142
- name: Install Python packages
145143
run: |
146144
python -m pip install --upgrade pip
147-
pip install .
148-
pip install -r ${{ github.event.repository.name }}/install/requirements.txt
149-
pip install -r ${{ github.event.repository.name }}/install/requirements_dev.txt
145+
pip install '.[dev]'
150146
echo Python packages installed
151147
152148
- uses: ankane/setup-elasticsearch@v1

arches/install/arches-templates/project_name/install/requirements.txt

-1
This file was deleted.

arches/install/arches-templates/project_name/install/requirements_dev.txt

-6
This file was deleted.

arches/install/arches-templates/pyproject.toml

+11-1
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,23 @@ classifiers = [
2020
"Intended Audience :: Developers",
2121
"Intended Audience :: Science/Research",
2222
"Intended Audience :: Information Technology",
23-
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
23+
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
2424
]
2525
requires-python = ">=3.10"
2626
dependencies = [
2727
"arches>={{ arches_semantic_version }},<{{ arches_next_minor_version }}",
2828
]
2929
version = "0.0.1"
3030

31+
[project.optional-dependencies]
32+
dev = [
33+
"livereload",
34+
"sst",
35+
"coverage",
36+
"django-silk==5.1.0",
37+
"pre-commit",
38+
"black==24.4.2",
39+
]
40+
3141
[tool.setuptools]
3242
packages = ["{{ project_name }}"]

arches/install/arches-templates/tests/test_settings.py-tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import os
2222

2323
try:
2424
from django.utils.translation import gettext_lazy as _
25-
except ImportError: # unable to import prior to installing requirements.txt in setup.py
25+
except ImportError: # unable to import prior to installing requirements
2626
pass
2727

2828
PACKAGE_NAME = "{{ project_name }}"

arches/install/arches-admin renamed to arches/install/arches_admin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
import sys
88
import subprocess
99

10-
from importlib import import_module
1110
from django.core.management.templates import TemplateCommand
1211
from django.core.management.base import CommandError
1312
from django.utils.crypto import get_random_string
13+
1414
from arches import __version__
15-
from arches.setup import get_complete_version
15+
from arches.version import get_complete_version
1616

1717

1818
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "arches.settings")

arches/install/arches-project renamed to arches/install/arches_project.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@
33
import arches
44
import argparse
55
import codecs
6-
import django
7-
import errno
86
import os
97
import sys
108
import subprocess
11-
import shutil
12-
from importlib import import_module
9+
1310
from django.utils.crypto import get_random_string
14-
from django.core.management.utils import handle_extensions
1511
from django.core.management.templates import TemplateCommand
16-
from django.core.management.base import BaseCommand, CommandError
17-
from arches.setup import get_complete_version
18-
from arches.management.commands import utils
12+
from django.core.management.base import CommandError
13+
14+
from arches.version import get_complete_version
1915

2016

2117
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "arches.settings")

arches/install/ci_install/install_arches.sh

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ source /home/ubuntu/ENV/bin/activate
1919

2020
cd /home/ubuntu/arches
2121
pip install -e . --no-binary :all:
22-
pip install -r arches/install/requirements.txt
2322

2423
# cd /home/ubuntu
2524
# arches-project create arches_dev

0 commit comments

Comments
 (0)