Skip to content
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
80 changes: 80 additions & 0 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on: push

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
# only publish to PyPI on tag pushes
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pyUSPTO
permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/pyUSPTO

permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
attestations: true
skip-existing: true
verbose: true
62 changes: 59 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,16 @@ git checkout -b feature/your-feature-name

```bash
# Run the test suite
pytest
python -m pytest tests/ --cov=pyUSPTO --cov-report=term --cov-report=term-missing -vv

# Run linting and type checking
flake8
mypy pyUSPTO
flake8 src/pyUSPTO --count --select=E9,F63,F7,F82,D100,D101,D102,D103 --show-source --statistics
mypy ./src/

# Correct Formatting
black .


```

### Submit a Pull Request
Expand Down Expand Up @@ -109,6 +114,57 @@ Types include:
4. PRs require approval from at least one maintainer
5. Once approved, a maintainer will merge your PR

## Testing

The library includes unit and integration tests using pytest.

### Running Tests

1. **Run all tests (excluding integration tests)**:

```bash
python -m pytest pyUSPTO/tests/
```

2. **Run tests with verbose output**:

```bash
python -m pytest pyUSPTO/tests/ -v
```

3. **Run specific test files**:

```bash
python -m pytest pyUSPTO/tests/test_base_client.py
python -m pytest pyUSPTO/tests/test_bulk_data.py
python -m pytest pyUSPTO/tests/test_patent_data.py
```

4. **Run specific test classes or methods**:

```bash
python -m pytest pyUSPTO/tests/test_bulk_data.py::TestBulkDataClient
python -m pytest pyUSPTO/tests/test_bulk_data.py::TestBulkDataClient::test_download_file
```

5. **Run integration tests** (these are skipped by default):

```bash
# On Windows
set ENABLE_INTEGRATION_TESTS=true
python -m pytest pyUSPTO/tests/test_integration.py -v

# On Unix/Linux/macOS
ENABLE_INTEGRATION_TESTS=true python -m pytest pyUSPTO/tests/test_integration.py -v
```

6. **Run tests with coverage report**:
```bash
python -m pytest pyUSPTO/tests/ --cov=pyUSPTO
```

The tests are designed to use mocking to avoid making real API calls, making them fast and reliable. The integration tests are optional and will make real API calls to the USPTO API if enabled.

## Versioning

The project uses setuptools-scm for version management:
Expand Down
Loading
Loading