chore: rename feature to py for consistency

This commit is contained in:
əlemi 2024-09-13 22:21:53 +02:00
parent c0b8906043
commit ac94fb86fd
Signed by: alemi
GPG key ID: A4895B84D311642C
12 changed files with 21 additions and 25 deletions

View file

@ -22,7 +22,7 @@ jobs:
- luajit # should we test with lua54 instead? - luajit # should we test with lua54 instead?
- java - java
- js - js
- python - py
toolchain: toolchain:
- stable - stable
# - beta # - beta

View file

@ -71,13 +71,9 @@ serialize = ["dep:serde", "uuid/serde"]
rust = [] # used for ci matrix rust = [] # used for ci matrix
java = ["lazy_static", "jni", "tracing-subscriber"] java = ["lazy_static", "jni", "tracing-subscriber"]
js = ["napi-build", "tracing-subscriber", "napi", "napi-derive"] js = ["napi-build", "tracing-subscriber", "napi", "napi-derive"]
python = ["pyo3", "tracing-subscriber", "pyo3-build-config"] py = ["pyo3", "tracing-subscriber", "pyo3-build-config"]
lua = ["mlua-codemp-patch", "tracing-subscriber", "lazy_static", "serialize"] lua = ["mlua-codemp-patch", "tracing-subscriber", "lazy_static", "serialize", "mlua-codemp-patch/lua54"]
lua54 = ["lua", "mlua-codemp-patch/lua54"] luajit = ["mlua-codemp-patch", "tracing-subscriber", "lazy_static", "serialize", "mlua-codemp-patch/luajit"]
lua53 = ["lua", "mlua-codemp-patch/lua53"]
lua52 = ["lua", "mlua-codemp-patch/lua52"]
lua51 = ["lua", "mlua-codemp-patch/lua51"]
luajit = ["lua", "mlua-codemp-patch/luajit"]
[package.metadata.docs.rs] # enabled features when building on docs.rs [package.metadata.docs.rs] # enabled features when building on docs.rs

View file

@ -1,7 +1,7 @@
#[cfg(feature = "js")] #[cfg(feature = "js")]
extern crate napi_build; extern crate napi_build;
#[cfg(feature = "python")] #[cfg(feature = "py")]
extern crate pyo3_build_config; extern crate pyo3_build_config;
/// The main method of the buildscript, required by some glue modules. /// The main method of the buildscript, required by some glue modules.
@ -11,7 +11,7 @@ fn main() {
napi_build::setup(); napi_build::setup();
} }
#[cfg(feature = "python")] #[cfg(feature = "py")]
{ {
pyo3_build_config::add_extension_module_link_args(); pyo3_build_config::add_extension_module_link_args();
} }

View file

@ -22,7 +22,7 @@
/// ///
#[derive(Clone, Debug, Default)] #[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "js", napi_derive::napi(object))] #[cfg_attr(feature = "js", napi_derive::napi(object))]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all))] #[cfg_attr(feature = "py", pyo3::pyclass(get_all))]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
pub struct TextChange { pub struct TextChange {
/// Range start of text change, as char indexes in buffer previous state. /// Range start of text change, as char indexes in buffer previous state.
@ -42,7 +42,7 @@ impl TextChange {
} }
} }
#[cfg_attr(feature = "python", pyo3::pymethods)] #[cfg_attr(feature = "py", pyo3::pymethods)]
impl TextChange { impl TextChange {
/// Returns true if this [`TextChange`] deletes existing text. /// Returns true if this [`TextChange`] deletes existing text.
/// ///

View file

@ -11,7 +11,7 @@
/// http{tls?'s':''}://{host}:{port} /// http{tls?'s':''}://{host}:{port}
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[cfg_attr(feature = "js", napi_derive::napi(object))] #[cfg_attr(feature = "js", napi_derive::napi(object))]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all))] #[cfg_attr(feature = "py", pyo3::pyclass(get_all))]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
pub struct Config { pub struct Config {
/// user identifier used to register, possibly your email /// user identifier used to register, possibly your email

View file

@ -1,14 +1,14 @@
//! ### Cursor //! ### Cursor
//! Represents the position of a remote user's cursor. //! Represents the position of a remote user's cursor.
#[cfg(feature = "python")] #[cfg(feature = "py")]
use pyo3::prelude::*; use pyo3::prelude::*;
/// User cursor position in a buffer /// User cursor position in a buffer
#[derive(Clone, Debug, Default)] #[derive(Clone, Debug, Default)]
#[cfg_attr(feature = "python", pyclass)] #[cfg_attr(feature = "py", pyclass)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
// #[cfg_attr(feature = "python", pyo3(crate = "reexported::pyo3"))] // #[cfg_attr(feature = "py", pyo3(crate = "reexported::pyo3"))]
pub struct Cursor { pub struct Cursor {
/// Cursor start position in buffer, as 0-indexed row-column tuple. /// Cursor start position in buffer, as 0-indexed row-column tuple.
pub start: (i32, i32), pub start: (i32, i32),

View file

@ -4,7 +4,7 @@ use codemp_proto::workspace::workspace_event::Event as WorkspaceEventInner;
/// Event in a [crate::Workspace]. /// Event in a [crate::Workspace].
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[cfg_attr(feature = "python", pyo3::pyclass)] #[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
pub enum Event { pub enum Event {
/// Fired when the file tree changes. /// Fired when the file tree changes.

View file

@ -18,7 +18,7 @@ use super::worker::DeltaRequest;
/// Each buffer controller internally tracks the last acknowledged state, remaining always in sync /// Each buffer controller internally tracks the last acknowledged state, remaining always in sync
/// with the server while allowing to procedurally receive changes while still sending new ones. /// with the server while allowing to procedurally receive changes while still sending new ones.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[cfg_attr(feature = "python", pyo3::pyclass)] #[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "js", napi_derive::napi)] #[cfg_attr(feature = "js", napi_derive::napi)]
pub struct BufferController(pub(crate) Arc<BufferControllerInner>); pub struct BufferController(pub(crate) Arc<BufferControllerInner>);

View file

@ -12,7 +12,7 @@ use codemp_proto::{
common::{Empty, Token}, session::{session_client::SessionClient, InviteRequest, WorkspaceRequest}, common::{Empty, Token}, session::{session_client::SessionClient, InviteRequest, WorkspaceRequest},
}; };
#[cfg(feature = "python")] #[cfg(feature = "py")]
use pyo3::prelude::*; use pyo3::prelude::*;
/// A `codemp` client handle. /// A `codemp` client handle.
@ -22,7 +22,7 @@ use pyo3::prelude::*;
/// A new [`Client`] can be obtained with [`Client::connect`]. /// A new [`Client`] can be obtained with [`Client::connect`].
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[cfg_attr(feature = "js", napi_derive::napi)] #[cfg_attr(feature = "js", napi_derive::napi)]
#[cfg_attr(feature = "python", pyclass)] #[cfg_attr(feature = "py", pyclass)]
pub struct Client(Arc<ClientInner>); pub struct Client(Arc<ClientInner>);
#[derive(Debug)] #[derive(Debug)]

View file

@ -12,7 +12,7 @@ use codemp_proto::{cursor::{CursorPosition, RowCol}, files::BufferNode};
/// ///
/// An unique [CursorController] exists for each active [crate::Workspace]. /// An unique [CursorController] exists for each active [crate::Workspace].
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[cfg_attr(feature = "python", pyo3::pyclass)] #[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "js", napi_derive::napi)] #[cfg_attr(feature = "js", napi_derive::napi)]
pub struct CursorController(pub(crate) Arc<CursorControllerInner>); pub struct CursorController(pub(crate) Arc<CursorControllerInner>);

View file

@ -47,5 +47,5 @@ pub mod lua;
pub mod js; pub mod js;
/// python bindings, built with [pyo3] /// python bindings, built with [pyo3]
#[cfg(feature = "python")] #[cfg(feature = "py")]
pub mod python; pub mod python;

View file

@ -33,7 +33,7 @@ use uuid::Uuid;
use napi_derive::napi; use napi_derive::napi;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[cfg_attr(feature = "python", pyo3::pyclass)] #[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "js", napi)] #[cfg_attr(feature = "js", napi)]
pub struct Workspace(Arc<WorkspaceInner>); pub struct Workspace(Arc<WorkspaceInner>);
@ -357,8 +357,8 @@ impl Drop for WorkspaceInner {
} }
} }
#[cfg_attr(feature = "python", pyo3::pyclass(eq, eq_int))] #[cfg_attr(feature = "py", pyo3::pyclass(eq, eq_int))]
#[cfg_attr(feature = "python", derive(PartialEq))] #[cfg_attr(feature = "py", derive(PartialEq))]
pub enum DetachResult { pub enum DetachResult {
NotAttached, NotAttached,
Detaching, Detaching,