diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 49a3c3c..e2dece1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,20 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v4.6.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 21.5b1 + rev: 24.4.2 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.812 + rev: v1.10.0 hooks: - id: mypy +- repo: https://github.com/hadialqattan/pycln + rev: v2.4.0 + hooks: + - id: pycln + args: [--config=pyproject.toml] diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..d03a55d --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,8 @@ +- id: pdoc + name: pdoc + description: 'pdoc: Auto-generate API documentation for Python projects' + entry: pdoc + language: python + language_version: python3 + require_serial: true + types: [python] diff --git a/LICENSE b/LICENSE index a37a081..5f37423 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ MIT License Copyright (c) 2021 Qiangqiang Huang +Copyright (c) 2024 Alan Papalia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 5a3664d..4581ac3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Manhattan Simulator -This is a repository for generating random Manhattan-World-style 2D experiments. +This is a repository for generating random Manhattan-World-style 2D experiments. While custom measurements are easy to add, currently supported measurement types include: @@ -19,37 +19,37 @@ you will need to install PyFactorGraph via: ```bash git clone git@github.com:MarineRoboticsGroup/PyFactorGraph.git cd PyFactorGraph -pip install . +pip3 install . ``` ## Contributing -This repo is set up so that contributions will have consistent style and pass -some static type checks. The code styling is enforced through `black`, and helps -to improve the cleanliness, consistency, and readability of commits. +If you want to contribute a new feature to this package please read this brief section. -The static type checking is performed by `mypy` and helps to prevent bugs by -ensuring that object type expectations are being maintained. In addition, it -requires thoughtful type-annotation to improve the readability and -maintainability of the code in the future. +### Code Standards -We run these through both `Github Actions` and the `pre-commit` framework, which -allow us to check our code before committing and then perform some quality tests -on the code once it has been committed. `Github Actions` does not require any -further setup to be used, the tests will be run when the code is pushed. +Any necessary coding standards are enforced through `pre-commit`. This will run +a series of `hooks` when attempting to commit code to this repo. Additionally, +we run a `pre-commit` hook to auto-generate the documentation of this library to +make sure it is always up to date. -The [`pre-commit`](https://pre-commit.com/#intro) framework lets you make sure -the tests will pass before pushing the code. To set it up and use it all you -need to do is run the following commands: +To set up `pre-commit` -``` Bash -# install pre-commit +```bash +cd ~/manhattan-world-sim pip3 install pre-commit -pre-commit install # must run this command in the root of this repo +pre-commit install +``` + +### Testing + +If you want to develop this package and test it from an external package you can +also install via + +```bash +cd ~/manhattan-world-sim +pip3 install -e . ``` -Now, when you try to make a commit, pre-commit will run a series of tests that -must be passed. In the event that the code can be easily changed, mostly in the -case of reformatting, `pre-commit` will often make the change for you. From here -you can just run `git diff` to see the changes made, verify they're correct, add -the changes, and attempt the recommit. +The `-e` flag will make sure that any changes you make here are automatically +translated to the external library you are working in. diff --git a/py.typed b/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c1b8572 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +# Pre-commit hooks related config. +[tool.pycln] +all = true diff --git a/setup.cfg b/setup.cfg index e1196e9..b5d5432 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,3 +22,6 @@ classifiers = [options.packages.find] exclude = examples* + +[options.package_data] +manhattan = py.typed