pybgpkit-parser 0.6.0__tar.gz → 0.6.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,3 +17,5 @@ venv
17
17
  cache
18
18
 
19
19
  .DS_Store
20
+
21
+ .pypirc
@@ -13,7 +13,10 @@
13
13
  3. run [`build.sh`](./build.sh) on Intel Mac
14
14
  4. run [`build.sh`](./build.sh) inside docker on Intel Mac
15
15
 
16
- Then run `twine upload --skip-existing target/wheels/*` at all machines.
16
+ Then run
17
+ ```
18
+ twine upload --skip-existing target/wheels/*
19
+ ```
17
20
 
18
21
  ## Build Linux packages in Docker
19
22
 
@@ -24,9 +27,5 @@ docker build -t bgpkit-builder:latest .
24
27
 
25
28
  Run `docker run --rm -it bgpkit-builder:latest bash` to open a shell in the container
26
29
  ```bash
27
- ####
28
- # TODO: copy the content of .pypirc to the root folder
29
- ####
30
-
31
30
  bash build.sh
32
31
  ```
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## 0.6.2 - 2025-06-06
6
+
7
+ ### Fix regressions
8
+
9
+ * Fix a regression in the `Elem` class that the default string representation was missing
10
+ * Fix a regression that the `Parser` class requires `filters` and `cache_dir` to be passed in the constructor,
11
+ which should be and was optional priority to `v0.6.0`.
12
+
13
+ ## 0.6.1 - 2025-06-06
14
+
15
+ ### Highlights
16
+
17
+ * Update `bgpkit-parser` to v0.11.1, which includes a fix on parsing for `next_hop` for IPv6 peers.
18
+
19
+ ## 0.6.0 - 2025-06-04
20
+
21
+ ### Highlights
22
+
23
+ * Update `bgpkit-parser` to v0.11.0, which includes several bug fixes and performance improvements.
24
+ * Add support for Python 3.13.
25
+
26
+ ### Breaking changes
27
+
28
+ * The `Elem` class's fields can only be access by their getter methods now. Direct access to fields is no longer
29
+ allowed. This change improves encapsulation and ensures that the internal state of `Elem` is managed correctly.
30
+
31
+ ## 0.5.1 - 2024-02-28
32
+
33
+ ### Highlights
34
+
35
+ * update `bgpkit-parser` to v0.10.1, which fixes a performance regression introduced in 0.10.0.
36
+
@@ -134,9 +134,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
134
134
 
135
135
  [[package]]
136
136
  name = "bgpkit-parser"
137
- version = "0.11.0"
137
+ version = "0.11.1"
138
138
  source = "registry+https://github.com/rust-lang/crates.io-index"
139
- checksum = "d6550ea4a70595cb2b2c971581b3f217f27a40774e523552d9c58ebacf103187"
139
+ checksum = "d6990a801ae8907b05f3d03db8d8ffa744825b2496937cf687ac4289e924a4a1"
140
140
  dependencies = [
141
141
  "bitflags",
142
142
  "bytes",
@@ -1121,11 +1121,13 @@ dependencies = [
1121
1121
 
1122
1122
  [[package]]
1123
1123
  name = "pybgpkit-parser"
1124
- version = "0.6.0"
1124
+ version = "0.6.2"
1125
1125
  dependencies = [
1126
1126
  "bgpkit-parser",
1127
1127
  "pyo3",
1128
1128
  "pyo3-build-config",
1129
+ "serde",
1130
+ "serde_json",
1129
1131
  ]
1130
1132
 
1131
1133
  [[package]]
@@ -4,7 +4,7 @@ description = "BGPKIT Parser Python Binding"
4
4
  keywords = ["bgp", "mrt", "parser"]
5
5
  repository = "https://github.com/bgpkit/bgpkit-parser-py"
6
6
  documentation = "https://docs.rs/bgpkit-parser-py"
7
- version = "0.6.0"
7
+ version = "0.6.2"
8
8
  authors = ["Mingwei Zhang <mingwei@bgpkit.com>"]
9
9
  edition = "2021"
10
10
  license = "MIT"
@@ -15,8 +15,10 @@ name = "pybgpkit_parser"
15
15
  crate-type = ["cdylib", "rlib"]
16
16
 
17
17
  [dependencies]
18
- bgpkit-parser = "0.11.0"
18
+ bgpkit-parser = "0.11.1"
19
19
  pyo3 = { version = "0.25", features = ["extension-module"] }
20
+ serde = { version = "1.0", features = ["derive"] }
21
+ serde_json = "1"
20
22
 
21
23
  [build-dependencies]
22
24
  pyo3-build-config = "0.25"
@@ -18,7 +18,7 @@ RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.12 ge
18
18
  RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.13 get-pip.py --break-system-packages && rm get-pip.py
19
19
 
20
20
  # install maturin
21
- RUN python3.13 -m pip install maturin patchelf
21
+ RUN python3.13 -m pip install maturin patchelf twine
22
22
  # install Rust
23
23
  RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
24
24
 
@@ -29,3 +29,5 @@ COPY ./build.sh .
29
29
  COPY ./Cargo.toml .
30
30
  COPY ./README.md .
31
31
  COPY ./pyproject.toml .
32
+
33
+ COPY ./.pypirc /root/.pypirc
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybgpkit-parser
3
- Version: 0.6.0
3
+ Version: 0.6.2
4
4
  Summary: BGPKIT Parser Python Binding
5
5
  Keywords: bgp,mrt,parser
6
6
  Author: Mingwei Zhang <mingwei@bgpkit.com>
@@ -13,8 +13,9 @@ for elem in parser:
13
13
  print(elem.as_path)
14
14
 
15
15
  # Optional fields can be checked for None
16
- print(elem.aggr_ip==None)
16
+ print(elem.aggr_ip is None)
17
17
 
18
18
  # Print the entire parsed BGP update as a dictionary
19
- print(json.dumps(elem.to_dict(), indent=4))
19
+ print(json.dumps(elem.to_dict()))
20
+ print(elem)
20
21
  break
@@ -2,6 +2,7 @@ use bgpkit_parser::models::*;
2
2
  use bgpkit_parser::*;
3
3
  use pyo3::exceptions::PyValueError;
4
4
  use pyo3::prelude::*;
5
+ use serde::Serialize;
5
6
  use std::collections::HashMap;
6
7
  use std::io::Read;
7
8
 
@@ -38,7 +39,7 @@ fn pybgpkit_parser(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
38
39
  }
39
40
 
40
41
  #[pyclass]
41
- #[derive(Clone, PartialEq)]
42
+ #[derive(Clone, PartialEq, Serialize)]
42
43
  pub struct Elem {
43
44
  #[pyo3(get, set)]
44
45
  pub timestamp: f64,
@@ -100,6 +101,11 @@ fn pybgpkit_parser(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
100
101
  fn __getstate__(&self, py: Python) -> PyObject {
101
102
  self.to_dict(py)
102
103
  }
104
+
105
+ #[pyo3(name = "__str__")]
106
+ fn str_repr(&self) -> PyResult<String> {
107
+ Ok(serde_json::to_string(self).unwrap().to_string())
108
+ }
103
109
  }
104
110
 
105
111
  #[pyclass]
@@ -113,7 +119,7 @@ fn pybgpkit_parser(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
113
119
  #[pymethods]
114
120
  impl Parser {
115
121
  #[new]
116
- #[pyo3(text_signature = "(url, filters, /)")]
122
+ #[pyo3(signature = (url, filters=None, cache_dir=None))]
117
123
  fn new(
118
124
  url: String,
119
125
  filters: Option<HashMap<String, String>>,
@@ -1,19 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- ## 0.6.0 - 2025-06-04
6
-
7
- ### Highlights
8
- * Update `bgpkit-parser` to v0.11.0, which includes several bug fixes and performance improvements.
9
- * Add support for Python 3.13.
10
-
11
- ### Breaking changes
12
- * The `Elem` class's fields can only be access by their getter methods now. Direct access to fields is no longer allowed. This change improves encapsulation and ensures that the internal state of `Elem` is managed correctly.
13
-
14
- ## 0.5.1 - 2024-02-28
15
-
16
- ### Highlights
17
-
18
- * update `bgpkit-parser` to v0.10.1, which fixes a performance regression introduced in 0.10.0.
19
-
File without changes