{"id":31642222,"url":"https://github.com/jj-devhub/demopy","last_synced_at":"2025-10-07T03:57:30.694Z","repository":{"id":307667473,"uuid":"1030297302","full_name":"jj-devhub/demopy","owner":"jj-devhub","description":"Showcase Project of Pyo3 bound with auto deployment-release workflow action pipeline ","archived":false,"fork":false,"pushed_at":"2025-09-07T02:01:57.000Z","size":177,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-27T16:07:03.009Z","etag":null,"topics":["actions","demo","demo-app","github-actions","package","pyo3","pyo3-rust-bindings","pypi","pypi-package","python","python3","rust","rust-crate","workflows"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/demopy-gb-jj/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jj-devhub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-01T12:01:59.000Z","updated_at":"2025-09-17T23:02:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"b9430d5e-d641-43b5-9fe1-a8b18e0cb5f0","html_url":"https://github.com/jj-devhub/demopy","commit_stats":null,"previous_names":["jj-devhub/pypi-auto-release-demo"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/jj-devhub/demopy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jj-devhub%2Fdemopy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jj-devhub%2Fdemopy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jj-devhub%2Fdemopy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jj-devhub%2Fdemopy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jj-devhub","download_url":"https://codeload.github.com/jj-devhub/demopy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jj-devhub%2Fdemopy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278717450,"owners_count":26033542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","demo","demo-app","github-actions","package","pyo3","pyo3-rust-bindings","pypi","pypi-package","python","python3","rust","rust-crate","workflows"],"created_at":"2025-10-07T03:57:15.381Z","updated_at":"2025-10-07T03:57:30.687Z","avatar_url":"https://github.com/jj-devhub.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# demopy_gb_jj\n\nA minimal Rust-based Python extension using PyO3 bindings with automated CI/CD\npipeline.\n\n[![CI](https://github.com/jj-devhub/demopy/actions/workflows/ci.yml/badge.svg)](https://github.com/jj-devhub/demopy/actions/workflows/ci.yml)\n[![PyPI version](https://badge.fury.io/py/demopy-gb-jj.svg)](https://badge.fury.io/py/demopy-gb-jj)\n[![Python versions](https://img.shields.io/pypi/pyversions/demopy-gb-jj.svg)](https://pypi.org/project/demopy-gb-jj/)\n\n## Features\n\n- **Rust-Python Integration**: High-performance Rust functions exposed to Python\nvia PyO3\n- **Fallback Support**: Pure Python implementations when Rust extension is\nunavailable\n- **Automated CI/CD**: GitHub Actions workflows for testing, building, and\npublishing\n- **Version Management**: Automated version bumping across all project files\n- **Cross-Platform**: Supports Windows, macOS, and Linux\n- **Multiple Python Versions**: Compatible with Python 3.8-3.13\n\n## Installation\n\n### From PyPI (Recommended)\n\n```bash\npip install demopy_gb_jj\n```text\n\n### From Source\n\n```bash\n# Clone the repository\ngit clone https://github.com/jj-devhub/demopy.git\ncd demopy\n\n# Install Rust (if not already installed)\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n\n# Install Python dependencies\npip install maturin\n\n# Build and install the package\nmaturin develop\n```text\n\n## Usage\n\n```python\nimport demopy\n\n# Basic functions\nprint(demopy.hello())  # \"Hello from demopy_gb_jj (Rust edition)!\"\nprint(demopy.add(2, 3))  # 5\nprint(demopy.multiply(2.5, 4.0))  # 10.0\n\n# List operations\nnumbers = [1, 2, 3, 4, 5]\nprint(demopy.sum_list(numbers))  # 15\n\n# String operations\nprint(demopy.reverse_string(\"Hello, World!\"))  # \"!dlroW ,olleH\"\n\n# Version info\nprint(demopy.__version__)  # Current version\n```text\n\n## Development\n\n### Prerequisites\n\n- Python 3.8 or higher (tested up to 3.13)\n- Rust 1.70 or higher\n- Git\n\n### Setup Development Environment\n\n```bash\n# Clone the repository\ngit clone https://github.com/jj-devhub/demopy.git\ncd demopy\n\n# Create virtual environment\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n\n# Install development dependencies\npip install maturin pytest\n\n# Set up pre-commit hooks for code quality (recommended)\npython scripts/setup_pre_commit.py\n\n# Build the extension in development mode\nmaturin develop\n\n# Run tests\npytest tests/ -v\ncargo test\n```text\n\n### Code Quality\n\nThis project uses automated code quality enforcement through pre-commit hooks:\n\n```bash\n# Set up pre-commit hooks (one-time setup)\npython scripts/setup_pre_commit.py\n\n# Hooks run automatically on git commit\ngit commit -m \"your changes\"  # Hooks auto-format and check code\n```text\n\n**Available quality tools:**\n\n- **Black**: Python code formatting (88-char line length)\n- **isort**: Import statement sorting\n- **flake8**: Python linting and PEP 8 compliance\n- **mypy**: Static type checking (optional)\n- **cargo fmt**: Rust code formatting\n- **cargo clippy**: Rust linting\n\nSee [docs/PRE_COMMIT_HOOKS.md](docs/PRE_COMMIT_HOOKS.md) for detailed information.\n\n### Project Structure\n\n```text\ndemopy/\n├── .github/workflows/     # GitHub Actions CI/CD\n├── docs/                  # Documentation\n├── python/demopy/         # Python package source\n├── src/                   # Rust source code\n├── tests/                 # Test files\n├── scripts/               # Utility scripts\n├── .pre-commit-config.yaml # Pre-commit hooks configuration\n├── Cargo.toml            # Rust package configuration\n├── pyproject.toml        # Python package configuration\n└── README.md\n```text\n\n### Version Management\n\nThis project uses automated version management. To bump the version:\n\n#### Using GitHub Actions (Recommended)\n\n1. Go to the \"Actions\" tab in your GitHub repository\n2. Select \"Version Bump\" workflow\n3. Click \"Run workflow\"\n4. Choose the bump type (patch/minor/major) or specify a custom version\n5. The workflow will automatically:\n   - Update version numbers in all files\n   - Create a commit and tag\n   - Trigger the release workflow\n   - Publish to PyPI\n\n#### Manual Version Bumping\n\n```bash\n# Bump patch version (0.2.5 -\u003e 0.2.6)\npython scripts/bump_version.py patch\n\n# Bump minor version (0.2.5 -\u003e 0.3.0)\npython scripts/bump_version.py minor\n\n# Bump major version (0.2.5 -\u003e 1.0.0)\npython scripts/bump_version.py major\n\n# Set specific version\npython scripts/bump_version.py 1.2.3\n```text\n\n### Testing\n\n```bash\n# Run Python tests\npytest tests/ -v\n\n# Run Rust tests\ncargo test\n\n# Run linting\ncargo fmt --all -- --check\ncargo clippy -- -D warnings\n\n# Test pure Python fallback\npython -c \"\nimport sys\nsys.path.insert(0, 'python')\nimport builtins\noriginal_import = builtins.__import__\ndef mock_import(name, *args, **kwargs):\n    if 'demopy_gb_jj._rust' in name:\n        raise ImportError('Mocked')\n    return original_import(name, *args, **kwargs)\nbuiltins.__import__ = mock_import\nimport demopy\nprint(demopy.hello())\n\"\n```text\n\n### Building and Publishing\n\nThe project uses GitHub Actions for automated building and publishing:\n\n1. **Continuous Integration**: Runs on every push and pull request\n   - Tests across multiple OS and Python versions\n   - Builds the Rust extension\n   - Runs both Rust and Python tests\n\n2. **Release Workflow**: Triggers on version tags\n   - Builds wheels for all platforms\n   - Creates source distribution\n   - Publishes to PyPI\n   - Creates GitHub release with changelog\n\n3. **Version Bump Workflow**: Manual trigger for version management\n   - Updates version across all files\n   - Creates commit and tag\n   - Triggers release workflow\n\n### Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes\n4. Add tests for new functionality\n5. Run the test suite (`pytest tests/ \u0026\u0026 cargo test`)\n6. Commit your changes (`git commit -m 'Add amazing feature'`)\n7. Push to the branch (`git push origin feature/amazing-feature`)\n8. Open a Pull Request\n\n## Architecture\n\n### Rust Extension\n\nThe Rust code in `src/lib.rs` implements high-performance functions using PyO3:\n\n- **hello()**: Returns a greeting message\n- **add(a, b)**: Adds two integers\n- **multiply(a, b)**: Multiplies two floats\n- **sum_list(numbers)**: Sums a list of integers\n- **reverse_string(s)**: Reverses a string\n\n### Python Wrapper\n\nThe Python module in `python/demopy/__init__.py` provides:\n\n- Import handling with fallback to pure Python\n- Consistent API regardless of backend\n- Version information\n- Proper error handling\n\n### Fallback Mechanism\n\nIf the Rust extension fails to load, the package automatically falls back to\npure Python implementations, ensuring the package works even in environments\nwhere the Rust extension cannot be built or loaded.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE)\nfile for details.\n\n## Changelog\n\nSee [Releases](https://github.com/jj-devhub/demopy/releases) for a detailed changelog.\n\nA demo PyPI package for CI/CD publishing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjj-devhub%2Fdemopy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjj-devhub%2Fdemopy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjj-devhub%2Fdemopy/lists"}