Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
fbshipit-source-id: 59000779289d95c93f417045669dd90af8b0f165
  • Loading branch information
facebook-github-bot committed Apr 12, 2023
0 parents commit f044210
Showing 473 changed files with 570,001 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.egg-info
*.pyc
__pycache__
.vscode
*.h5
.nfs*
core
Empty file added CHANGELOG.md
Empty file.
80 changes: 80 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

This Code of Conduct also applies outside the project spaces when there is a
reasonable belief that an individual's behavior may have a negative impact on
the project or its community.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <[email protected]>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Contributing to SiLK
We want to make contributing to this project as easy and transparent as
possible.

## Our Development Process

## Pull Requests
We actively welcome your pull requests.

1. Fork the repo and create your branch from `main`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. If you haven't already, complete the Contributor License Agreement ("CLA").

## Contributor License Agreement ("CLA")
In order to accept your pull request, we need you to submit a CLA. You only need
to do this once to work on any of Meta's open source projects.

Complete your CLA here: <https://code.facebook.com/cla>

## Issues
We use GitHub issues to track public bugs. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue.

## License
By contributing to SiLK, you agree that your contributions will be licensed
under the [LICENSE](LICENSE) file in the root directory of this source tree.
90 changes: 90 additions & 0 deletions DEVELOP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Setup

## First Time Setup

```bash
make conda_env_init
conda activate silk
make dev_install
make conda_update
```

## How to push update/add a PIP dependency

1. Add the new dependency to `requirements.txt` (with version constraint).
1. Run `make dev_install` to re-install the package in dev mode.
1. Run `make conda_export` to update the conda environment (don't forget to commit it).

## How to push update/add a CONDA dependency

1. Run your conda command `conda install ...`.
1. Run `make conda_export` to update the conda environment (don't forget to commit it).

## How to update your existing environment with pulled dependencies ?

```bash
make conda_update
```

# Unit Tests

## How to run all unit tests

```bash
./bin/run_tests
```

## How to add a unit test

1. Add a file named `<module>_test.py` next to the module `<module>.py` that you want to test.
1. Implement the tests in that new file using the [unittest](https://docs.python.org/3/library/unittest.html) module.
1. Run your tests like you would any other python file (`python <path>/<module>_test.py`) to make sure it works well.
1. By adopting this naming convention, this new test file will be executed when running `./bin/run_tests`.

# Linter

Please run `./bin/linter` before committing your code.

# Code Structure

## Library

All common python code will be in `lib/` :
* Models should be in `lib/models`.
* Custom pytorch modules should be in `lib/layers`.
* Custom transforms (non-differentialble) should be in `lib/transforms`.
* Datasets should be in `lib/datasets`.
* Data Classes should be in `lib/data`.
* Serialization/File/Networking should be in `lib/io`.
* Training loop stuff (pytorch lightning) will be in `lib/train`.
* 3D environment specific code should be in `lib/env3d`.
* Visual Query specific code should be in `lib/visual_query`.

## Binaries

When implementing a binary command line, it should be in `bin/`.

Example : We might need to build a simple python tool that extract keypoints from a list of images.
This could become a python script like this `bin/extract_keypoints`, and this script would be using the `silk` library.

# Documentation

## What documentation format should we use ?

We do use [pdoc3](https://pdoc3.github.io/pdoc/) for automatically generating the documentation. `pdoc3` is compatible with several [formats](https://pdoc3.github.io/pdoc/doc/pdoc/#supported-docstring-formats) (markdown, numpydoc, Google-style docstrings, ...).

When commenting our code, we should follow the [numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) format as it is easy to read and fairly exhaustive.

## How to generate the documentation ?

```bash
make doc
```

# VS Code

## When debugging, I cannot get the debugger call stack when `./bin/silk-cli` crashes raising an exception.

That's because `silk-cli` catches all exceptions by default. To avoid that problem, run `silk-cli` with this additional argument : `debug=true`.

Example : `./bin/silk-cli [...] debug=true`
Loading

0 comments on commit f044210

Please sign in to comment.