Skip to content

Commit

Permalink
Merge pull request #67 from atsign-foundation/cpswan-add-setup.py
Browse files Browse the repository at this point in the history
build(deps): add setup.py
  • Loading branch information
cpswan authored Oct 12, 2023
2 parents ffa57fe + 20886b2 commit 39b9bf1
Show file tree
Hide file tree
Showing 7 changed files with 278 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python3 -m pip install --require-hashes -r requirements.txt
python3 -m pip install --require-hashes -r requirements.dev
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/update_python_requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ jobs:
run: |
poetry update
poetry export --format requirements.txt --output requirements.txt
poetry export --format requirements.txt --output requirements.dev --with dev
git config --global user.name 'dependabot[bot]'
git config --global user.email 'dependabot[bot]@users.noreply.github.com'
git add requirements.txt
git add requirements.txt requirements.dev
if [ -z "$(git status --porcelain)" ]; then
echo 'No changes to commit on this run'
exit 0
Expand Down
13 changes: 8 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
[tool.poetry]
name = "at_python"
version = "0.0.1"
version = "0.0.2"
description = "Python SDK for atPlatform"
authors = ["Umang Shah <[email protected]>"]
authors = ["Umang Shah <[email protected]>","Chris Swan <@cpswan>"]
maintainers = ["Chris Swan <@cpswan>"]
readme = "README.md"
packages = [{include = "at_client"}]
homepage = "https://github.com/atsign-foundation/at_python"

[tool.poetry.dependencies]
python = "^3.8.1"
pip ="23.2.1"
cffi = "1.16.0"
cryptography = "41.0.4"
flake8 = "6.1.0"
pycparser = "2.21"
pytest = "7.4.2"
python-dateutil = "2.8.2"
requests = "2.31.0"
six = "1.16.0"

[tool.poetry.group.dev.dependencies]
pip ="23.2.1"
flake8 = "6.1.0"
pytest = "7.4.2"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
225 changes: 225 additions & 0 deletions requirements.dev

Large diffs are not rendered by default.

36 changes: 0 additions & 36 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ charset-normalizer==3.3.0 ; python_full_version >= "3.8.1" and python_full_versi
--hash=sha256:f5969baeaea61c97efa706b9b107dcba02784b1601c74ac84f2a532ea079403e \
--hash=sha256:f8888e31e3a85943743f8fc15e71536bda1c81d5aa36d014a3c0c44481d7db6e \
--hash=sha256:fc52b79d83a3fe3a360902d3f5d79073a993597d48114c29485e9431092905d8
colorama==0.4.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" and sys_platform == "win32" \
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
cryptography==41.0.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:004b6ccc95943f6a9ad3142cfabcc769d7ee38a3f60fb0dddbfb431f818c3a67 \
--hash=sha256:047c4603aeb4bbd8db2756e38f5b8bd7e94318c047cfe4efeb5d715e08b49311 \
Expand All @@ -172,42 +169,12 @@ cryptography==41.0.4 ; python_full_version >= "3.8.1" and python_full_version <
--hash=sha256:cecfefa17042941f94ab54f769c8ce0fe14beff2694e9ac684176a2535bf9714 \
--hash=sha256:e40211b4923ba5a6dc9769eab704bdb3fbb58d56c5b336d30996c24fcf12aadb \
--hash=sha256:efc8ad4e6fc4f1752ebfb58aefece8b4e3c4cae940b0994d43649bdfce8d0d4f
exceptiongroup==1.1.3 ; python_full_version >= "3.8.1" and python_version < "3.11" \
--hash=sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9 \
--hash=sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3
flake8==6.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:d5b3857f07c030bdb5bf41c7f53799571d75c4491748a3adcd47de929e34cd23 \
--hash=sha256:ffdfce58ea94c6580c77888a86506937f9a1a227dfcd15f245d694ae20a6b6e5
idna==3.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \
--hash=sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2
iniconfig==2.0.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \
--hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374
mccabe==0.7.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325 \
--hash=sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e
packaging==23.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5 \
--hash=sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7
pip==23.2.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be \
--hash=sha256:fb0bd5435b3200c602b5bf61d2d43c2f13c02e29c1707567ae7fbc514eb9faf2
pluggy==1.3.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12 \
--hash=sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7
pycodestyle==2.11.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:259bcc17857d8a8b3b4a2327324b79e5f020a13c16074670f9c8c8f872ea76d0 \
--hash=sha256:5d1013ba8dc7895b548be5afb05740ca82454fd899971563d2ef625d090326f8
pycparser==2.21 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9 \
--hash=sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206
pyflakes==3.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:4132f6d49cb4dae6819e5379898f2b8cce3c5f23994194c24b77d5da2e36f774 \
--hash=sha256:a0aae034c444db0071aa077972ba4768d40c830d9539fd45bf4cd3f8f6992efc
pytest==7.4.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:1d881c6124e08ff0a1bb75ba3ec0bfd8b5354a01c194ddd5a0a870a48d99b002 \
--hash=sha256:a766259cfab564a2ad52cb1aae1b881a75c3eb7e34ca3779697c23ed47c47069
python-dateutil==2.8.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \
--hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9
Expand All @@ -217,9 +184,6 @@ requests==2.31.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0
six==1.16.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \
--hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254
tomli==2.0.1 ; python_full_version >= "3.8.1" and python_version < "3.11" \
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
urllib3==2.0.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" \
--hash=sha256:7a7c7003b000adf9e7ca2a377c9688bbc54ed41b985789ed576570342a375cd2 \
--hash=sha256:b19e1a85d206b56d7df1d5e683df4a7725252a964e3993648dd0fb5a1c157564
41 changes: 41 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['at_client',
'at_client.common',
'at_client.connections',
'at_client.connections.notification',
'at_client.exception',
'at_client.util']

package_data = \
{'': ['*']}

install_requires = \
['cffi==1.16.0',
'cryptography==41.0.4',
'pycparser==2.21',
'python-dateutil==2.8.2',
'requests==2.31.0',
'six==1.16.0']

setup_kwargs = {
'name': 'at_python',
'version': '0.0.2',
'description': 'Python SDK for atPlatform',
'long_description': '<img width=250px src="https://atsign.dev/assets/img/atPlatform_logo_gray.svg?sanitize=true">\n\n[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/atsign-foundation/at_python/badge)](https://api.securityscorecards.dev/projects/github.com/atsign-foundation/at_python)\n\n# The atPlatform for Python developers - (Alpha Version)\n\nThis repo contains library, samples and examples for developers who wish\nto work with the atPlatform from Python code.\n\n## Getting Started\n### 1. Installation\n```\npip install -r requirements.txt\npip install .\n```\n\n\n\n### 2. Setting up your `.atKeys`\nTo run the examples save .atKeys file in the \'~/.atsign/keys/\' directory.\n\n### 3. Sending and Receiving Data\nThere are 3 ways in which data can be sent and received from at server.\n1. Using PublicKey\n ```python\n from at_client import AtClient\n from at_client.common import AtSign\n from at_client.common.keys import PublicKey\n\n atsign = AtSign("@bob")\n atclient = AtClient(atsign)\n pk = PublicKey("key", atsign)\n\n # Sending data\n response = atclient.put(pk, "value")\n print(response)\n\n # Receiving Data\n response = atclient.get(pk)\n print(response)\n\n # Deleting data\n response = atclient.delete(pk)\n print(response)\n\n ```\n\n2. Using SelfKey\n ```python\n from at_client import AtClient\n from at_client.common import AtSign\n from at_client.common.keys import SelfKey\n\n atsign = AtSign("@bob")\n atclient = AtClient(atsign)\n sk = SelfKey("key", atsign)\n\n # Sending data\n response = atclient.put(sk, "value")\n print(response)\n\n # Receiving Data\n response = atclient.get(sk)\n print(response)\n\n # Deleting data\n response = atclient.delete(sk)\n print(response)\n\n ```\n\n3. Using SharedKey\n ```python\n from at_client import AtClient\n from at_client.common import AtSign\n from at_client.common.keys import SharedKey\n\n bob = AtSign("@bob")\n alice = AtSign("@alice")\n bob_atclient = AtClient(bob)\n sk = SharedKey("key", bob, alice)\n\n # Sending data\n response = bob_atclient.put(sk, "value")\n print(response)\n\n # Receiving Data\n alice_atclient = AtClient(alice)\n response = alice_atclient.get(sk)\n print(response)\n\n # Deleting data\n response = bob_atclient.delete(sk)\n print(response)\n\n ```\n\n\t\n### CLI Tools\n* **REPL** - you can use this to type atPlatform commands and see responses; but the best thing about the REPL currently is that it shows the data notifications as they are received. The REPL code has the essentials of what a \'receiving\' client needs to do - i.e.\n\t* create an AtClient (assigning a Queue object to its queue parameter)\n\t* start two new threads\n * one for the AtClient.start_monitor() task: receives data update/delete notification events (the event data contains the ciphertext)\n * the other one calls handle_event() method, which will read the upcoming events in the queue and handle them: \n\t\t\t* calling AtClient.handle_event() (to decrypt the notifications and introducing the result as a new event in the queue) \n\t\t\t* reading the new event, which contains the decrypted result \n\t* Instructions to run the REPL:\n\t\t1) Run repl.py and choose an atSign using option `1`\n\t\t2) Select option `2`. REPL will start and activate monitor mode automatically in a different thread. You can still send commands/verbs. You will start seeing your own notifications (from yourself to yourself) and heartbeat working (noop verb is sent from time to time as a keepalive)\n\t\t3) Use `at_talk` or any other tool to send notifications to your atSign from a different atSign. You should be able to see the complete notification, and the encrypted and decrypted value of it.\n\n* **REGISTER** - use this cli to register new free atsign. Uses onboarding cli to create atkey files.\n\t* Use following command to run the REGISTER cli using email:\n\t\t```shell\n python register.py -e <email>\n ```\n * Use following command to run the REGISTER cli using api-key:\n\t\t```shell\n python register.py -k <api-key>\n ```\n\n* **ONBOARDING** - use this cli to onboard a new atSign. Once onboarding is complete it creates the all-important keys file. Onboard is a subset of Register.\n\t* Use following command to run the ONBOARDING cli:\n\t\t```shell\n python onboarding.py -a <atsign> -c <cram-secret>\n ```\n\n* **SHARE** - use this cli to share data between 2 atsigns.\n\t* Use following command to run the SHARE cli:\n\t\t```shell\n python share.py -a <atsign> -o <other-atsign> -k <key-name> -s <value>\n ```\n\n* **GET** - use this cli to get shared data between 2 atsigns.\n\t* Use following command to run the GET cli:\n\t\t```shell\n python get.py -a <atsign> -o <other-atsign> -k <key-name>\n ```\n\n* **DELETE** - use this cli to delete any key shared between 2 atsigns.\n\t* Use following command to run the DELETE cli:\n\t\t```shell\n python delete.py -a <atsign> -o <other-atsign> -k <key-name>\n ```\n\n## Open source usage and contributions\n\nThis is open source code, so feel free to use it as is, suggest changes or\nenhancements or create your own version. See [CONTRIBUTING.md](./CONTRIBUTING.md)\nfor detailed guidance on how to setup tools, tests and make a pull request.\n\n## Maintainers\n\nThis project is created and maintained by [Umang Shah](https://github.com/shahumang19)\n',
'author': 'Umang Shah',
'author_email': '[email protected]',
'maintainer': 'Chris Swan',
'maintainer_email': '@cpswan',
'url': 'https://github.com/atsign-foundation/at_python',
'packages': packages,
'package_data': package_data,
'install_requires': install_requires,
'python_requires': '>=3.8.1,<4.0.0',
}


setup(**setup_kwargs)

1 change: 1 addition & 0 deletions update_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# in our Python dependencies. So we need to run this to generate a
# new requirements.txt from the updated files.
poetry export --format requirements.txt --output requirements.txt
poetry export --format requirements.txt --output requirements.dev --with dev
# of course this assumes that poetry is installed, which is done by:
## curl -sSL https://install.python-poetry.org | python3 -
# see https://github.com/atsign-foundation/at_server/pull/1065 for
Expand Down

0 comments on commit 39b9bf1

Please sign in to comment.