ranger / rules
Cursor rule1.1k starsChanged 3 months agoApache-2.0View on GitHub
Apache Ranger Python client and test conventions (apache-ranger on PyPI)
We split this ranger-python.mdc into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 36
Keep changes minimal; follow naming, imports, and spacing of the file you edit.
- Very specific: line 62
Use compact dict literals — one line per top-level field when still readable (sample_pdp_client.py).
- Very specific: line 80
Prefer assertRaises, assertIsNone, assertIsInstance over bare try/except.
- Distinctive: line 83
Only add tests for real coercion, exports, or API wiring.
≈ “Common” is an estimate: at least 1 in 5 of the 6,350 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
description: Apache Ranger Python client and test conventions (apache-ranger on PyPI)
globs: intg/**/*.py,ranger-examples/sample-client/**/*.py
alwaysApply: false
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
# Ranger Python client (`apache-ranger`)
**Authoritative package root:** `intg/src/main/python/` — packaging via `setup.py` there only. Do not add duplicate `setup.py` scripts elsewhere.
**Python version:** `apache-ranger` targets **Python 3.13+** (`python_requires` in `setup.py`).
## Style and structure
- Preserve the ASF license header on new files (match neighboring modules).
- Match existing layout: `apache_ranger/client/` for HTTP clients, `apache_ranger/model/` for typed models, `utils.py` for coercion helpers.
- Reuse `type_coerce` / `type_coerce_attrs()` — accept dict-like input and coerce to model types; do not duplicate parsing logic.
- Keep changes minimal; follow naming, imports, and spacing of the file you edit.
## Vertical alignment
Within a **consecutive block** of related lines, align `=` (and dict values after `:` where keys share one dict):
```python
self.status_code = status_code
self.response = response
self.content = content
from apache_ranger.exceptions import RangerServiceException
from apache_ranger.model.ranger_service import RangerService
RangerAuthzRequest({
"requestId": "req-1",
"user": RangerUserInfo({"name": "alice"}),
"access": RangerAccessInfo({...}),
"context": RangerAccessContext({...}),
})
```
Apply alignment only within the block; do not pad unrelated single assignments. Reference points: `exceptions.py`, `sample_pdp_client.py`, `test_ranger_client.py`.
## Model and sample data
Use **compact dict literals** — one line per top-level field when still readable (`sample_pdp_client.py`). Avoid verbose nesting when a flat line is clear.
## Unit tests
Primary test file: `intg/src/test/python/test_ranger_client.py`
Run from `intg/`:
```bash
PYTHONPATH=src/main/python python -B src/test/python/test_ranger_client.py
```
Split tests **by client** — one `unittest.TestCase` per area (`TestRangerClient`, `TestGDSClient`, `TestPDPClient`).
Fixtures: shared data as **class-level constants** (`URL`, `AUTH`, `AUTHZ_REQUEST`); single-use data inline in the test method.
Assertions and mocking:
- Prefer `assertRaises`, `assertIsNone`, `assertIsInstance` over bare `try/except`.
- Assert **current** client behavior — not obsolete error text or exceptions.
- Mock at the boundary: `Session` for Admin HTTP, `client_http.call_api` for GDS/PDP.
- Only add tests for real coercion, exports, or API wiring.
## References
- `intg/src/main/python/README.md` — published API surface and quickstarts
- `ranger-examples/sample-client/src/main/python/` — Admin, GDS, PDP, KMS usage examples
Trending
Less talk lately.about the whole repository
Who's talking about apache/ranger
- apache/polaris“[FEATURE REQUEST] Develop Apache Ranger Plugin for Polaris to Enhance Access Control for Apache Iceberg”GitHub · Sep 8, 2024 · 12 reactions
- Stack Overflow“How to set up apache ranger on apple macbook pro m1”Stack Overflow · Aug 4, 2022 · 1 votes
- projectdiscovery/nuclei-templates“Added Apache Ranger template”GitHub · Mar 29, 2022 · 1 reactions
- Stack Overflow“java.io.IOException: Timed out waiting for Mini HDFS Cluster to start”Stack Overflow · May 24, 2019 · 1 votes
- kanywst/awesome-authorization“add Apache Ranger under a new Data Platforms subsection”GitHub · Oct 5, 2026
The biggest 5 of 33 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 33
Talked about on GitHub and Stack Overflow (33 times).
On GitHub · 28
- Sep 8, 2024[FEATURE REQUEST] Develop Apache Ranger Plugin for Polaris to Enhance Access Control for Apache Iceberg — apache/polaris12 reactions · 14 comments
- Mar 29, 2022Added Apache Ranger template — projectdiscovery/nuclei-templates1 reaction
- Oct 5, 2026add Apache Ranger under a new Data Platforms subsection — kanywst/awesome-authorization0 reactions · 2 comments
- Sep 6, 2026Integrate iTRS authorization with Apache Ranger PDP — mcc0nnell/baudot0 reactions
- Aug 31, 2026RANGER-5698 : Docker changes for enabling PAM authentication by default — apache/ranger-tools0 reactions · 2 comments
23 more on GitHub
- Aug 13, 2026Where's the actual patch in the release-ranger-2.8.0 git tag? — pl4tyz/CVE-2025-59059-Misattributed-RCE-in-Apache-Ranger-Static-Analysis-Correction0 reactions
- Jun 25, 2026[GHSA-g9gf-g5jq-9h3v] Apache Ranger UI vulnerable to Server Side Request Forgery — github/advisory-database0 reactions · 2 comments
- Apr 29, 2026False negatives on Apache Ranger — EnforceAuth/zift0 reactions · 1 comment
- Apr 29, 2026some false positives on Apache Ranger — EnforceAuth/zift0 reactions · 2 comments
- Apr 17, 2026Bump org.apache.ranger:ranger-intg from 2.4.0 to 2.8.0 — jweicai/gravitino0 reactions
- Apr 16, 2026[Ranger Plugin] fail to read HDFS configurations for HDFS audit logging — trinodb/trino0 reactions · 1 comment
- Mar 14, 2026Bump ranger.version from 2.7.0 to 2.8.0 — spacemonkd/ozone0 reactions · 3 comments
- Feb 28, 2026Bump ranger.version from 2.7.0 to 2.8.0 — apache/ozone0 reactions · 2 comments
- Feb 24, 2026OSV-11253|RANGER-5493: Update tomcat to 9.0.115 — acceldata-io/ranger0 reactions
- Jul 11, 2025RANGER-5227: Add curl to the base image — apache/ranger-tools0 reactions
- Feb 17, 2025Bump ranger.version from 2.4.0 to 2.6.0 — Eng-Anetac/nifi0 reactions
- Jan 27, 2025Bump ranger.version from 2.4.0 to 2.5.0 — Eng-Anetac/nifi0 reactions · 1 comment
- Jan 14, 2025move druid-ranger-security from core to contrib — apache/druid0 reactions · 1 comment
- Feb 20, 2024CVE_Apache Ranger: 3.0.0 — gozan10/cve0 reactions
- Feb 19, 2024CVE_Apache Ranger: 3.0.0 — gozan10/cve0 reactions
- Feb 19, 2024CVE_Apache Ranger: 3.0.0 — gozan10/cve0 reactions
- Feb 19, 2024CVE_Apache Ranger: 3.0.0 — gozan10/cve0 reactions
- Feb 15, 2024CVE_Apache Ranger: 3.0.0 — gozan10/cve0 reactions
- Feb 5, 2024CVE_Apache Ranger: 3.0.0 — gozan10/cve0 reactions
- Jan 4, 2023Build Ranger Admin with trino — aakashnand/trino-ranger-demo0 reactions
- Dec 8, 2022META-3294 Ranger policy update not taking effect even after policy synced in policy cache dir. — atlanhq/ranger-policy0 reactions
- Aug 11, 2022ranger: hardcoded Python path causing issues on RHEL/CentOS 8 — TOSIT-IO/tdp-collection0 reactions
- Dec 2, 2020Consider supporting ranger authorization systems? — oxyno-zeta/s3-proxy0 reactions · 3 comments
On Stack Overflow · 5
- Aug 4, 2022How to set up apache ranger on apple macbook pro m11 vote · 1 answer
- May 24, 2019java.io.IOException: Timed out waiting for Mini HDFS Cluster to start1 vote · 1 answer
- Jul 27, 2023Kafka startup error with Ranger java.lang.NoClassDefFoundError: kafka/security/auth/Authorizer0 votes
- Feb 12, 2021Ranger LDAP Integration User/Group Sync issue0 votes
- Feb 25, 2018set the property value for a single attribute in xml using bash script0 votes · 1 answer
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 3,978 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/ranger-checkstyle.mdcCursor rule
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

