Skip to content
Open
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
39 changes: 19 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
version: 2
version: 2.1

jobs:
build:
docker:
- image: cimg/python:3.10.4
- image: cimg/python:3.10

working_directory: ~/repo

steps:
- checkout

- run:
name: Install uv
command: curl -LsSf https://astral.sh/uv/install.sh | sh

- restore_cache:
keys:
- v1-dependencies-{{ checksum "setup.py" }}
- v1-dependencies-
- v2-uv-deps-{{ checksum "uv.lock" }}
- v2-uv-deps-

- run:
name: install dependencies
name: Install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
make install-dev
export PATH="$HOME/.local/bin:$PATH"
uv sync --group dev

- save_cache:
paths:
- ./venv
- .venv
key: v2-uv-deps-{{ checksum "uv.lock" }}

key: v1-dependencies-{{ checksum "setup.py" }}

- run:
name: run tests
command: |
. venv/bin/activate
pytest tests
- run:
name: run hooks
name: Run tests
command: |
. venv/bin/activate
make hooks
export PATH="$HOME/.local/bin:$PATH"
uv run pytest tests --ignore=tests/contrib/test_postgresql.py --ignore=tests/contrib/test_s3.py

- store_artifacts:
path: test-reports
destination: test-reports
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,6 @@ venv.bak/
.idea/
out/
*.iml

# uv
.venv/
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

54 changes: 15 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,62 +1,38 @@
THRIFT_DIR=./flipper_thrift
THRIFT_PYTHON=${THRIFT_DIR}/python
PKG_VERSION = $(shell python -c "import pkg_resources; print(pkg_resources.require('flipper-client')[0].version)")

.PHONY: install install-dev test lint format clean build publish thrift

install:
python setup.py install

uv sync

install-dev:
pip install -e .[dev]
pre-commit install
pre-commit install-hooks


virtualenv: virtualenv-install


virtualenv-install:
@pyenv virtualenv -p python3.6 3.6.5 flipper-client
uv sync --group dev

test:
uv run pytest tests

thrift:
thrift -r --gen py -out ${THRIFT_PYTHON} ${THRIFT_DIR}/*.thrift
lint:
uv run ruff check .

format:
uv run ruff format .

clean:
@rm -rf build
@rm -rf dist


build: clean
python setup.py sdist bdist_wheel


version:
@echo ${PKG_VERSION}

uv build

publish: build
twine upload dist/*
uv publish

thrift:
thrift -r --gen py -out ${THRIFT_PYTHON} ${THRIFT_DIR}/*.thrift

hooks:
pre-commit run --all-files

uv run pre-commit run --all-files

mypy:
@mypy --follow-imports=silent --ignore-missing-imports flipper


circleci-install:
brew install circleci
circleci setup


validate-circleci:
circleci config validate


exec-circleci: validate-circleci
circleci local execute
uv run mypy --follow-imports=silent --ignore-missing-imports flipper
Empty file removed __init__.py
Empty file.
61 changes: 60 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,56 @@
[project]
name = "flipper-client"
version = "1.3.2"
description = "Flipper is a lightweight, easy to use, and flexible library for feature flags in python"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.10"
classifiers = ["License :: OSI Approved :: Apache Software License"]
dependencies = [
"cachetools>=4.2.1,<6",
"python-consul>=1.0,<2",
"redis>=2.10.6,<5",
"thrift>=0.13,<1",
"boto3>=1.9,<2",
"pyee>=6.0,<7",
]

[project.optional-dependencies]
postgres = ["psycopg>=3.0.10,<4"]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["flipper", "flipper_thrift"]

[tool.hatch.build.targets.sdist]
include = ["flipper", "flipper_thrift"]

[dependency-groups]
dev = [
"six>=1.12",
"fakeredis>=1.0,<2",
"pytest>=7.1",
"ipython",
"thrift",
"ipdb",
"black==22.1.0",
"pre-commit",
"isort",
"flake8",
"mypy",
"moto",
"bandit",
"twine",
"testing.postgresql",
"ruff>=0.6",
]

[tool.black]
line-length = 88
py36 = true
target-version = ["py310"]
include = '\.pyi?$'
exclude = '''
/(
Expand All @@ -16,3 +66,12 @@ exclude = '''
| dist
)/
'''

[tool.ruff]
line-length = 88

[tool.ruff.lint]
select = ["E", "F", "I"]

[tool.pytest.ini_options]
testpaths = ["tests"]
6 changes: 0 additions & 6 deletions setup.cfg

This file was deleted.

44 changes: 0 additions & 44 deletions setup.py

This file was deleted.

Loading