Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up shop with SetupShop #200

Merged
merged 9 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@ version: 2
jobs:
test:
docker:
- image: circleci/python:3.7.2
- image: circleci/python:latest
environment:
LTA_MONGODB_URL: mongodb://localhost:27017
LTA_MONGODB_NAME: lta-unit-tests
TOKEN_SERVICE: http://localhost:12345
AUTH_SECRET: lkjlksdldkfjlsdjflsdnfkl
- image: circleci/mongo:3.7.9-ram
AUTH_SECRET: hunter2
- image: circleci/mongo:latest-ram
- image: wipac/token-service:latest
environment:
port: 12345
auth_secret: lkjlksdldkfjlsdjflsdnfkl
auth_secret: hunter2
command: [python, test_server.py]
steps:
- checkout
- run: ./setupenv.sh
- run: |
. env/bin/activate &&
pycycle --here --verbose &&
resources/enable_profiling.py &&
./snake rebuild &&
resources/profile_queries.py
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/try-setup-install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Try Setup Install

on: [push]

jobs:

gather-py3-versions:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.py3_versions.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- name: Python Versions
id: py3_versions
run: |
minmin_maxmax=$(grep -P "\(\(\d+, ?\d+\), ?\(\d+, ?\d+\)\)" -oh setup.py | sed 's/[^0-9]/ /g')
IFS=', ' read -r -a array <<< "$minmin_maxmax"
min_thru_max_series=$(for i in `seq ${array[1]} ${array[3]}`; do printf "3.$i,"; done | rev | cut -c 2- | rev)
echo ::set-output name=matrix::{\"py3_versions\":[$(echo $min_thru_max_series)]}\"

setup-py-install:
needs: gather-py3-versions
runs-on: ubuntu-latest

strategy:
max-parallel: 4
fail-fast: false
matrix: ${{ fromJSON(needs.gather-py3-versions.outputs.matrix) }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py3_versions }}
- run: |
echo ${{ matrix.py3_versions }}
python setup.py install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: Try Setup Install
on: [push]
jobs:
gather-py3-versions:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.py3_versions.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- name: Python Versions
id: py3_versions
run: |
minmin_maxmax=$(grep -P "\(\(\d+, ?\d+\), ?\(\d+, ?\d+\)\)" -oh setup.py | sed 's/[^0-9]/ /g')
IFS=', ' read -r -a array <<< "$minmin_maxmax"
min_thru_max_series=$(for i in `seq ${array[1]} ${array[3]}`; do printf "3.$i,"; done | rev | cut -c 2- | rev)
echo ::set-output name=matrix::{\"py3_versions\":[$(echo $min_thru_max_series)]}\"
setup-py-install:
needs: gather-py3-versions
runs-on: ubuntu-latest
strategy:
max-parallel: 4
fail-fast: false
matrix: ${{ fromJSON(needs.gather-py3-versions.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py3_versions }}
- run: |
echo ${{ matrix.py3_versions }}
python setup.py install
name: Try Setup Install
on: [push]
jobs:
gather-py3-versions:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.py3_versions.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- name: Python Versions
id: py3_versions
run: |
minmin_maxmax=$(grep -P "\(\(\d+, ?\d+\), ?\(\d+, ?\d+\)\)" -oh setup.py | sed 's/[^0-9]/ /g')
IFS=', ' read -r -a array <<< "$minmin_maxmax"
min_thru_max_series=$(for i in `seq ${array[1]} ${array[3]}`; do printf "'3.$i',"; done | rev | cut -c 2- | rev)
echo ::set-output name=matrix::{\"py3_versions\":[$(echo $min_thru_max_series)]}\"
echo $min_thru_max_series
pip-install:
needs: gather-py3-versions
runs-on: ubuntu-latest
strategy:
max-parallel: 4
fail-fast: false
matrix: ${{ fromJSON(needs.gather-py3-versions.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py3_versions }}
- run: |
pip install --upgrade pip wheel setuptools
pip install --editable .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 changes: 3 additions & 1 deletion lta/lta_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from typing import Any, Dict, List, Optional, Tuple

import colorama # type: ignore
from colorama import Fore, Style # Back
import hurry.filesize # type: ignore
from rest_tools.client import RestClient # type: ignore
from rest_tools.server import from_environment # type: ignore
Expand All @@ -26,6 +25,9 @@

Namespace = argparse.Namespace

Fore = colorama.Fore
Style = colorama.Style

ExitCode = int
EXIT_OK = 0
EXIT_ERROR = 1
Expand Down
17 changes: 10 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
binpacking==1.4.3
binpacking==1.4.5
colorama==0.4.4
flake8==3.9.1
flake8==3.9.2
hurry.filesize==0.9
motor==2.4.0
mypy==0.812
numpy==1.20.3
prometheus-client==0.10.1
pymongo==3.11.3
pytest==6.2.3
pycycle==0.0.8
pymongo==3.11.4
pytest==6.2.4
pytest-asyncio==0.15.1
pytest-cov==2.11.1
pytest-mock==3.5.1
pytest-cov==2.12.0
pytest-mock==3.6.1
requests==2.25.1
-e git+https://github.com/WIPACrepo/rest-tools@v1.0.7#egg=rest_tools
git+https://github.com/WIPACrepo/rest-tools@v1.0.7#egg=rest_tools
tornado==6.1
git+https://github.com/WIPACrepo/wipac-dev-tools@v1.0.7#egg=wipac_dev_tools
101 changes: 30 additions & 71 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,80 +1,39 @@
#!/usr/bin/env python

import os
import sys
import glob
import os
from setuptools import setup # type: ignore[import]
import subprocess

if sys.version_info < (3, 6):
print('ERROR: LTA requires at least Python 3.6+ to run.')
sys.exit(1)

try:
# Use setuptools if available, for install_requires (among other things).
import setuptools # type: ignore
setup = setuptools.setup
except ImportError:
setuptools = None
from distutils.core import setup

kwargs = {}

current_path = os.path.dirname(os.path.realpath(__file__))

with open(os.path.join(current_path, 'lta', '__init__.py')) as f:
for line in f.readlines():
if '__version__' in line:
kwargs['version'] = line.replace('"', "'").split('=')[-1].split("'")[1]
break
else:
raise Exception('cannot find __version__')

with open(os.path.join(current_path, 'README.md')) as f:
kwargs['long_description'] = f.read()
subprocess.run(
"pip install --upgrade pip".split(),
check=True,
)
subprocess.run(
"pip install git+https://github.com/WIPACrepo/wipac-dev-tools.git".split(),
check=True,
)
from wipac_dev_tools import SetupShop # noqa: E402 # pylint: disable=C0413

if setuptools is not None:
# If setuptools is not available, you're on your own for dependencies.
install_requires = [
'coverage>=4.4.2',
'PyJWT',
'pymongo',
'requests',
'requests_toolbelt',
'requests-futures',
'sphinx>=1.4',
'tornado>=5.1'
]
kwargs['install_requires'] = install_requires # type: ignore
kwargs['zip_safe'] = False # type: ignore
shop = SetupShop(
"lta",
os.path.abspath(os.path.dirname(__file__)),
((3, 6), (3, 10)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how the GH Action will act with grabbing 3.10. But I see there's an issue

Copy link
Member

@ric-evans ric-evans May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

running the bash lines locally, I get 3.6,3.7,3.8,3.9,3.10 so I'm inclined to think that this is happening because 3.10 has not been released. Or there's a bug in the tool I use (https://github.com/actions/setup-python).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh I found the issue...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"LTA is the Long Term Archive service and related tools, developed for the IceCube Collaboration.",
)

setup(
name='lta',
scripts=glob.glob('bin/*'),
packages=['lta'],
package_data={
# data files need to be listed both here (which determines what gets
# installed) and in MANIFEST.in (which determines what gets included
# in the sdist tarball)
# 'iceprod.server':['data/etc/*','data/www/*','data/www_templates/*'],
},
author="IceCube Collaboration",
author_email="developers@icecube.wisc.edu",
scripts=glob.glob("bin/*"),
url="https://github.com/WIPACrepo/lta",
license="https://github.com/WIPACrepo/lta/blob/master/LICENSE",
description="LTA is the Long Term Archive service and related tools, developed for the IceCube Collaboration.",
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',

'Operating System :: POSIX :: Linux',
'Topic :: System :: Distributed Computing',

'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
],
**kwargs
# package_data={shop.name: ["py.typed"]},
**shop.get_kwargs(
subpackages=["transfer"],
other_classifiers=[
"Operating System :: POSIX :: Linux",
"Topic :: System :: Distributed Computing",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: Implementation :: CPython",
],
),
zip_safe=False,
)