From b46945b086a74b29b3186f4d289faed96a2f0f8f Mon Sep 17 00:00:00 2001 From: Aareon Sullivan Date: Fri, 20 Sep 2024 21:49:40 -0500 Subject: [PATCH] Update README shields and CI sections --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 1662044..a9c866e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # python-geonames -[![Tests](https://img.shields.io/github/workflow/status/Aareon/python-geonames/tests?label=tests)](https://github.com/Aareon/python-geonames/actions) -[![Mypy](https://img.shields.io/badge/mypy-checked-blue)](https://github.com/Aareon/python-geonames/actions) -[![Coverage](https://img.shields.io/codecov/c/github/Aareon/python-geonames)](https://codecov.io/gh/Aareon/python-geonames) +[![Python tests](https://github.com/Aareon/python-geonames/actions/workflows/python-tests.yml/badge.svg)](https://github.com/Aareon/python-geonames/actions/workflows/python-tests.yml) +[![codecov](https://codecov.io/gh/Aareon/python-geonames/branch/main/graph/badge.svg)](https://codecov.io/gh/Aareon/python-geonames) [![Python Version](https://img.shields.io/pypi/pyversions/python-geonames.svg)](https://pypi.org/project/python-geonames/) [![License](https://img.shields.io/github/license/Aareon/python-geonames.svg)](https://github.com/Aareon/python-geonames/blob/main/LICENSE) @@ -53,12 +52,12 @@ if __name__ == "__main__": ### Custom Configuration -You can customize the configuration by modifying the `Config` object: +You can customize the configuration by modifying the `GeoNamesConfig` object: ```python -from geonames.config import Config +from geonames.config import Config as GeoNamesConfig -config = Config() +config = GeoNamesConfig() config.SAVE_DIR = Path("/custom/path/to/geonames_data") config.DATABASE_URL = "sqlite:///custom_database.db" # Add other configuration options as needed @@ -128,30 +127,48 @@ if __name__ == "__main__": For more detailed usage instructions, please refer to the [documentation](https://github.com/Aareon/python-geonames/wiki). +## Continuous Integration + +This project uses GitHub Actions for continuous integration. The workflow runs tests on Python 3.10 and 3.11, and reports code coverage. + +To set up the GitHub Action: + +1. Copy the contents of the `.github/workflows/python-tests.yml` file from this repository to your own repository. + +2. Ensure your repository has the necessary secrets set up: + - `GITHUB_TOKEN`: This is automatically provided by GitHub Actions. + +3. Make sure your `pyproject.toml` file includes all necessary dependencies, including test and development dependencies. + +4. Sign up for a [Codecov](https://codecov.io/) account and add your repository. + +5. The GitHub Action will now run automatically on every push to the `main` branch and every pull request targeting the `main` branch. + +You can view the status of the tests and coverage in the shields at the top of this README. + ## Development -To set up the development environment: +This project uses Poetry for dependency management. To set up the development environment: -1. Clone the repository: +1. Install Poetry if you haven't already: ```bash - git clone https://github.com/Aareon/python-geonames.git - cd python-geonames + curl -sSL https://install.python-poetry.org | python3 - ``` -2. Create a virtual environment and activate it: +2. Clone the repository: ```bash - python -m venv venv - source venv/bin/activate # On Windows, use \`venv\\Scripts\\activate\` + git clone https://github.com/Aareon/python-geonames.git + cd python-geonames ``` -3. Install the development dependencies: +3. Install the project dependencies: ```bash - pip install -r requirements-dev.txt + poetry install --with test,develop ``` -4. Install the pre-commit hooks: +4. Activate the virtual environment: ```bash - pre-commit install + poetry shell ``` ## Running Tests @@ -176,6 +193,23 @@ To run type checking with mypy: mypy geonames ``` +## Code Formatting + +This project uses `black` for code formatting and `isort` for import sorting. To format your code: + +```bash +black . +isort . +``` + +## Linting + +To run the linter: + +```bash +ruff check . +``` + ## Contributing Contributions are welcome! Please feel free to submit a Pull Request.