OceanCrow-AutoPublish 0.6.0
A universal tool to automate Python project installation, testing, building, PyPI upload, version incrementing, and Git push with dependency conflict detection.

# OceanCrow_AutoPublish

A universal Python tool to automate installing, testing, building, uploading to PyPI, version incrementing, and pushing to a Git repository, with dependency conflict detection.

## Features
- Installs your project (`pip install .` or `pip install -e .`).
- Runs tests (`pytest`, `nose`, `unittest`, or custom commands).
- Builds the package (`build`, `poetry`, `flit`, or `hatch`).
- Uploads to PyPI or TestPyPI with `twine`.
- Increments version (major, minor, or patch) in `pyproject.toml` or `setup.py`.
- Commits and pushes to a Git repository.
- Cleans `dist/`, `build/`, and `*.egg-info/` directories.
- Securely manages PyPI credentials with `keyring`.
- Supports interactive mode for guided configuration.
- Verbose logging for detailed debugging.
- Detects dependency conflicts using `pipdeptree`.
- Configuration via `.autopublish.toml`.

## Installation
```bash
pip install OceanCrow_AutoPublish
Prerequisites
A Python project with pyproject.toml or setup.py.
Required dependencies: toml, gitpython, tqdm, keyring, prompt_toolkit, pipdeptree.
Optional dependencies: build, twine, pytest, poetry, flit, nose, hatch.
PyPI credentials (stored in keyring, ~/.pypirc, or environment variables).
A Git repository with a remote (origin).
Usage
cd your-python-project
OceanCrow_AutoPublish
Options:
--skip-tests: Skip running tests.
--dry-run: Simulate the process without executing commands.
--pypi-repo <repo>: Specify PyPI repository (e.g., pypi, testpypi).
--clean: Remove dist/, build/, and *.egg-info/ directories.
--version-type <type>: Version increment type (major, minor, patch).
--verbose: Enable detailed logging.
--interactive: Run in interactive mode with guided prompts.
Configuration
Create a .autopublish.toml in your project directory:
[autopublish]
install_type = "editable" # or "regular"
commit_message = "Release v1.0.0"
max_retries = 3
build_tool = "hatch" # or "build", "poetry", "flit"
test_tool = "pytest" # or "nose", "unittest"
test_command = "tox -e py39" # optional
version_type = "minor" # or "major", "patch"
check_dependencies = true # enable/disable dependency conflict check
Interactive Mode
OceanCrow_AutoPublish --interactive
Guides you through configuration with autocompletion and defaults, including dependency conflict checking.
Example
OceanCrow_AutoPublish --interactive --clean --pypi-repo testpypi --version-type minor --verbose
Dependency Conflict Detection
Checks for dependency conflicts using pipdeptree.
Warns if conflicts are detected, with an option to continue or abort.
Recommends running in a fresh virtual environment if conflicts are found.
Use --verbose to see the full dependency tree.
Credential Management
PyPI credentials are stored securely in keyring. On first use, you’ll be prompted to enter and optionally store your username and token.
Logs
Check OceanCrow_AutoPublish.log for detailed output. Use --verbose for more details.
CI/CD
See CONTRIBUTING.md for a GitHub Actions workflow to automate testing and PyPI publishing.
Contributing
See CONTRIBUTING.md for guidelines.
License
MIT License. See LICENSE for details.