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

icons: added and other enhancements #29

Merged
merged 15 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 30 additions & 3 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Add 'label1' to any changes within 'example' folder or any subfolders
docs:
documentation:
- changed-files:
- any-glob-to-any-file: docs/**

deps:
project-config:
- changed-files:
- any-glob-to-any-file: pyproject.toml

Expand All @@ -15,10 +15,37 @@ github-actions:
- changed-files:
- any-glob-to-any-file: .github/**

core:
enhancement:
- changed-files:
- any-glob-to-any-file: src/**

# Add 'feature' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name
feature:
- head-branch: ['^feature', 'feature']

fix:
- head-branch: ['^fix', 'fix']

release:
- changed-files:
- any-glob-to-any-file: src/hckr/__about__.py

crypto:
- changed-files:
- any-glob-to-any-file: src/hckr/cli/crypto/**

cron:
- changed-files:
- any-glob-to-any-file: src/hckr/cli/cron.py

data:
- changed-files:
- any-glob-to-any-file: src/hckr/cli/data.py

hash:
- changed-files:
- any-glob-to-any-file: src/hckr/cli/hash.py

utils:
- changed-files:
- any-glob-to-any-file: src/hckr/cli/utils/**
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,4 @@ output.txt
# faker outputs
output/
!output/.gitkeep
_build/
1 change: 1 addition & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ python:
install:
- method: pip
path: .
- requirements: docs/requirements.txt
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ env-clean :
env-show :
hatch env show

hatch-docs-deps-sync:
python docs/hatch-env-docs-requirements-sync.py
# this will sync the dependencies automatically
sync :
sync : hatch-docs-deps-sync
hatch run cowsay -t "Syncing Dependencies" && echo "Synced.\n============="

# install cli in local for testing, change code an it will be automatically reflected in UI
Expand Down Expand Up @@ -68,5 +70,5 @@ docs-build:
cd docs/ && make clean && make html && cd ..

docs:
hatch run dev:docs
hatch run docs:docs

39 changes: 39 additions & 0 deletions docs/hatch-env-docs-requirements-sync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import tomli

# this is needed as we want to use hatch.docs env for all doc dependencies
# but readthedocs can't use hatch env and we have to either provide setup.py or requirement.txt
# using this script we are syncing requirements.txt from docs dependencies automatically
# this is build as part of the `make sync` command

def generate_requirements(hatch_env='docs'):
# Path to your pyproject.toml
toml_file_path = 'pyproject.toml'

try:
# Open and read the pyproject.toml file
with open(toml_file_path, 'rb') as toml_file:
toml_data = tomli.load(toml_file)

# Extract dependencies for the specific Hatch environment
dependencies = toml_data.get('tool', {}).get('hatch', {}).get('envs', {}).get(hatch_env, {}).get('dependencies',
[])

# Write dependencies to requirements.txt
if dependencies:
with open('docs/requirements.txt', 'w') as req_file:
for dependency in dependencies:
req_file.write(f"{dependency}\n")
print("requirements.txt generated successfully.")
else:
print("No dependencies found for the specified environment.")

except FileNotFoundError as e:
print("The pyproject.toml file was not found.")
raise e
except Exception as e:
print(f"An error occurred: {e}")
raise e


if __name__ == "__main__":
generate_requirements()
8 changes: 8 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sphinx-autobuild
sphinx
sphinx-docsearch
sphinx-click
shibuya
sphinx-notfound-page
sphinx-copybutton
tomli
2 changes: 2 additions & 0 deletions docs/source/_static/INFO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Logo
* logos are created using template https://app.logomakr.com/2gTgc1
Binary file added docs/source/_static/favicon.ico
Binary file not shown.
Binary file added docs/source/_static/hckr-logo-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/hckr-logo-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 18 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'sphinx_click',
'notfound.extension',
'sphinx_docsearch',
'sphinx_copybutton'
'sphinx_copybutton',
]

docsearch_app_id = "UM5HRVXATR"
Expand All @@ -33,14 +33,30 @@
# html_theme = 'alabaster'
html_theme = 'shibuya'
html_static_path = ['_static']
# favicons
html_favicon = '_static/favicon.ico'

# TODO: enhance it https://shibuya.lepture.com/install/
html_theme_options = {
# "announcement": "The content of the announcement",
"color_mode": "light", # light or dark
"github_url": "https://github.com/pateash/hckr",
"discussion_url": "https://github.com/pateash/hckr/discussions",
"globaltoc_expand_depth": 1,
"nav_links": [
{
"title": "pypi",
"url": "https://pypi.org/project/hckr/",
"external": "true"
},
],
"light_logo": "_static/hckr-logo-black.png",
"dark_logo": "_static/hckr-logo-white.png",
# "accent_color": "red",
"announcement": """<div style="text-align: center;">
<div style="display: inline-block;">
Please support the project by starring it on <a href='https://github.com/pateash/hckr/' target="_blank">Github</a>
</div>
</div>""",
}

html_context = {
Expand Down
24 changes: 15 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,12 @@ dependencies = [
"cron-descriptor",
"rich",
"cryptography",
# docs
"sphinx",
"sphinx-docsearch",
"sphinx-click",
"shibuya",
"sphinx-notfound-page",
"sphinx-copybutton",
"Faker",
"pandas", #To manage data and save in CSV, Excel, and Parquet formats.
"openpyxl", # For handling Excel files with Pandas.
"xlrd",
"pyarrow", # For saving data in Parquet format.
"fastavro" # For handling Avro file format.
"fastavro", # For handling Avro file format.
]

[project.urls]
Expand Down Expand Up @@ -100,13 +93,26 @@ dependencies = [
"coverage[toml]>=6.2",
"pytest",
"pypi-cleanup",
"sphinx-autobuild",
]
[tool.hatch.envs.dev.scripts]
lint = "black --check src/ tests/"
fix = "black -v src/ tests/"
check = "mypy --install-types --non-interactive {args:src/hckr tests}"
cov-xml = "coverage xml"
pypi-clean = "pypi-cleanup -u pateash -p hckr --do-it"


[tool.hatch.envs.docs]
dependencies = [
"sphinx-autobuild",
"sphinx",
"sphinx-docsearch",
"sphinx-click",
"shibuya",
"sphinx-notfound-page",
"sphinx-copybutton",
"tomli"
]
[tool.hatch.envs.docs.scripts]
# --pre-build makes sure we get latest changes even if we modify something in
docs = "sphinx-autobuild -a --port=0 --open-browser docs/source docs/build --watch src/hckr --pre-build 'rm -rf docs/build'"
Loading