thingking-machine 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Alexander Fedotov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ include src/thingking_machine/*.yaml
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.1
2
+ Name: thingking-machine
3
+ Version: 0.0.1
4
+ Summary: Description of the Machine
5
+ Author-email: Alexander Fedotov <alex.fedotov@aol.com>
6
+ Project-URL: Homepage, https://github.com/thingking-machine/thingking-machine
7
+ Project-URL: Bug Tracker, https://github.com/thingking-machine/thingking-machine/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: PyGithub>=2.3.0
15
+ Requires-Dist: PyYAML>=6.0.1
16
+
17
+ # Thingking Machine
18
+ This is a machine that can thingk.
19
+ <pre>
20
+ pip install thingking-machine
21
+ </pre>
22
+ Then:
23
+ ```Python
24
+ # Python
25
+ import thingking_machine
26
+ ```
@@ -0,0 +1,10 @@
1
+ # Thingking Machine
2
+ This is a machine that can thingk.
3
+ <pre>
4
+ pip install thingking-machine
5
+ </pre>
6
+ Then:
7
+ ```Python
8
+ # Python
9
+ import thingking_machine
10
+ ```
@@ -0,0 +1,28 @@
1
+ [build-system]
2
+ requires = ["setuptools>=67.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [tool.setuptools.packages.find]
6
+ where = ["src"]
7
+
8
+ [project]
9
+ name = "thingking-machine"
10
+ version = "0.0.1"
11
+ authors = [
12
+ {name="Alexander Fedotov", email="alex.fedotov@aol.com"},
13
+ ]
14
+ description = "Description of the Machine"
15
+ readme = "README.md"
16
+ requires-python = ">=3.10"
17
+ classifiers=[
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ ]
22
+ dependencies = [
23
+ "PyGithub >= 2.3.0",
24
+ "PyYAML >= 6.0.1"
25
+ ]
26
+ [project.urls]
27
+ "Homepage" = "https://github.com/thingking-machine/thingking-machine"
28
+ "Bug Tracker" = "https://github.com/thingking-machine/thingking-machine/issues"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Python
3
+
4
+ """Copyright (c) Alexander Fedotov.
5
+ This source code is licensed under the license found in the
6
+ LICENSE file in the root directory of this source tree.
7
+ """
8
+ import os
9
+ from . import githf
10
+ import yaml
11
+
12
+
13
+ MACHINE_ORGANIZATION_NAME = 'thingking-machine' # or other organization
14
+ PRIVATE_REPO_WITH_TEXT = 'thingking_machine'
15
+
16
+ try:
17
+ gh = githf.connectto_repo(organization=MACHINE_ORGANIZATION_NAME,
18
+ repository_name=PRIVATE_REPO_WITH_TEXT,
19
+ private=True)
20
+ MACHINE_YAML = githf.read_file(repository=gh, file_path='machina.yaml')
21
+
22
+ except Exception as e:
23
+ machina_path = os.path.join(os.path.dirname(__file__), 'machina.yaml')
24
+ with open(machina_path, 'r') as yaml_file:
25
+ MACHINE_YAML = yaml_file.read()
26
+
27
+ NAME_OF_THE_MACHINE = yaml.load(MACHINE_YAML, Loader=yaml.FullLoader)
@@ -0,0 +1,63 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Python
3
+
4
+ """Copyright (c) Alexander Fedotov.
5
+ This source code is licensed under the license found in the
6
+ LICENSE file in the root directory of this source tree.
7
+ """
8
+ from os import environ
9
+ from github import Github, UnknownObjectException
10
+ from urllib3 import disable_warnings
11
+
12
+
13
+ github_token = environ.get('GITHUB_TOKEN', '')
14
+ github_name = environ.get('GITHUB_NAME', '')
15
+ github_email = environ.get('GITHUB_EMAIL', '')
16
+
17
+ disable_warnings()
18
+
19
+
20
+ # Repo
21
+ def connectto_repo(organization=None,
22
+ repository_name=None,
23
+ private=False):
24
+ """
25
+ Establish connection with a repository.
26
+ Return 'None' if connection fails.
27
+ """
28
+ gh = Github(github_token, verify=False)
29
+ if organization:
30
+ org = gh.get_organization(organization)
31
+ try:
32
+ repo = org.get_repo(f'{repository_name}')
33
+ except UnknownObjectException:
34
+ # print('Can not connect YOU to this repo in this organization')
35
+ repo = None
36
+ return repo
37
+ else:
38
+ user = gh.get_user()
39
+ try:
40
+ repo = user.get_repo(repository_name)
41
+ except UnknownObjectException:
42
+ # print('Can not connect YOU to this repo')
43
+ repo = None
44
+ return repo
45
+
46
+
47
+ def read_file(repository,
48
+ file_path):
49
+ """ Read a file in a repository
50
+ file_path: path to the file formatted as
51
+ 'directory_in_repo/subdirectory/file.ext'
52
+ """
53
+ try:
54
+ # Get the file if it exists
55
+ ingested_file = repository.get_contents(file_path)
56
+ content = ingested_file.decoded_content.decode("utf-8")
57
+
58
+ except UnknownObjectException:
59
+ # The file doesn't exist
60
+ # print('The file does not exist')
61
+ content = ''
62
+
63
+ return content
@@ -0,0 +1,2 @@
1
+ name: thingking_machine
2
+ description: A machine that can thingk.
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.1
2
+ Name: thingking-machine
3
+ Version: 0.0.1
4
+ Summary: Description of the Machine
5
+ Author-email: Alexander Fedotov <alex.fedotov@aol.com>
6
+ Project-URL: Homepage, https://github.com/thingking-machine/thingking-machine
7
+ Project-URL: Bug Tracker, https://github.com/thingking-machine/thingking-machine/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: PyGithub>=2.3.0
15
+ Requires-Dist: PyYAML>=6.0.1
16
+
17
+ # Thingking Machine
18
+ This is a machine that can thingk.
19
+ <pre>
20
+ pip install thingking-machine
21
+ </pre>
22
+ Then:
23
+ ```Python
24
+ # Python
25
+ import thingking_machine
26
+ ```
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ src/thingking_machine/__init__.py
6
+ src/thingking_machine/githf.py
7
+ src/thingking_machine/machina.yaml
8
+ src/thingking_machine.egg-info/PKG-INFO
9
+ src/thingking_machine.egg-info/SOURCES.txt
10
+ src/thingking_machine.egg-info/dependency_links.txt
11
+ src/thingking_machine.egg-info/requires.txt
12
+ src/thingking_machine.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ PyGithub>=2.3.0
2
+ PyYAML>=6.0.1
@@ -0,0 +1 @@
1
+ thingking_machine