Skip to content

Commit

Permalink
Make sclack installable from pip in a more universal fashion (#142)
Browse files Browse the repository at this point in the history
Moved app and config within the sclack package
Co-authored-by: Steven McGrath <[email protected]>
Co-authored-by: Mario Rodas <[email protected]>
  • Loading branch information
pprkut committed May 20, 2021
1 parent c44ddbc commit da75272
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
9 changes: 7 additions & 2 deletions app.py → sclack/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,10 +958,15 @@ def ask_for_token(json_config):
config_file.write(json.dumps(token_config, indent=False))
json_config.update(token_config)

if __name__ == '__main__':
def run():
json_config = {}
with open('./config.json', 'r') as config_file:
config_file = os.path.join(
os.path.dirname(os.path.realpath(__file__)), 'config.json')
with open(config_file, 'r') as config_file:
json_config.update(json.load(config_file))
ask_for_token(json_config)
app = App(json_config)
app.start()

if __name__ == '__main__':
run()
File renamed without changes.
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@
author='Marcelo Camargo',
author_email='[email protected]',
url='https://github.com/haskellcamargo/sclack',
scripts=["app.py"],
entry_points={
'console_scripts': [
'sclack=sclack.app:run',
],
},
package_data={
'sclack': ['config.json']
},
packages=find_packages(),
install_requires=[
'asyncio',
Expand Down
4 changes: 2 additions & 2 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from sclack.quick_switcher import remove_diacritic
from app import ask_for_token
from sclack.app import ask_for_token

from slackclient import SlackClient

Expand Down Expand Up @@ -58,4 +58,4 @@ def test_get_members_pagination2():
limit=10, # 1k is max limit
types='public_channel,private_channel,im')
members = client.api_call('conversations.members', channel=channels['channels'][0]['id'], limit=1)
assert members != None and members.get('response_metadata', None) != None
assert members != None and members.get('response_metadata', None) != None

2 comments on commit da75272

@JPTIZ
Copy link

@JPTIZ JPTIZ commented on da75272 Jun 24, 2021

Choose a reason for hiding this comment

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

Very nice

@portothree
Copy link

Choose a reason for hiding this comment

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

Hi, this commit is causing some errors to me and some other users of the package: #146

Please sign in to comment.