Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use Poetry for Package Management (0.12.0 Release) #56

Merged
merged 1 commit into from
Dec 6, 2024
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
21 changes: 17 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,23 @@ jobs:
with:
python-version: '3.10'

- name: Install Dependencies
run: |
pip install --upgrade pip
pip install .[dev]
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: ./.venv
key: venv-${{ runner.os }}-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --with dev

- name: Lint
run: make lint
23 changes: 16 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Release to PyPI

on:
release:
types: [published]
workflow_dispatch:

jobs:
deploy:
Expand All @@ -13,18 +12,28 @@ jobs:
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v3
- name: Set up Python

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
run: poetry install --only main

- name: Build package
run: python -m build
run: poetry build

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,23 @@ jobs:
with:
python-version: '3.10'

- name: Install Dependencies
run: |
pip install --upgrade pip
pip install .[dev]
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: ./.venv
key: venv-${{ runner.os }}-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --with dev

- name: Build Sphinx Documentation
run: |
Expand Down
35 changes: 24 additions & 11 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,30 @@ jobs:
python: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install Dependencies
run: |
pip install --upgrade pip
pip install .[dev]
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Run Unit Tests
run: make test
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: ./.venv
key: venv-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --with dev

- name: Run tests
run: make test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ env/
.\#*
.projectile

.idea/
.idea/

dist/
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

### [0.12.0] - 2024-12-06

### Added
- Use Poetry as the dependency manager
- Relax dependency version constraints

### [0.11.0] - 2024-11-27

### Added
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
.PHONY: format
format:
ruff format .
poetry run ruff format .

.PHONY: lint
lint:
ruff check .
poetry run ruff check .

.PHONY: lint-fix
lint-fix:
ruff check . --fix
poetry run ruff check . --fix

.PHONY: test
test:
pytest
poetry run pytest

.PHONY: e2e
e2e:
python -m tests.e2e
poetry run python -m tests.e2e

.PHONY: repl
repl:
python
poetry run python

.PHONY: install-deps
install-deps:
pip install .[dev]
poetry install

.PHONY: docs
docs:
sphinx-apidoc -f -o docs/ ./cdp/
poetry run sphinx-apidoc -f -o docs/ ./cdp/

.PHONY: local-docs
local-docs: docs
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ one asset into another.
## Requirements

- Python 3.10+
- Poetry for package management and tooling
- [Poetry Installation Instructions](https://python-poetry.org/docs/#installation)

### Checking Python Version

Expand All @@ -34,6 +36,11 @@ For `pip`, refer to the [official pip documentation](https://pip.pypa.io/en/stab
pip install cdp-sdk
```

if you prefer to manage dependencies with Poetry:
```bash
poetry add cdp-sdk
```

### Starting a Python REPL

To start a Python REPL:
Expand Down
2 changes: 1 addition & 1 deletion cdp/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.11.0"
__version__ = "0.12.0"
8 changes: 8 additions & 0 deletions docs/cdp.client.api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ cdp.client.api.onchain\_identity\_api module
:undoc-members:
:show-inheritance:

cdp.client.api.reputation\_api module
-------------------------------------

.. automodule:: cdp.client.api.reputation_api
:members:
:undoc-members:
:show-inheritance:

cdp.client.api.server\_signers\_api module
------------------------------------------

Expand Down
48 changes: 48 additions & 0 deletions docs/cdp.client.models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ cdp.client.models package
Submodules
----------

cdp.client.models.abi module
----------------------------

.. automodule:: cdp.client.models.abi
:members:
:undoc-members:
:show-inheritance:

cdp.client.models.address module
--------------------------------

Expand Down Expand Up @@ -36,6 +44,30 @@ cdp.client.models.address\_list module
:undoc-members:
:show-inheritance:

cdp.client.models.address\_reputation module
--------------------------------------------

.. automodule:: cdp.client.models.address_reputation
:members:
:undoc-members:
:show-inheritance:

cdp.client.models.address\_reputation\_metadata module
------------------------------------------------------

.. automodule:: cdp.client.models.address_reputation_metadata
:members:
:undoc-members:
:show-inheritance:

cdp.client.models.address\_risk module
--------------------------------------

.. automodule:: cdp.client.models.address_risk
:members:
:undoc-members:
:show-inheritance:

cdp.client.models.address\_transaction\_list module
---------------------------------------------------

Expand Down Expand Up @@ -604,6 +636,14 @@ cdp.client.models.smart\_contract module
:undoc-members:
:show-inheritance:

cdp.client.models.smart\_contract\_activity\_event module
---------------------------------------------------------

.. automodule:: cdp.client.models.smart_contract_activity_event
:members:
:undoc-members:
:show-inheritance:

cdp.client.models.smart\_contract\_list module
----------------------------------------------

Expand Down Expand Up @@ -884,6 +924,14 @@ cdp.client.models.webhook\_list module
:undoc-members:
:show-inheritance:

cdp.client.models.webhook\_smart\_contract\_event\_filter module
----------------------------------------------------------------

.. automodule:: cdp.client.models.webhook_smart_contract_event_filter
:members:
:undoc-members:
:show-inheritance:

cdp.client.models.webhook\_wallet\_activity\_filter module
----------------------------------------------------------

Expand Down
40 changes: 40 additions & 0 deletions docs/cdp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ cdp.cdp\_api\_client module
:undoc-members:
:show-inheritance:

cdp.constants module
--------------------

.. automodule:: cdp.constants
:members:
:undoc-members:
:show-inheritance:

cdp.contract\_invocation module
-------------------------------

Expand All @@ -76,6 +84,14 @@ cdp.contract\_invocation module
:undoc-members:
:show-inheritance:

cdp.crypto\_amount module
-------------------------

.. automodule:: cdp.crypto_amount
:members:
:undoc-members:
:show-inheritance:

cdp.errors module
-----------------

Expand All @@ -92,6 +108,30 @@ cdp.faucet\_transaction module
:undoc-members:
:show-inheritance:

cdp.fiat\_amount module
-----------------------

.. automodule:: cdp.fiat_amount
:members:
:undoc-members:
:show-inheritance:

cdp.fund\_operation module
--------------------------

.. automodule:: cdp.fund_operation
:members:
:undoc-members:
:show-inheritance:

cdp.fund\_quote module
----------------------

.. automodule:: cdp.fund_quote
:members:
:undoc-members:
:show-inheritance:

cdp.hash\_utils module
----------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

project = 'CDP SDK'
author = 'Coinbase Developer Platform'
release = '0.11.0'
release = '0.12.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
Loading
Loading