Skip to content

Commit 4bdd190

Browse files
authored
Merge pull request #610 from sanders41/extra-packages
Remove option to add extra dependencies
2 parents b1931b5 + 11bcfb6 commit 4bdd190

File tree

11 files changed

+1
-700
lines changed

11 files changed

+1
-700
lines changed

README.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -199,24 +199,6 @@ python-project create -s
199199
docs are referencing. For example in this repository the repo url would be
200200
`https://github.com/sanders41/python-project-generator`
201201

202-
- Extra Python Dependencies
203-
204-
These are extra packages you want to include in the project that are not provided by default.
205-
For example specifying `fastapi, camel-converter` here will inculde these two packages in the
206-
dependencies. If the project is an application the version will be pinned to the latest release
207-
of the packages, and if it is a library the latest release will be used for the minimum version.
208-
If you would like to specify a specific version instead you can by specifying the version with an
209-
`@`. For example `[email protected], [email protected]`. When creating an appliction FastAPI
210-
will be pinned to `0.115.0` and Camel Converter will be pinned to `4.0.0`, or if creating a
211-
library these versions will be used for the minimum version.
212-
213-
- Extra Python Dev Dependencies
214-
215-
These are extra packages you want to include in the project's dev dependencies that are not
216-
provided by default. For example specifying `pytest-xdist` here will include this package in the
217-
dev dependencies. If you would like to specify a specific version instead of checking for the
218-
latest you can by specifying the version with an `@`. For example `[email protected]`.
219-
220202
After running the generator a new directory will be created with the name you used for the
221203
`Project Slug`. Change to this directory then install the python packages and pre-commit hooks.
222204

src/cli.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,6 @@ pub enum Param {
167167
/// Remove the save download latest packages value
168168
ResetDownloadLatestPackages,
169169

170-
/// Extra Python dependencies to include in the project
171-
ExtraPythonPackages { value: Vec<String> },
172-
173-
/// Remove the saved extra Python dependencies
174-
ResetExtraPythonPackages,
175-
176-
/// Extra Python dev dependencies to include in the project
177-
ExtraPythonDevPackages { value: Vec<String> },
178-
179-
/// Remove the saved extra Python dev dependencies
180-
ResetExtraPythonDevPackages,
181-
182170
/// Rerset the config to the default values
183171
Reset,
184172

src/config.rs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ pub struct Config {
3535
pub use_multi_os_ci: Option<bool>,
3636
pub include_docs: Option<bool>,
3737
pub download_latest_packages: Option<bool>,
38-
pub extra_python_packages: Option<Vec<String>>,
39-
pub extra_python_dev_packages: Option<Vec<String>>,
4038

4139
#[serde(skip)]
4240
config_dir: Rc<Option<PathBuf>>,
@@ -66,8 +64,6 @@ impl Default for Config {
6664
use_multi_os_ci: None,
6765
include_docs: None,
6866
download_latest_packages: None,
69-
extra_python_packages: None,
70-
extra_python_dev_packages: None,
7167
config_dir: config_dir(),
7268
config_file_path: config_file_path(),
7369
}
@@ -101,8 +97,6 @@ impl Config {
10197
use_multi_os_ci: config.use_multi_os_ci,
10298
include_docs: config.include_docs,
10399
download_latest_packages: config.download_latest_packages,
104-
extra_python_packages: config.extra_python_packages,
105-
extra_python_dev_packages: config.extra_python_dev_packages,
106100
config_dir: self.config_dir.clone(),
107101
config_file_path: self.config_file_path.clone(),
108102
};
@@ -362,26 +356,6 @@ impl Config {
362356
Ok(())
363357
}
364358

365-
pub fn save_extra_python_packages(&self, value: Vec<String>) -> Result<()> {
366-
self.handle_save_config(|config| &mut config.extra_python_packages, Some(value))?;
367-
Ok(())
368-
}
369-
370-
pub fn reset_extra_python_packages(&self) -> Result<()> {
371-
self.handle_save_config(|config| &mut config.extra_python_packages, None)?;
372-
Ok(())
373-
}
374-
375-
pub fn save_extra_python_dev_packages(&self, value: Vec<String>) -> Result<()> {
376-
self.handle_save_config(|config| &mut config.extra_python_packages, Some(value))?;
377-
Ok(())
378-
}
379-
380-
pub fn reset_extra_python_dev_packages(&self) -> Result<()> {
381-
self.handle_save_config(|config| &mut config.extra_python_packages, None)?;
382-
Ok(())
383-
}
384-
385359
fn handle_save_config<F, T>(&self, func: F, value: Option<T>) -> Result<()>
386360
where
387361
F: FnOnce(&mut Self) -> &mut Option<T>,
@@ -436,26 +410,6 @@ impl Config {
436410
print_config_value("Use Multi OS CI", &config.use_multi_os_ci);
437411
print_config_value("Include Docs", &config.include_docs);
438412
print_config_value("Download Latest Packages", &config.download_latest_packages);
439-
let extra_python_packages_label = "Extra Python Packages";
440-
if let Some(extra_python_packages) = config.extra_python_packages {
441-
let extra_python_packages_str = extra_python_packages.join(", ");
442-
println!(
443-
"{}: {extra_python_packages_str}",
444-
extra_python_packages_label.blue()
445-
);
446-
} else {
447-
println!("{}: null", extra_python_packages_label.blue());
448-
}
449-
let extra_python_dev_packages_label = "Extra Python Dev Packages";
450-
if let Some(extra_python_dev_packages) = config.extra_python_dev_packages {
451-
let extra_python_dev_packages_str = extra_python_dev_packages.join(", ");
452-
println!(
453-
"{}: {extra_python_dev_packages_str}",
454-
extra_python_dev_packages_label.blue()
455-
);
456-
} else {
457-
println!("{}: null", extra_python_dev_packages_label.blue());
458-
}
459413
}
460414
}
461415

src/github_actions.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,8 +1580,6 @@ mod tests {
15801580
use_multi_os_ci: true,
15811581
include_docs: false,
15821582
docs_info: None,
1583-
extra_python_packages: None,
1584-
extra_python_dev_packages: None,
15851583
download_latest_packages: false,
15861584
project_root_dir: Some(tempdir().unwrap().path().to_path_buf()),
15871585
}

src/licenses.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,6 @@ mod tests {
289289
use_multi_os_ci: true,
290290
include_docs: false,
291291
docs_info: None,
292-
extra_python_packages: None,
293-
extra_python_dev_packages: None,
294292
download_latest_packages: false,
295293
project_root_dir: Some(tempdir().unwrap().path().to_path_buf()),
296294
}

src/main.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -389,30 +389,6 @@ fn main() {
389389
exit(1);
390390
}
391391
}
392-
Param::ExtraPythonPackages { value } => {
393-
if let Err(e) = Config::default().save_extra_python_packages(value) {
394-
print_error(e);
395-
exit(1);
396-
}
397-
}
398-
Param::ResetExtraPythonPackages {} => {
399-
if let Err(e) = Config::default().reset_extra_python_packages() {
400-
print_error(e);
401-
exit(1);
402-
}
403-
}
404-
Param::ExtraPythonDevPackages { value } => {
405-
if let Err(e) = Config::default().save_extra_python_dev_packages(value) {
406-
print_error(e);
407-
exit(1);
408-
}
409-
}
410-
Param::ResetExtraPythonDevPackages {} => {
411-
if let Err(e) = Config::default().reset_extra_python_dev_packages() {
412-
print_error(e);
413-
exit(1);
414-
}
415-
}
416392
Param::Reset => {
417393
if Config::reset().is_err() {
418394
let message = "Error resetting config.";
@@ -468,8 +444,6 @@ mod tests {
468444
use_multi_os_ci: true,
469445
include_docs: false,
470446
docs_info: None,
471-
extra_python_packages: None,
472-
extra_python_dev_packages: None,
473447
download_latest_packages: false,
474448
project_root_dir: Some(base),
475449
};

src/package_version.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -137,27 +137,6 @@ impl PythonPackageVersion {
137137
}
138138
}
139139

140-
#[derive(Debug)]
141-
pub struct ExtraPythonPackageVersion {
142-
pub package: String,
143-
pub version: String,
144-
}
145-
146-
impl ExtraPythonPackageVersion {
147-
pub fn new(package: String) -> Result<Self> {
148-
if let Some(p) = package.split_once("@") {
149-
Ok(ExtraPythonPackageVersion {
150-
package: p.0.to_string(),
151-
version: p.1.to_string(),
152-
})
153-
} else {
154-
let version = get_latest_python_version(&package)?;
155-
156-
Ok(ExtraPythonPackageVersion { package, version })
157-
}
158-
}
159-
}
160-
161140
#[derive(Debug)]
162141
pub struct RustPackageVersion {
163142
pub name: String,

0 commit comments

Comments
 (0)