Skip to content

Commit

Permalink
Merge pull request #2 from devxhub/update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
eliyas5044 authored Jul 3, 2024
2 parents c04bb7f + 6b3429f commit b6524b8
Show file tree
Hide file tree
Showing 59 changed files with 5,594 additions and 33 deletions.
170 changes: 170 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Adapted from https://github.com/github/gitignore/blob/main/Python.gitignore

tests/tmp/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# VSCode settings (e.g. .vscode/settings.json containing personal preferred path to venv)
.vscode/

# macOS auto-generated file
.DS_Store
11 changes: 11 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include LICENSE.md
include README.md
include dxh_py/VERSION.txt

exclude Makefile
exclude __main__.py
exclude .*

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-exclude docs *
115 changes: 115 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
PYPI_SERVER = pypitest

define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
from urllib import pathname2url
except:
from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"

.DEFAULT_GOAL := help


.PHONY: clean-tox
clean-tox: ## Remove tox testing artifacts
@echo "+ $@"
@rm -rf .tox/

.PHONY: clean-coverage
clean-coverage: ## Remove coverage reports
@echo "+ $@"
@rm -rf htmlcov/
@rm -rf .coverage
@rm -rf coverage.xml

.PHONY: clean-pytest
clean-pytest: ## Remove pytest cache
@echo "+ $@"
@rm -rf .pytest_cache/

.PHONY: clean-docs-build
clean-docs-build: ## Remove local docs
@echo "+ $@"
@rm -rf docs/_build

.PHONY: clean-build
clean-build: ## Remove build artifacts
@echo "+ $@"
@rm -fr build/
@rm -fr dist/
@rm -fr *.egg-info

.PHONY: clean-pyc
clean-pyc: ## Remove Python file artifacts
@echo "+ $@"
@find . -type d -name '__pycache__' -exec rm -rf {} +
@find . -type f -name '*.py[co]' -exec rm -f {} +
@find . -name '*~' -exec rm -f {} +

.PHONY: clean ## Remove all file artifacts
clean: clean-build clean-pyc clean-tox clean-coverage clean-pytest clean-docs-build

.PHONY: lint
lint: ## Check code style
@echo "+ $@"
@tox -e lint

.PHONY: test
test: ## Run tests quickly with the default Python
@echo "+ $@"
@tox -e py310

.PHONY: test-all
test-all: ## Run tests on every Python version
@echo "+ $@"
@tox

.PHONY: coverage
coverage: ## Check code coverage quickly with the default Python
@echo "+ $@"
@tox -e py310
@$(BROWSER) htmlcov/index.html

.PHONY: docs
docs: ## Generate Sphinx HTML documentation, including API docs
@echo "+ $@"
@tox -e docs
@$(BROWSER) docs/_build/html/index.html

.PHONY: servedocs
servedocs: ## Rebuild docs automatically
@echo "+ $@"
@tox -e servedocs

.PHONY: submodules
submodules: ## Pull and update git submodules recursively
@echo "+ $@"
@git pull --recurse-submodules
@git submodule update --init --recursive

.PHONY: release
release: clean ## Package and upload release
@echo "+ $@"
@python -m build
@twine upload -r $(PYPI_SERVER) dist/*

.PHONY: sdist
sdist: clean ## Build sdist distribution
@echo "+ $@"
@python -m build --sdist
@ls -l dist

.PHONY: wheel
wheel: clean ## Build wheel distribution
@echo "+ $@"
@python -m build --wheel
@ls -l dist

.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-16s\033[0m %s\n", $$1, $$2}'
6 changes: 6 additions & 0 deletions __main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Allow dxh_py to be executable from a checkout or zip file."""

import runpy

if __name__ == "__main__":
runpy.run_module("dxh_py", run_name="__main__")
1 change: 1 addition & 0 deletions docs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Main package for docs."""
51 changes: 51 additions & 0 deletions docs/_templates/package.rst_t
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{%- macro automodule(modname, options) -%}
.. automodule:: {{ modname }}
{%- for option in options %}
:{{ option }}:
{%- endfor %}
{%- endmacro %}
{%- macro toctree(docnames) -%}
.. toctree::
:maxdepth: {{ maxdepth }}
{% for docname in docnames %}
{{ docname }}
{%- endfor %}
{%- endmacro -%}
===
API
===


{%- if modulefirst and not is_namespace %}
{{ automodule(pkgname, automodule_options) }}
{% endif %}

{%- if subpackages %}
Subpackages
-----------

{{ toctree(subpackages) }}
{% endif %}

{%- if submodules %}

This is the dxh_py modules API documentation.

{% if separatemodules %}
{{ toctree(submodules) }}
{% else %}
{%- for submodule in submodules %}
{% if show_headings %}
{{- [submodule, "module"] | join(" ") | e | heading(2) }}
{% endif %}
{{ automodule(submodule, automodule_options) }}
{% endfor %}
{%- endif %}
{%- endif %}

{%- if not modulefirst and not is_namespace %}
Module contents
---------------

{{ automodule(pkgname, automodule_options) }}
{% endif %}
Loading

0 comments on commit b6524b8

Please sign in to comment.