Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.3.0 preparing #526

Merged
merged 41 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6de062c
Start of implementation of channel caching
Arondondon Oct 11, 2024
f036279
Implemented cache updating and loading to output channels info.
Arondondon Oct 14, 2024
d63b166
Merge branch 'predev-channels-caching' into channels-caching
Arondondon Oct 15, 2024
14b6ce8
Merge pull request #515 from singnet/channels-caching
Arondondon Oct 15, 2024
e8e43a7
Add generation of documentation in Markdown format
mabredin Oct 16, 2024
7ca802e
Clarify variable names
mabredin Oct 16, 2024
bd00e33
Finished changes in "snet channel" section.
Arondondon Oct 16, 2024
d2db5f4
Changed "client call" command. Deleted unnecessary methods in mpe_cha…
Arondondon Oct 16, 2024
06506c5
Merge pull request #516 from singnet/markdown_autogeneration
sassless Oct 16, 2024
8541f4d
Fixed "print" commands in "channel" section.
Arondondon Oct 16, 2024
ebc077a
Merge remote-tracking branch 'origin/development' into development
Arondondon Oct 16, 2024
396ed0b
Added script for building docs on Windows and changed generate_markdo…
Arondondon Oct 22, 2024
303c589
Merge pull request #519 from singnet/build-docs-for-win
Arondondon Oct 22, 2024
f694f6a
Removed deprecated functionality
Arondondon Oct 22, 2024
50a4b1d
Fixed "snet channel metadata-init-utility" command with wrong "encodi…
Arondondon Oct 23, 2024
2d4f47b
Updated README.md for building documentation
Arondondon Oct 24, 2024
9ca7975
Got rid of the "goerli" network in the default config.
Arondondon Oct 24, 2024
c2d04c3
Fixed contract names in "snet contract" command.
Arondondon Oct 25, 2024
5cea472
header level fix
kiruxaspb Oct 28, 2024
6a6bd69
Merge pull request #521 from singnet/fix-title
kiruxaspb Oct 28, 2024
d3b8ff1
hide UserWarnings at the logs processing
kiruxaspb Oct 29, 2024
724c547
Merge pull request #522 from singnet/fix-process-receipt-warnings
kiruxaspb Oct 29, 2024
788cc2f
Partially fixed bug with "snet service validate-metadata" command.
Arondondon Oct 29, 2024
9a7feba
Added requirements.txt for generating docs. Changed README.md.
Arondondon Oct 29, 2024
5a42033
Completely fixed "service validate-metadata" command.
Arondondon Oct 31, 2024
b42a6ea
Removed "default_gas_price" option from "set" and "unset" commands. A…
Arondondon Nov 1, 2024
9b1567e
Added backward compatibility
kiruxaspb Nov 8, 2024
0b6027e
Merge pull request #524 from singnet/hot-fix-backward-compatibility-w…
kiruxaspb Nov 8, 2024
489854b
Delete blockchain directory
kiruxaspb Nov 8, 2024
9f27c41
Merge pull request #517 from singnet/predev-channels-caching
kiruxaspb Nov 11, 2024
93f2865
Merge pull request #525 from singnet/remove-deprecated-npm
kiruxaspb Nov 11, 2024
97ad6ca
Added "organization validate-metadata" command. Changed and extended …
Arondondon Nov 12, 2024
d352bba
Small fix for org metadata validation.
Arondondon Nov 12, 2024
39f618d
Removed unnecessary methods.
Arondondon Nov 12, 2024
ec99dde
Fixed libraries conflicts
Arondondon Nov 12, 2024
dd2faaf
Merge pull request #527 from singnet/validate-org-metadata
kiruxaspb Nov 13, 2024
c33c698
Update version to 2.3.0
kiruxaspb Nov 13, 2024
059ef30
Merge pull request #528 from singnet/upgrade-version
kiruxaspb Nov 13, 2024
fec3ba9
Fixed error in "organization update-metadata" and "organization creat…
Arondondon Nov 13, 2024
3b9b34b
Fixed org metadata validation
Arondondon Nov 13, 2024
10d2d7e
Fixed a bug when displaying errors while checking the organization me…
Arondondon Nov 13, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ snet.cli.egg-info/
snet/cli/resources/node_modules
snet/cli/resources/proto/*.py
build/
*.rst
dist/
*.pyi
33 changes: 25 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SingularityNET CLI
# SingularityNET CLI

## Package

Expand Down Expand Up @@ -127,28 +127,45 @@ Backward compatibility for other Python versions is not guaranteed.
$ git clone https://github.com/singnet/snet-cli.git
$ cd snet-cli/packages/snet_cli
```

*

* Install the package in development/editable mode

```bash
$ pip3 install -e .
```

#### Building the Documentation
### Building the Documentation in Markdown files

* Clone repository and install dependencies

* Install sphinx, sphinx-argparse and the rtd theme
```bash
$ pip install sphinx
$ pip install sphinx-argparse
$ pip install sphinx-rtd-theme
```
$ git clone https://github.com/singnet/snet-cli.git
$ cd snet-cli
$ pip install -r docs/requirements.txt
```

#### On Linux

* Run the build-docs.sh in the docs directory

```bash
$ cd docs
$ sh build-docs.sh
```

The documentation is generated under the docs/build/html folder
#### On Windows

* Install `make` utility and run the build-docs.ps1 in the docs directory

```powershell
choco install make # install choco if it is not already installed
cd docs
powershell -file build-docs.ps1
```

The documentation is generated under the docs/build/markdown folder

### Release

Expand Down
34 changes: 0 additions & 34 deletions blockchain/package-lock.json

This file was deleted.

6 changes: 0 additions & 6 deletions blockchain/package.json

This file was deleted.

12 changes: 12 additions & 0 deletions docs/build-docs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cd source
python generate_rst.py
cd ..

make clean
make html
Copy-Item source/snet-cli-static/theme.css build/html/_static/css/

cd source
python generate_markdown.py ../build/html/ ../build/html/clean ../build/markdown
cd ..
Remove-Item -Path build/html/clean -Recurse
9 changes: 7 additions & 2 deletions docs/build-docs.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
cd source
python generate_rst.py

cd ..

make clean
make html
cp source/snet-cli-static/theme.css build/html/_static/css/
cp source/snet-cli-static/theme.css build/html/_static/css/

cd source
python generate_markdown.py ../build/html/ ../build/html/clean ../build/markdown
cd ..
rm -rf build/html/clean
5 changes: 5 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Sphinx~=8.1.3
sphinx-argparse~=0.5.2
sphinx-rtd-theme~=3.0.1
bs4~=0.0.2
html2text~=2024.2.26
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down Expand Up @@ -189,4 +189,4 @@
# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
# intersphinx_mapping = {'https://docs.python.org/': None}
150 changes: 150 additions & 0 deletions docs/source/generate_markdown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import os
import sys
import re
from bs4 import BeautifulSoup


def process_html_file(file_path, output_dir, markdown_dir):
with open(file_path, 'r', encoding='utf-8') as file:
html_content = file.read()

soup = BeautifulSoup(html_content, 'html.parser')

footers = soup.find_all('footer')
for footer in footers:
footer.decompose()

navigations = soup.find_all('nav')
for navigation in navigations:
navigation.decompose()

hr = soup.find('hr')
if hr:
hr.decompose()

ul = soup.find('ul', class_='wy-breadcrumbs')
if ul:
ul.decompose()

headerlinks = soup.find_all('a', class_='headerlink')
for headerlink in headerlinks:
headerlink.decompose()

code_blocks = soup.find_all('div', class_='highlight-default notranslate')
for block in code_blocks:
pre_tag = soup.new_tag("p")
pre_tag.append("start ")
pre_tag.append(block.get_text().strip())
pre_tag.append(" finish")
block.replace_with(pre_tag)

clean_html = str(soup)

base_filename = os.path.basename(file_path)
output_path = os.path.join(output_dir, base_filename)

with open(output_path, 'w', encoding='utf-8') as file:
file.write(clean_html)
print(f"Processed: {file_path} -> {output_path}")

clean_filename = os.path.splitext(base_filename)[0] + ".md"
md_output_path = os.path.join(markdown_dir, clean_filename)

os.system(f"html2text --ignore-images {output_path} > {md_output_path}")

if sys.platform.startswith('win'):
with open(md_output_path, 'r') as file:
md_content = file.read()
else:
with open(md_output_path, 'r', encoding='utf-8') as file:
md_content = file.read()

clean_md = format_code_elements(md_content)
clean_md = clean_md.replace("\n### ", "\n## ")
clean_md = clean_md.replace("<", "\<") # fix tags errors
clean_md = clean_md.replace(">", "\>") # fix tags errors
clean_md = clean_md.replace("````", "```")
clean_md = delete_beginning(clean_md)

with open(md_output_path, 'w', encoding='utf-8') as file:
file.write(clean_md)

print(f"Processed: {output_path} -> {md_output_path}\n")


def format_code_elements(text: str):
substrings = []
start_index = 0
while True:
start_index = text.find("start", start_index)
if start_index == -1:
break

end_index = text.find("finish", start_index + 5)
if end_index == -1:
break

substrings.append(text[start_index + 5:end_index])
start_index = end_index + 6

results = []
for code in substrings:
res = re.sub(r'\s+', ' ', code).strip()

res_split = list(res.split())
length = len(res_split[0]) + len(res_split[1]) + len(res_split[2]) + 3
ind = ' ' * length
res = res.replace('] [', ']\n' + ind + '[')

results.append(res)

for i in range(len(results)):
text = text.replace("start" + substrings[i] + "finish", "```sh\n" + results[i] + "\n```")

return text


def delete_beginning(text: str):
start_index = text.find("## Commands")
end_index = text.find("## Sub-commands")
if start_index == -1 or end_index == -1:
return text

return text.replace(text[start_index + 11:end_index + 15], "")


def process_html_files_in_directory(directory, output_dir, markdown_dir):
if not os.path.exists(output_dir):
os.makedirs(output_dir)

if not os.path.exists(markdown_dir):
os.makedirs(markdown_dir)

for file in os.listdir(directory):
if file.endswith('.html'):
file_path = os.path.join(directory, file)
process_html_file(file_path, output_dir, markdown_dir)


def main():
if len(sys.argv) == 4:
input_html_directory: str = sys.argv[1]
output_html_directory: str = sys.argv[2]
output_md_directory: str = sys.argv[3]
else:
raise Exception("""
You can only pass 3 parameters:
- input_html_directory
- output_html_directory
- output_md_directory
""")

process_html_files_in_directory(
input_html_directory,
output_html_directory,
output_md_directory
)


if __name__ == "__main__":
main()
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ mnemonic==0.20
pycoin==0.92.20230326
pyyaml==6.0.1
ipfshttpclient==0.4.13.2
rfc3986==2.0.0
pymultihash==0.8.2
base58==2.1.1
argcomplete==3.1.2
Expand Down
Loading
Loading