Skip to content

Conversation

@jmartinezbernet
Copy link

@jmartinezbernet jmartinezbernet commented Dec 16, 2020

Description

With this setup we can include this repository as a requirement to install in other projects by using pip install

How to test

  • In your fever2 project, edit the requirements.txt and change:
    Find and replace this line
Salesforce-FuelSDK==1.3.0

For this one

-e git+https://github.com/Feverup/FuelSDK-Python.git@feature/FuelSDK-1_setup_to_install_with_requirements#egg=Fever-FuelSDK
  • Run pip install
  • Invalidate cache in Pycharm and restart
  • Check the new installed library is the Fever one
  • Run the app. It should up as always

@jmartinezbernet jmartinezbernet self-assigned this Dec 16, 2020
@mikirockerful
Copy link

mikirockerful commented Feb 1, 2021

Test results:

  • requirements.txt modified
  • Installing dependencies, I get the Fever version of the package:
Obtaining Fever-FuelSDK from git+https://github.com/Feverup/FuelSDK-Python.git@feature/FuelSDK-1_setup_to_install_with_requirements#egg=Fever-FuelSDK (from -r requirements/./requirements-production.txt (line 35))
  Updating /home/vagrant/venv/src/fever-fuelsdk clone (to revision feature/FuelSDK-1_setup_to_install_with_requirements)
  Running command git fetch -q --tags
  Running command git reset --hard -q 7aeeef3c850719812d8cc75387332e7067a3de64
  • In a console, I can import resources of the module. I can get the package information for the Fever version, and not for the Salesforce original version (it's not there anymore).
from FuelSDK import ET_Client
from pkg_resources import get_distribution
pkg = get_distribution('Salesforce-FuelSDK')
Traceback (most recent call last):
  File "/home/vagrant/venv/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3343, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-5-b4a3b2b8aa1d>", line 1, in <module>
    pkg = get_distribution('Salesforce-FuelSDK')
  File "/home/vagrant/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 482, in get_distribution
    dist = get_provider(dist)
  File "/home/vagrant/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 358, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/home/vagrant/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/vagrant/venv/lib/python3.6/site-packages/pkg_resources/__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'Salesforce-FuelSDK' distribution was not found and is required by the application
pkg = get_distribution('Fever-FuelSDK')
pkg.__dict__
Out[7]: 
{'project_name': 'Fever-FuelSDK',
 'py_version': None,
 'platform': None,
 'location': '/home/vagrant/venv/src/fever-fuelsdk',
 'precedence': -1,
 '_provider': <pkg_resources.PathMetadata at 0x7f768a0108d0>,
 '_version': '1.3.1',
 '_key': 'fever-fuelsdk'}
  • The application runs as usual

@jmartinezbernet jmartinezbernet marked this pull request as ready for review February 1, 2021 12:12
Copy link

@mikirockerful mikirockerful left a comment

Choose a reason for hiding this comment

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

LGTM!

@mikirockerful mikirockerful merged commit 3b4c1d9 into master Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants