Skip to content

Commit e96f866

Browse files
authored
[Feature] [Dubbo-python] Optimize Documents (#44)
* fix: optimize ci * docs: Update some documents * fix: Change package name
1 parent 2210d84 commit e96f866

File tree

6 files changed

+134
-55
lines changed

6 files changed

+134
-55
lines changed

.gitignore

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,66 @@
1-
*.pyc
2-
.idea
3-
*.log
1+
# Compiler
2+
.idea/
3+
.vscode/
4+
5+
# Byte-compiled / optimized / DLL files / logs
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
9+
*.log
10+
11+
12+
# Distribution / packaging
13+
.Python
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
share/python-wheels/
27+
*.egg-info/
28+
.installed.cfg
29+
*.egg
30+
MANIFEST
31+
32+
# Installer logs
33+
pip-log.txt
34+
pip-delete-this-directory.txt
35+
36+
# Unit test / coverage reports
37+
htmlcov/
38+
.tox/
39+
.nox/
40+
.coverage
41+
.coverage.*
42+
.cache
43+
nosetests.xml
44+
coverage.xml
45+
*.cover
46+
*.py,cover
47+
.hypothesis/
48+
.pytest_cache/
49+
cover/
50+
51+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
52+
__pypackages__/
53+
54+
# Environments
55+
.env
56+
.venv
57+
env/
58+
venv/
59+
ENV/
60+
env.bak/
61+
venv.bak/
62+
63+
# mypy
64+
.mypy_cache/
65+
.dmypy.json
66+
dmypy.json

.license-ignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
.asf.yaml
1010
LICENSE
1111
NOTICE
12-
README.md
13-
requirements.txt
1412
requirements-dev.txt
15-
rat-report.txt
1613

1714
# directories
1815
.vscode
@@ -21,5 +18,3 @@ rat-report.txt
2118
.gitignore
2219
.license-ignore
2320
./samples/proto/*
24-
25-

CONTRIBUTING.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,24 @@ git push origin your_awesome_patch
5858

5959
Thanks for contributing!
6060

61+
62+
63+
### Development & Testing
64+
65+
Before you start working on development, please install the necessary dependencies for Dubbo-Python using the following command:
66+
67+
```shell
68+
pip install -r requirements-dev.txt
69+
```
70+
71+
Our project uses a `src` layout, and packaging is required before running tests. We strongly recommend using the **editable installation mode** for packaging and testing:
72+
73+
```shell
74+
pip install -e .
75+
```
76+
77+
78+
6179
### Code style
6280

6381
We use **ruff** as the linter and code formatter for Dubbo-Python, and **Mypy** as the static type checker.
@@ -73,7 +91,7 @@ We have already set up the configurations for ruff and Mypy in the `pyproject.to
7391

7492
By default, ruff will look for the `pyproject.toml` file in the current directory and its parent directories and load its configuration.
7593

76-
```bash
94+
```shell
7795
# Default
7896
ruff format
7997

@@ -83,7 +101,7 @@ We have already set up the configurations for ruff and Mypy in the `pyproject.to
83101

84102
2. Code Linting
85103

86-
```bash
104+
```shell
87105
# Just check
88106
ruff check
89107
@@ -95,7 +113,7 @@ We have already set up the configurations for ruff and Mypy in the `pyproject.to
95113

96114
Mypy will also automatically look for the `pyproject.toml` file and load its configuration.
97115

98-
```bash
116+
```shell
99117
# Default
100118
mypy
101119

README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Apache Dubbo for Python
22

3-
![License](https://img.shields.io/github/license/apache/dubbo-python)
3+
![License](https://img.shields.io/github/license/apache/dubbo-python?logo=apache&logoColor=red&label=LICENSE)
44
![GitHub last commit](https://img.shields.io/github/last-commit/apache/dubbo-python)
55
![GitHub branch check runs](https://img.shields.io/github/check-runs/apache/dubbo-python/main)
6-
7-
---
6+
![PyPI - Version](https://img.shields.io/pypi/v/apache-dubbo?logo=pypi&logoColor=gold&label=PyPI&color=blue)
7+
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/apache-dubbo?logo=python&logoColor=gold&label=Python)
88

99
<p align="center">
1010
<img src="https://cn.dubbo.apache.org/imgs/nav_logo2.png" alt="Logo" width="40%" />
@@ -29,19 +29,22 @@ Visit [the official website](https://dubbo.apache.org/) for more information.
2929
- **Serialization**: Customizable(protobuf, json...)
3030

3131

32-
3332
## Installation
3433

35-
Before you start, make sure you have **`python 3.11+`** installed.
34+
Before you start, make sure you have **`python 3.9+`** installed.
35+
36+
1. Install Directly
3637

37-
1. Install from source
38+
```sh
39+
pip install apache-dubbo
40+
```
41+
2. Install from source
3842

3943
```sh
4044
git clone https://github.com/apache/dubbo-python.git
4145
cd dubbo-python && pip install .
4246
```
4347

44-
4548
## Getting started
4649

4750
Get up and running with Dubbo-Python in just 5 minutes by following our [Quick Start Guide](https://github.com/apache/dubbo-python/tree/main/samples).
@@ -116,7 +119,11 @@ It's as simple as the code snippet below. With just a few lines of code, you can
116119

117120
```
118121

119-
122+
## Contributing
123+
124+
We are excited to welcome contributions to the Dubbo-Python project! Whether you are fixing bugs, adding new features, or improving documentation, your input is highly valued.
125+
126+
To ensure a smooth collaboration, please review our [Contributing Guide](https://github.com/apache/dubbo-python/blob/main/CONTRIBUTING.md) for detailed instructions on how to get started, adhere to coding standards, and submit your contributions effectively.
120127

121128
## License
122129

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ requires = ["hatchling", "hatch-fancy-pypi-readme"]
1919
build-backend = "hatchling.build"
2020

2121
[project]
22-
name="dubbo-python"
22+
name="apache-dubbo"
2323
requires-python = ">=3.9"
2424
authors = [
2525
{name = "Apache Dubbo Community", email = "[email protected]"}
@@ -41,6 +41,8 @@ classifiers=[
4141
"Programming Language :: Python :: 3.9",
4242
"Programming Language :: Python :: 3.10",
4343
"Programming Language :: Python :: 3.11",
44+
"Programming Language :: Python :: 3.12",
45+
"Programming Language :: Python :: 3.13",
4446
"Framework :: AsyncIO",
4547
"Topic :: Internet",
4648
"Topic :: Internet :: WWW/HTTP",

scripts/rat.sh

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,16 @@
1919
### Apache RAT license check script ###
2020
# This script downloads Apache RAT and runs it to check the license headers of the source files.
2121

22-
set -e # Exit immediately if a command exits with a non-zero status.
22+
set -e
2323

24-
# Some variables
2524
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
26-
TEMP_DIR="${ROOT_DIR}/temp"
25+
TMP_DIR="$(mktemp -d)"
26+
2727
RAT_VERSION="0.16.1"
28-
RAT_JAR="${TEMP_DIR}/apache-rat-${RAT_VERSION}.jar"
28+
RAT_JAR="${TMP_DIR}/apache-rat-${RAT_VERSION}.jar"
2929

3030

3131
cd "${ROOT_DIR}"
32-
mkdir -p "${TEMP_DIR}"
3332

3433
# Set Java command
3534
if [ -x "${JAVA_HOME}/bin/java" ]; then
@@ -39,48 +38,43 @@ else
3938
fi
4039

4140

42-
# Download Apache RAT jar file if not exists
43-
if [ ! -f "${RAT_JAR}" ]; then
44-
RAT_URL="https://repo1.maven.org/maven2/org/apache/rat/apache-rat/${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar"
45-
JAR_PART="${RAT_JAR}.part"
46-
47-
echo "Downloading Apache RAT ${RAT_VERSION}..."
41+
# Download Apache RAT jar
42+
echo "Downloading Apache RAT ${RAT_VERSION}..."
4843

49-
if command -v curl &> /dev/null; then
50-
curl -L --silent "${RAT_URL}" -o "${JAR_PART}"
51-
elif command -v wget &> /dev/null; then
52-
wget --quiet "${RAT_URL}" -O "${JAR_PART}"
53-
else
54-
echo "Neither curl nor wget found."
55-
exit 1
56-
fi
44+
RAT_URL="https://repo1.maven.org/maven2/org/apache/rat/apache-rat/${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar"
45+
JAR_PART="${RAT_JAR}.part"
5746

58-
mv "${JAR_PART}" "${RAT_JAR}"
47+
if command -v curl &> /dev/null; then
48+
curl -L --silent "${RAT_URL}" -o "${JAR_PART}" && mv "${JAR_PART}" "${RAT_JAR}"
49+
elif command -v wget &> /dev/null; then
50+
wget --quiet "${RAT_URL}" -O "${JAR_PART}" && mv "${JAR_PART}" "${RAT_JAR}"
51+
else
52+
echo "Neither curl nor wget found."
53+
exit 1
54+
fi
5955

56+
unzip -tq "${RAT_JAR}" > /dev/null
57+
if [ $? -ne 0 ]; then
58+
echo "Downloaded Apache RAT jar is invalid"
59+
exit 1
60+
fi
6061

61-
# TODO: Strange phenomenon:its integrity cannot be verified, but it still works normally. (Ignore the check for now)
62-
# Check if the JAR file is valid
63-
# if ! unzip -tq "${RAT_JAR}" &> /dev/null; then
64-
# rm "${RAT_JAR}"
65-
# echo "Download ${RAT_JAR} failed or the file is not a valid JAR."
66-
# exit 1
67-
# fi
62+
echo "Downloaded Apache RAT ${RAT_VERSION} successfully."
6863

69-
echo "Downloaded Apache RAT ${RAT_VERSION} successfully."
70-
fi
7164

7265
# Run Apache RAT
7366
echo "Running Apache license check, this may take a while..."
67+
${java_cmd} -jar ${RAT_JAR} -d ${ROOT_DIR} -E "${ROOT_DIR}/.license-ignore" > "${TMP_DIR}/rat-report.txt"
7468

75-
"${java_cmd}" -jar "${RAT_JAR}" -E "${ROOT_DIR}/.license-ignore" -d "${ROOT_DIR}" > "${TEMP_DIR}/rat-report.txt"
7669

77-
if grep -q "??" "${TEMP_DIR}/rat-report.txt"; then
70+
# Check the result
71+
if [ $? -ne 0 ]; then
72+
echo "RAT exited abnormally"
73+
exit 1
74+
elif grep -q "??" "${TMP_DIR}/rat-report.txt"; then
7875
echo >&2 "Could not find Apache license headers in the following files:"
79-
grep "??" "${TEMP_DIR}/rat-report.txt" >&2
76+
grep "??" "${TMP_DIR}/rat-report.txt" >&2
8077
exit 1
8178
else
8279
echo "Apache license check passed."
8380
fi
84-
85-
# Clean up
86-
rm -rf "${TEMP_DIR}"

0 commit comments

Comments
 (0)