diff --git a/.cargo/config b/.cargo/config
index f54d6312..e8b36b75 100644
--- a/.cargo/config
+++ b/.cargo/config
@@ -1,6 +1,3 @@
-[alias]
-xtask = "run --package xtask --"
-
[target.'cfg(feature = "cargo-clippy")']
rustflags = [
# Lints to enforce in CI
@@ -11,6 +8,7 @@ rustflags = [
"-Dclippy::filter_map_next",
"-Dclippy::flat_map_option",
"-Dclippy::let_unit_value",
+ "-Dclippy::manual_assert",
"-Dclippy::manual_ok_or",
"-Dclippy::todo",
"-Dclippy::unnecessary_wraps",
diff --git a/.netlify/build.sh b/.netlify/build.sh
index 74c8bca1..215ee8c8 100755
--- a/.netlify/build.sh
+++ b/.netlify/build.sh
@@ -53,7 +53,7 @@ mv target/guide netlify_build/main/
## Build public docs
-cargo xtask doc
+nox -s docs
mv target/doc netlify_build/main/doc/
echo "" > netlify_build/main/doc/index.html
@@ -61,7 +61,7 @@ echo "" > netlify_build/main/doc/in
## Build internal docs
echo "
" > netlify_build/banner.html
-RUSTDOCFLAGS="--html-before-content netlify_build/banner.html" cargo xtask doc --internal
+RUSTDOCFLAGS="--html-before-content netlify_build/banner.html" nox -s docs -- nightly internal
rm netlify_build/banner.html
mkdir -p netlify_build/internal
diff --git a/Cargo.toml b/Cargo.toml
index 651d4157..57002434 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -186,7 +186,6 @@ members = [
"pyo3-macros-backend",
"pytests",
"examples",
- "xtask"
]
[package.metadata.docs.rs]
diff --git a/Contributing.md b/Contributing.md
index a1fd31a3..c6d29e2d 100644
--- a/Contributing.md
+++ b/Contributing.md
@@ -51,7 +51,7 @@ There are some specific areas of focus where help is currently needed for the do
You can build the docs (including all features) with
```shell
-cargo xtask doc --open
+nox -s docs -- open
```
#### Doctests
@@ -95,8 +95,10 @@ Tests run with all supported Python versions with the latest stable Rust compile
If you are adding a new feature, you should add it to the `full` feature in our *Cargo.toml** so that it is tested in CI.
You can run these tests yourself with
-```cargo xtask ci```
-See [its documentation](https://github.com/PyO3/pyo3/tree/main/xtask#readme) for more commands you can run.
+```nox```
+and
+```nox -l```
+lists further commands you can run.
### Documenting changes
@@ -145,7 +147,7 @@ You can view what code is and isn't covered by PyO3's tests. We aim to have 100%
- First, generate a `lcov.info` file with
```shell
-cargo xtask coverage
+nox -s coverage
```
You can install an IDE plugin to view the coverage. For example, if you use VSCode:
- Add the [coverage-gutters](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters) plugin.
diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml
deleted file mode 100644
index bdd52175..00000000
--- a/xtask/Cargo.toml
+++ /dev/null
@@ -1,15 +0,0 @@
-[package]
-name = "xtask"
-version = "0.1.0"
-edition = "2018"
-publish = false
-
-[[bin]]
-name = "xtask"
-
-[dependencies]
-anyhow = "1.0.51"
-
-# Clap 3 requires MSRV 1.54
-structopt = { version = "0.3", default-features = false }
-clap = { version = "2" }
diff --git a/xtask/README.md b/xtask/README.md
deleted file mode 100644
index 68d078e5..00000000
--- a/xtask/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-## Commands to test PyO3.
-
-To run these commands, you should be in PyO3's root directory, and run (for example) `cargo xtask ci`.
-
-```
-USAGE:
- xtask.exe
-
-FLAGS:
- -h, --help Prints help information
- -V, --version Prints version information
-
-SUBCOMMANDS:
- ci Runs everything
- clippy Runs `clippy`, denying all warnings
- coverage Runs `cargo llvm-cov` for the PyO3 codebase
- default Only runs the fast things (this is used if no command is specified)
- doc Attempts to render the documentation
- fmt Checks Rust and Python code formatting with `rustfmt` and `black`
- help Prints this message or the help of the given subcommand(s)
- test Runs various variations on `cargo test`
- test-py Runs the tests in examples/ and pytests/
-```
\ No newline at end of file
diff --git a/xtask/src/cli.rs b/xtask/src/cli.rs
deleted file mode 100644
index ec674ec6..00000000
--- a/xtask/src/cli.rs
+++ /dev/null
@@ -1,216 +0,0 @@
-use crate::utils::*;
-use anyhow::{ensure, Result};
-use std::io;
-use std::process::{Command, Output};
-use std::time::Instant;
-use structopt::StructOpt;
-
-pub const MSRV: &str = "1.56";
-
-#[derive(StructOpt)]
-pub enum Subcommand {
- /// Only runs the fast things (this is used if no command is specified)
- Default,
- /// Runs everything
- Ci,
- /// Checks Rust and Python code formatting with `rustfmt` and `black`
- Fmt,
- /// Runs `clippy`, denying all warnings.
- Clippy,
- /// Attempts to render the documentation.
- Doc(DocOpts),
- /// Runs various variations on `cargo test`
- Test,
- /// Runs the tests in examples/ and pytests/
- TestPy,
-}
-
-impl Default for Subcommand {
- fn default() -> Self {
- Self::Default
- }
-}
-
-#[derive(StructOpt)]
-pub struct DocOpts {
- /// Whether to run the docs using nightly rustdoc
- #[structopt(long)]
- pub stable: bool,
- /// Whether to open the docs after rendering.
- #[structopt(long)]
- pub open: bool,
- /// Whether to show the private and hidden API.
- #[structopt(long)]
- pub internal: bool,
-}
-
-impl Default for DocOpts {
- fn default() -> Self {
- Self {
- stable: true,
- open: false,
- internal: false,
- }
- }
-}
-
-impl Subcommand {
- pub fn execute(self) -> Result<()> {
- print_metadata()?;
-
- let start = Instant::now();
-
- match self {
- Subcommand::Default => {
- crate::fmt::rust::run()?;
- crate::clippy::run()?;
- crate::test::run()?;
- crate::doc::run(DocOpts::default())?;
- }
- Subcommand::Ci => {
- let installed = Installed::new()?;
- crate::fmt::rust::run()?;
- if installed.black {
- crate::fmt::python::run()?;
- } else {
- Installed::warn_black()
- };
- crate::clippy::run()?;
- crate::test::run()?;
- crate::doc::run(DocOpts::default())?;
- if installed.nox {
- crate::pytests::run(None)?;
- } else {
- Installed::warn_nox()
- };
- installed.assert()?
- }
-
- Subcommand::Doc(opts) => crate::doc::run(opts)?,
- Subcommand::Fmt => {
- crate::fmt::rust::run()?;
- crate::fmt::python::run()?;
- }
- Subcommand::Clippy => crate::clippy::run()?,
- Subcommand::TestPy => crate::pytests::run(None)?,
- Subcommand::Test => crate::test::run()?,
- };
-
- let dt = start.elapsed().as_secs();
- let minutes = dt / 60;
- let seconds = dt % 60;
- println!("\nxtask finished in {}m {}s.", minutes, seconds);
-
- Ok(())
- }
-}
-
-/// Run a command as a child process, inheriting stdin, stdout and stderr.
-pub fn run(command: &mut Command) -> Result<()> {
- let command_str = format!("{:?}", command);
- let github_actions = std::env::var_os("GITHUB_ACTIONS").is_some();
- if github_actions {
- println!("::group::Running: {}", command_str);
- } else {
- println!("Running: {}", command_str);
- }
-
- let status = command.spawn()?.wait()?;
-
- ensure! {
- status.success(),
- "process did not run successfully ({exit}): {command}",
- exit = match status.code() {
- Some(code) => format!("exit code {}", code),
- None => "terminated by signal".into(),
- },
- command = command_str,
- };
-
- if github_actions {
- println!("::endgroup::")
- }
- Ok(())
-}
-
-/// Like `run`, but does not inherit stdin, stdout and stderr.
-pub fn run_with_output(command: &mut Command) -> Result