-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from paudefuente/develop
Release of BETA v0.1.0
- Loading branch information
Showing
6 changed files
with
58 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# research-mind | ||
research-mind is a library with different scripts, utils, services and functions useful when doing research. | ||
|
||
|
||
## Tools Used | ||
|
||
- pipx -> Tool that enables the installation and execution of python applications in isolated environments. | ||
- poetry -> Tool for dependency management and packaging in Python, allowing to to declare the libraries the project depends on and will manage (install / update) them automatically without involving a developer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +0,0 @@ | ||
""" | ||
Functionality created to clean all the files created by the LaTeX compiler. This function is called by the main function | ||
in the main.py file, in which the user can choose to clean the files or not. | ||
|
||
The function will take all the file extensions that defined in .gitignore file and ignored by the git, and will remove them | ||
from the directory. | ||
""" | ||
|
||
import subprocess | ||
import os | ||
import fnmatch | ||
import logging | ||
|
||
# Configure logging | ||
logging.basicConfig(level=logging.INFO) | ||
log = logging.getLogger(__name__) | ||
|
||
|
||
# Constants | ||
GIT_IGNORE_FILE_PATH = "./src/docs/paper/.gitignore" | ||
|
||
|
||
# Functions | ||
def clean_ignored_files(project_path: str, git_ignore_path: str): | ||
""" | ||
This function will remove all the files that are defined in the .gitignore file. | ||
|
||
:param project_path: The path of the project. | ||
:param git_ignore_path: The path of the .gitignore file. | ||
:return: None | ||
""" | ||
|
||
try: | ||
|
||
# Verify that the project path exists | ||
if not os.path.exists(project_path): | ||
raise FileNotFoundError(f"No se encontró el directorio {project_path}") | ||
if not os.path.exists(git_ignore_path): | ||
raise FileNotFoundError(f"No se encontró el archivo .gitignore en {git_ignore_path}") | ||
# Get the patterns that are defined in the .gitignore file | ||
patterns = get_gitignore_patterns(git_ignore_path) | ||
|
||
# Iterate over the folder / files structure and remove the files that match the patterns | ||
for root, dirs, files in os.walk(project_path): | ||
for file in files: | ||
|
||
file_path = os.path.join(root, file) | ||
if any(fnmatch.fnmatch(file_path, os.path.join(project_path, pattern)) for pattern in patterns): | ||
|
||
try: | ||
os.remove(file_path) | ||
print(f"File Deleted: {file_path}") | ||
except Exception as e: | ||
print(f"Not possible to delete the file {file_path}") | ||
print(e) | ||
except subprocess.CalledProcessError as e: | ||
print(e) | ||
except Exception as e: | ||
print("Took place an unexpected error:") | ||
print(e) | ||
print("Took place an unexpected error:") | ||
print(e) | ||
|
||
|
||
def get_gitignore_patterns(gitignore_path: str): | ||
|
||
""" | ||
This function will read the .gitignore file and return the patterns that are defined in the file. | ||
|
||
:param git_repo_path: The path of the git repository. | ||
:return: The patterns that are defined in the .gitignore file. | ||
""" | ||
with open(gitignore_path, "r") as file: | ||
patterns = [line.strip() for line in file if line.strip() and not line.startswith("#")] | ||
return patterns | ||
|
||
|
||
def get_current_directory(): | ||
""" | ||
This function will return the current directory where the script is running. | ||
|
||
:return: The current directory. | ||
""" | ||
return os.path.dirname(os.path.abspath(__file__)) | ||
|
||
|
||
def get_project_path(): | ||
""" | ||
This function will return the path of the project. | ||
|
||
:return: The path of the project. | ||
""" | ||
path = get_current_directory() | ||
return os.path.join(get_current_directory(), "../../") | ||
|
||
|
||
def main(): | ||
""" | ||
Main function which will clean the files that are defined in the .gitignore file | ||
searching in the project path. | ||
""" | ||
print("Cleaning the files that are defined in the .gitignore file.") | ||
clean_ignored_files(get_project_path(), GIT_IGNORE_FILE_PATH) | ||
|
||
|
||
# Execute the main function | ||
if __name__ == "__main__": | ||
main() | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,59 @@ | ||
|
||
[build-system] | ||
requires = [ | ||
"setuptools", | ||
"wheel", | ||
|
||
"setuptools", | ||
"wheel" | ||
] | ||
buiild-backend = "setuptools.build_meta" | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools.build_meta] | ||
requires = ["setuptools"] | ||
[too.setuptools.packages.find] | ||
where = ["core"] | ||
|
||
[project] | ||
name = "Resmind" | ||
name = "resmind" | ||
version = "0.1.0" | ||
descripton = "Resmind is a library developed in response to the necesity of automating a range of processes associated with research across the field of computer science." | ||
authors = [{user = "paudefuente", name = "Pau Fuente", email = "[email protected]"}] | ||
description = "Resmind is a library developed in response to the necessity of automating a range of processes associated with research across the field of computer science." | ||
authors = [ | ||
{ name = "paudefuente - Pau Fuente", email = "[email protected]" } | ||
] | ||
readme = "README.md" | ||
license = "MIT" | ||
required-python = ">=3.11" | ||
license = { file = "LICENSE" } | ||
requires-python = ">=3.11" | ||
dependencies = [ | ||
"asttokens==2.4.1", | ||
"certifi==2024.8.30", | ||
"charset-normalizer==3.4.0", | ||
"colorama==0.4.6", | ||
"comm==0.2.2", | ||
"debugpy==1.8.8", | ||
"decorator==5.1.1", | ||
"executing==2.1.0", | ||
"idna==3.10", | ||
"ipykernel==6.29.5", | ||
"ipython==8.29.0", | ||
"jedi==0.19.2", | ||
"jupyter_client==8.6.3", | ||
"jupyter_core==5.7.2", | ||
"matplotlib-inline==0.1.7", | ||
"nest-asyncio==1.6.0", | ||
"numpy==2.1.3", | ||
"packaging==24.2", | ||
"pandas==2.2.3", | ||
"parso==0.8.4", | ||
"platformdirs==4.3.6", | ||
"prompt_toolkit==3.0.48", | ||
"psutil==6.1.0", | ||
"pure_eval==0.2.3", | ||
"Pygments==2.18.0", | ||
"python-dateutil==2.9.0.post0", | ||
"pytz==2024.2", | ||
"pywin32==308", | ||
"pyzmq==26.2.0", | ||
"requests==2.32.3", | ||
"six==1.16.0", | ||
"stack-data==0.6.3", | ||
"tornado==6.4.1", | ||
"traitlets==5.14.3", | ||
"tzdata==2024.2", | ||
"urllib3==2.2.3", | ||
"wcwidth==0.2.13", | ||
"scholarly", | ||
} | ||
|
||
"certifi==2024.8.30", | ||
"charset-normalizer==3.4.0", | ||
"colorama==0.4.6", | ||
"comm==0.2.2", | ||
"debugpy==1.8.8", | ||
"decorator==5.1.1", | ||
"executing==2.1.0", | ||
"idna==3.10", | ||
"ipykernel==6.29.5", | ||
"ipython==8.29.0", | ||
"jedi==0.19.2", | ||
"jupyter_client==8.6.3", | ||
"jupyter_core==5.7.2", | ||
"matplotlib-inline==0.1.7", | ||
"nest-asyncio==1.6.0", | ||
"numpy==2.1.3", | ||
"packaging==24.2", | ||
"pandas==2.2.3", | ||
"parso==0.8.4", | ||
"platformdirs==4.3.6", | ||
"prompt_toolkit==3.0.48", | ||
"psutil==6.1.0", | ||
"pure_eval==0.2.3", | ||
"Pygments==2.18.0", | ||
"python-dateutil==2.9.0.post0", | ||
"pytz==2024.2", | ||
"pywin32==308", | ||
"pyzmq==26.2.0", | ||
"requests==2.32.3", | ||
"six==1.16.0", | ||
"stack-data==0.6.3", | ||
"tornado==6.4.1", | ||
"traitlets==5.14.3", | ||
"tzdata==2024.2", | ||
"urllib3==2.2.3", | ||
"wcwidth==0.2.13", | ||
"scholarly", | ||
] |