Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Remove dependency link usage #16

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,9 @@ It's also possible to install the supported instrumentors as package extras:

```bash
# Supported extras are dbapi, django, flask, pymongo, pymysql, redis, requests, tornado
$ pip install --process-dependency-links 'signalfx-tracing[django,redis,requests]'
$ pip install 'signalfx-tracing[django,redis,requests]'
```

**Note: It's necessary to include `--process-dependency-links` to obtain the desired instrumentor versions.**

### Tracer
Not all stable versions of OpenTracing-compatible tracers support the 2.0 API, so we provide
and recommend installing a modified [Jaeger Client](https://github.com/jaegertracing/jaeger-client-python)
Expand All @@ -103,8 +101,8 @@ ready for reporting to SignalFx. You can obtain an instance of the suggested Jae
```sh
$ sfx-py-trace-bootstrap

# or as package extra (please note required --process-dependency-links)
$ pip install --process-dependency-links 'signalfx-tracing[jaeger]'
# or as package extra
$ pip install 'signalfx-tracing[jaeger]'

# or from project source tree, along with applicable instrumentors
$ scripts/bootstrap.py --jaeger
Expand Down
10 changes: 5 additions & 5 deletions requirements-inst.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dbapi-opentracing
git+https://github.com/signalfx/python-django.git@django_2_ot_2_jaeger#egg=django-opentracing
git+https://github.com/signalfx/python-elasticsearch.git@2.0_support_multiple_versions#egg=elasticsearch-opentracing
git+https://github.com/signalfx/python-flask.git@adopt_scope_manager#egg=flask_opentracing
git+https://github.com/signalfx/jaeger-client-python.git@ot_20_http_sender#egg=jaeger-client
django-opentracing @ git+https://github.com/signalfx/python-django.git@django_2_ot_2_jaeger#egg=django-opentracing
elasticsearch-opentracing @ git+https://github.com/signalfx/python-elasticsearch.git@2.0_support_multiple_versions#egg=elasticsearch-opentracing
flask_opentracing @ git+https://github.com/signalfx/python-flask.git@adopt_scope_manager#egg=flask_opentracing
jaeger-client @ git+https://github.com/signalfx/jaeger-client-python.git@ot_20_http_sender#egg=jaeger-client
pymongo-opentracing
git+https://github.com/opentracing-contrib/python-redis.git@v1.0.0#egg=redis-opentracing
redis-opentracing @ git+https://github.com/opentracing-contrib/python-redis.git@v1.0.0#egg=redis-opentracing
requests-opentracing
tornado_opentracing>=1.0.1
58 changes: 36 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,30 @@ def stripped_dependencies(deps):


def isolated_dependencies(deps):
"""Ensures `pip install --process-dependency-links signalfx-tracing[django,jaeger,redis]` installs desired extras"""
# Takes advantage of limitation of pip and setuptools dependency links.
# Should guarantee supported instrumentor version is installed.
# https://github.com/pypa/pip/issues/3610#issuecomment-356687173
isolated = []
"""
Ensures `pip install signalfx-tracing[django,jaeger,redis]` installs desired extras.
Returns a dictionary of top level package name to amended PEP 508 url with exceedingly high version.
Should guarantee supported instrumentor versions are installed in
absence of dependency links: https://github.com/pypa/pip/issues/4187
"""
isolated = {}
version_operators = ('>=', '==', '<=', '<', '>')
for dep in deps:
if dep[:9] == 'git+https':
isolated.append('{}-999999999'.format(dep))
dep_name = dep
set_versioned_dep_name = False
path_to_split = dep if ',' not in dep else dep.split(',')[0]
operator_hits = [op in path_to_split for op in version_operators]
if any(operator_hits):
dep_name = path_to_split.split(version_operators[operator_hits.index(True)])[0]
set_versioned_dep_name = True

dep_pep508 = dep
if '@' in dep:
if not set_versioned_dep_name:
dep_name = dep.split('@')[0].strip()
dep_pep508 = '{}-999999999'.format(dep)

isolated[dep_name] = dep_pep508
return isolated


Expand All @@ -46,8 +62,7 @@ def isolated_dependencies(deps):

with open(os.path.join(cwd, 'requirements-inst.txt')) as inst_requirements_file:
instrumentors = inst_requirements_file.read().splitlines()
instrumentation_requirements = stripped_dependencies(instrumentors)
dependency_links = isolated_dependencies(instrumentors)
instrumentor_map = isolated_dependencies(instrumentors)

with open(os.path.join(cwd, 'README.md')) as readme_file:
long_description = readme_file.read()
Expand Down Expand Up @@ -80,22 +95,21 @@ def isolated_dependencies(deps):
packages=find_packages(),
install_requires=requirements,
tests_require=unit_test_requirements,
dependency_links=dependency_links,
extras_require=dict(
unit_tests=unit_test_requirements,
instrumentation_tests=integration_test_requirements + instrumentation_requirements,
instrumentation_tests=integration_test_requirements + list(instrumentor_map.values()),
# track with extras list in README
dbapi='dbapi-opentracing',
django='django-opentracing',
elasticsearch='elasticsearch-opentracing',
flask='flask_opentracing',
jaeger='jaeger-client',
psycopg2='dbapi-opentracing',
pymongo='pymongo-opentracing',
pymysql='dbapi-opentracing',
redis='redis-opentracing',
requests='requests-opentracing',
tornado='tornado-opentracing>=1.0.1',
dbapi=instrumentor_map['dbapi-opentracing'],
django=instrumentor_map['django-opentracing'],
elasticsearch=instrumentor_map['elasticsearch-opentracing'],
flask=instrumentor_map['flask_opentracing'],
jaeger=instrumentor_map['jaeger-client'],
psycopg2=instrumentor_map['dbapi-opentracing'],
pymongo=instrumentor_map['pymongo-opentracing'],
pymysql=instrumentor_map['dbapi-opentracing'],
redis=instrumentor_map['redis-opentracing'],
requests=instrumentor_map['requests-opentracing'],
tornado=instrumentor_map['tornado_opentracing']
),
entry_points=dict(
console_scripts=[
Expand Down
26 changes: 20 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ envlist=
py{27,34,35,36}-elasticsearch{20,21,22,23,24,50,51,52,53,54,55,60,61,62,63}
py{27,34,35,36}-flask010-via-bootstrap
py{27,34,35,36}-flask{010,011,012,10}-via-extras
py{27,34,35,36}-jaeger
py{27,34,35,36}-jaeger-pip{18,19}
py{27,34,35,36}-psycopg2-27
py{27,34,35,36}-pymongo{31,32,33,34,35,36,37}
py{27,34,35,36}-pymysql{08,09}
Expand All @@ -24,7 +24,7 @@ basepython =
py34: python3.4
py35: python3.5
py36: python3.6
install_command = pip install --process-dependency-links {opts} {packages}
install_command = pip install {opts} {packages}
extras =
jaeger: jaeger
py{27,34,35,36}: unit_tests
Expand Down Expand Up @@ -114,6 +114,8 @@ deps =
tornado{43,44,45,50,51}: requests
commands =
flake8: flake8 setup.py bootstrap.py signalfx_tracing tests
pip18: pip install pip>=18,<19
pip19: pip install pip>=19,<20
py{27,34,35,36}-unit: pytest tests/unit --ignore tests/unit/libraries -p no:django
django18-via-bootstrap: pip install -U django-opentracing # provides coverage for desired version installation via bootstrap
django18-via-bootstrap: sfx-py-trace-bootstrap
Expand Down Expand Up @@ -147,16 +149,28 @@ commands =
tornado{43,44,45,50,51}: pytest tests/integration/tornado_
tornado{43,44,45,50,51}: pytest tests/unit/libraries/tornado_

[testenv:py27-jaeger]
[testenv:py27-jaeger-pip18]
alwayscopy = true

[testenv:py34-jaeger]
[testenv:py27-jaeger-pip19]
alwayscopy = true

[testenv:py35-jaeger]
[testenv:py34-jaeger-pip18]
alwayscopy = true

[testenv:py36-jaeger]
[testenv:py34-jaeger-pip19]
alwayscopy = true

[testenv:py35-jaeger-pip18]
alwayscopy = true

[testenv:py35-jaeger-pip19]
alwayscopy = true

[testenv:py36-jaeger-pip18]
alwayscopy = true

[testenv:py36-jaeger-pip19]
alwayscopy = true

[flake8]
Expand Down