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?
- java
- js
- python
- py
toolchain:
- stable
# - beta

View file

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

View file

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

View file

@ -22,7 +22,7 @@
///
#[derive(Clone, Debug, Default)]
#[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))]
pub struct TextChange {
/// 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 {
/// Returns true if this [`TextChange`] deletes existing text.
///

View file

@ -11,7 +11,7 @@
/// http{tls?'s':''}://{host}:{port}
#[derive(Clone, Debug)]
#[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))]
pub struct Config {
/// user identifier used to register, possibly your email

View file

@ -1,14 +1,14 @@
//! ### Cursor
//! Represents the position of a remote user's cursor.
#[cfg(feature = "python")]
#[cfg(feature = "py")]
use pyo3::prelude::*;
/// User cursor position in a buffer
#[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 = "python", pyo3(crate = "reexported::pyo3"))]
// #[cfg_attr(feature = "py", pyo3(crate = "reexported::pyo3"))]
pub struct Cursor {
/// Cursor start position in buffer, as 0-indexed row-column tuple.
pub start: (i32, i32),

View file

@ -4,7 +4,7 @@ use codemp_proto::workspace::workspace_event::Event as WorkspaceEventInner;
/// Event in a [crate::Workspace].
#[derive(Debug, Clone)]
#[cfg_attr(feature = "python", pyo3::pyclass)]
#[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
pub enum Event {
/// 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
/// with the server while allowing to procedurally receive changes while still sending new ones.
#[derive(Debug, Clone)]
#[cfg_attr(feature = "python", pyo3::pyclass)]
#[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "js", napi_derive::napi)]
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},
};
#[cfg(feature = "python")]
#[cfg(feature = "py")]
use pyo3::prelude::*;
/// A `codemp` client handle.
@ -22,7 +22,7 @@ use pyo3::prelude::*;
/// A new [`Client`] can be obtained with [`Client::connect`].
#[derive(Debug, Clone)]
#[cfg_attr(feature = "js", napi_derive::napi)]
#[cfg_attr(feature = "python", pyclass)]
#[cfg_attr(feature = "py", pyclass)]
pub struct Client(Arc<ClientInner>);
#[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].
#[derive(Debug, Clone)]
#[cfg_attr(feature = "python", pyo3::pyclass)]
#[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "js", napi_derive::napi)]
pub struct CursorController(pub(crate) Arc<CursorControllerInner>);

View file

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

View file

@ -33,7 +33,7 @@ use uuid::Uuid;
use napi_derive::napi;
#[derive(Debug, Clone)]
#[cfg_attr(feature = "python", pyo3::pyclass)]
#[cfg_attr(feature = "py", pyo3::pyclass)]
#[cfg_attr(feature = "js", napi)]
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 = "python", derive(PartialEq))]
#[cfg_attr(feature = "py", pyo3::pyclass(eq, eq_int))]
#[cfg_attr(feature = "py", derive(PartialEq))]
pub enum DetachResult {
NotAttached,
Detaching,