Skip to content

Commit

Permalink
Publish to PyPi
Browse files Browse the repository at this point in the history
  • Loading branch information
misaghsoltani committed Sep 1, 2024
1 parent 034ac2b commit 5b9f73c
Show file tree
Hide file tree
Showing 39 changed files with 1,700 additions and 125 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/python_to_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish Python distribution to PyPI

on: push

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python distribution to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/deepcubeai_2
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.vscode
# data/
saved_env_models/
saved_heur_models/
.DS_Store
job_run_outputs/
._.DS_Store
*.pyc
results/
__pycache__
deepcubeai/environments/sokoban_data/goal_states.pkl
deepcubeai/environments/sokoban_data/goal_states.pkl
dist/
deepcubeai.egg-info/
7 changes: 7 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include README.md
include LICENSE
include deepcubeai/scripts/*.sh
recursive-include deepcubeai/data *
recursive-include deepcubeai/environments/sokoban_data *
recursive-include deepcubeai/environments/puzzlegen/data *
global-exclude *.py[cod] __pycache__ .DS_Store .git .vscode
1,040 changes: 1,022 additions & 18 deletions README.md

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions deepcubeai/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import re
import warnings

__version__ = "0.1.0"
__author__ = "Misagh Soltani"

warnings.filterwarnings(
"ignore",
category=FutureWarning,
message=re.escape("You are using `torch.load` with `weights_only=False` (the current default "
"value), which uses the default pickle module implicitly."))
1 change: 1 addition & 0 deletions deepcubeai/environments/puzzlegen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This folder contains the code for IceSlider and DigitJump, from [puzzlegen](https://github.com/martius-lab/puzzlegen).
Empty file added deepcubeai/extra/__init__.py
Empty file.
17 changes: 17 additions & 0 deletions deepcubeai/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
import subprocess
import sys


def main():
dcai_dir = os.path.dirname(os.path.abspath(__file__))
print(dcai_dir)
parent_dir = os.path.dirname(dcai_dir)

# Forward all arguments to the pipeline script, running from the new directory
pipeline_script = os.path.join(dcai_dir, 'scripts', 'pipeline.sh')
subprocess.run([pipeline_script] + sys.argv[1:], cwd=parent_dir)


if __name__ == "__main__":
main()
6 changes: 3 additions & 3 deletions deepcubeai/plots/cube3_mse_100eps_10000steps_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Arguments being used:
--num_episodes: 100
--num_steps: 10000
--print_interval: 500
--save_dir: /work/msoltani/projects/DeepCubeAI_draft/DeepCubeConstrained_final_0.5
--save_dir: save/dir
--save_pdf: True
--------------------------------------------

Expand Down Expand Up @@ -93,5 +93,5 @@ Q3: 1.087e-01
IQR: 1.514e-02
Range: 1.537e-01

Plot saved to '/work/msoltani/projects/DeepCubeAI_draft/DeepCubeConstrained_final_0.5/plots/cube3_mse_100eps_10000steps_1.pdf'
Information saved to '/work/msoltani/projects/DeepCubeAI_draft/DeepCubeConstrained_final_0.5/plots/cube3_mse_100eps_10000steps_1.txt'
Plot saved to 'save/dir/plots/cube3_mse_100eps_10000steps_1.pdf'
Information saved to 'save/dir/plots/cube3_mse_100eps_10000steps_1.txt'
6 changes: 3 additions & 3 deletions deepcubeai/plots/sokoban_mse_100eps_10000steps_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Arguments being used:
--num_episodes: 100
--num_steps: 10000
--print_interval: 500
--save_dir: /work/msoltani/projects/DeepCubeAI_draft/DeepCubeConstrained_final_0.5
--save_dir: save/dir
--save_pdf: True
--------------------------------------------

Expand Down Expand Up @@ -89,5 +89,5 @@ Q3: 1.015e-09
IQR: 5.487e-10
Range: 7.810e-08

Plot saved to '/work/msoltani/projects/DeepCubeAI_draft/DeepCubeConstrained_final_0.5/plots/sokoban_mse_100eps_10000steps_1.pdf'
Information saved to '/work/msoltani/projects/DeepCubeAI_draft/DeepCubeConstrained_final_0.5/plots/sokoban_mse_100eps_10000steps_1.txt'
Plot saved to 'save/dir/plots/sokoban_mse_100eps_10000steps_1.pdf'
Information saved to 'save/dir/plots/sokoban_mse_100eps_10000steps_1.txt'
Loading

0 comments on commit 5b9f73c

Please sign in to comment.