Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial basic API #2

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8271fa6
Adds submission-core, tests pass 88% coverage
bdc34 Sep 13, 2024
ee806a8
initial openapi.yaml schema
bdc34 Sep 15, 2024
26b7b8e
addes request-toolbelt to pyproject
bdc34 Sep 15, 2024
fd7545f
openapi.yaml validates
bdc34 Sep 15, 2024
cdff56b
Working fastapi with some stubs, passing stub tests, updated README
bdc34 Sep 16, 2024
7c40c4e
Adds a stub legacy implementation
bdc34 Sep 16, 2024
6d750b5
Moves src/arxiv/submit_fastapi to ce_submit/submit_fastapi
bdc34 Sep 17, 2024
5b0b588
Stub tests create legacy sqlite db
bdc34 Sep 17, 2024
158116e
gitignore
bdc34 Sep 17, 2024
fbd6294
Changes to get conftest working
bdc34 Sep 17, 2024
b39fb11
Adding User/Agent to api
bdc34 Sep 17, 2024
b517b0c
WIP db write of start of submission
bdc34 Sep 18, 2024
0e0fd36
WIP db write of start of submission
bdc34 Sep 18, 2024
74a99ae
db write of start of submission
bdc34 Sep 18, 2024
bfc8aa5
Working test: DB write of new sub, and then read
bdc34 Sep 18, 2024
4e9ebc6
Changes api paths
bdc34 Sep 18, 2024
6ec0e01
Removes early version of openapi.yaml
bdc34 Sep 18, 2024
461568f
Adds to new sub
bdc34 Sep 18, 2024
db9ddbc
Basic accept policy and test implemented
bdc34 Sep 18, 2024
bbc2e9e
Basic set license with current accepted licenses
bdc34 Sep 19, 2024
d3cdf6a
Adds python-mutlipart to pyproject
bdc34 Sep 19, 2024
09ad436
moves submit_ce.submit_fastapi to submit_ce.fastapi
bdc34 Sep 19, 2024
fe5a530
basic working file upload of tar.gz
bdc34 Sep 19, 2024
1c80f4c
Working requirements.txt and Dockerfile
bdc34 Sep 20, 2024
adc2921
Adds setCategory
bdc34 Sep 23, 2024
91882a0
Adds a test that runs throug the submit
bdc34 Sep 23, 2024
47275fd
removing some NG code
bdc34 Sep 23, 2024
32a93cc
typo in README.md
bdc34 Sep 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
exclude = .git,__pycache__,__init__.py,.mypy_cache,.pytest_cache,.venv
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down Expand Up @@ -160,3 +160,12 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# morbund NG arxiv code
graveyard/

# dev database
legacy.db

# dev data new
/data
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM python:3.11-bookworm AS builder

ADD https://astral.sh/uv/install.sh /install.sh
RUN chmod -R 655 /install.sh && /install.sh && rm /install.sh
ENV UV=/root/.cargo/bin/uv

WORKDIR /usr/app

RUN $UV venv /venv
ENV PATH="/venv/bin:$PATH"

RUN $UV pip install --upgrade pip
COPY ./requirements.txt .
RUN $UV pip install --no-cache-dir --no-deps -r requirements.txt && \
$UV cache clean


FROM builder AS test
COPY ./requirements-dev.txt .
RUN $UV pip install --no-deps --no-cache-dir -r requirements-dev.txt && \
$UV cache clean
COPY ./tests ./tests
COPY ./submit_ce ./submit_ce
RUN pytest tests


FROM python:3.11.8-bookworm AS service
WORKDIR /usr/app
COPY --from=builder /venv /venv
ENV PATH=/venv/bin:$PATH
COPY ./submit_ce ./submit_ce
COPY ./main.py .
CMD ["uvicorn", "submit_ce.fastapi.app:app", "--host", "0.0.0.0", "--port", "8000"]
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,36 @@
# submit-ce
# submit-ce API
arXiv paper submission system

## Installation & Usage

To run the server, please execute the following from the root directory:

```bash
# setup venv in your preferred way
python --version
# 3.11

pip install --no-deps -r requirements.txt
pip install --no-deps -r requirements-dev.txt

# make sqlite dev db
python tests/make_test_db.py

python main.py
```

and open your browser at `http://localhost:8000/docs/` to see the docs.

## Build Docker Image

```bash
docker build . -t arxiv/submit_ce
```

## Tests

To run the tests:

```bash
pytest tests
```
5 changes: 5 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if __name__ == "__main__":
import uvicorn
uvicorn.run("submit_ce.fastapi.app:app", host="127.0.0.1", port=8000, reload=True)


38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[project]
name = "submit-ce"
version = "0.1.0"
description = "Paper submission system."
readme = "README.md"
requires-python = ">=3.11"
dynamic = ["dependencies", "optional-dependencies"]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
optional-dependencies = {dev = { file = ["requirements-dev.txt"] }}

[tool.black]
line-length = 88
exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
)
'''

[tool.isort]
profile = "black"
skip = [
'.eggs', '.git', '.hg', '.mypy_cache', '.nox', '.pants.d', '.tox',
'.venv', '_build', 'buck-out', 'build', 'dist', 'node_modules', 'venv',
]
skip_gitignore = true
35 changes: 35 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
astroid==1.6.6
attrs==24.2.0
certifi==2024.8.30
charset-normalizer==3.3.2
coverage==7.6.1
coveralls==1.8.0
docker==7.1.0
docopt==0.6.2
idna==3.10
iniconfig==2.0.0
isort==5.13.2
jsonschema==4.23.0
jsonschema-path==0.3.3
jsonschema-specifications==2023.12.1
lazy-object-proxy==1.10.0
mccabe==0.7.0
mimesis==18.0.0
openapi-schema-validator==0.6.2
openapi-spec-validator==0.7.1
packaging==24.1
pathable==0.4.3
pluggy==1.5.0
pydocstyle==3.0.0
pylint==1.9.4
pytest==8.3.3
pytest-cov==5.0.0
pyyaml==6.0.2
referencing==0.35.1
requests==2.32.3
rfc3339-validator==0.1.4
rpds-py==0.20.0
six==1.16.0
snowballstemmer==2.2.0
urllib3==2.2.3
wrapt==1.16.0
65 changes: 65 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
annotated-types==0.7.0
anyio==4.5.0
arxiv-base @ git+https://github.com/arXiv/arxiv-base.git@5200e3d4bec9784b13d77849260f1e11842b977a
attrs==24.2.0
backports-datetime-fromisoformat==2.0.2
certifi==2024.8.30
charset-normalizer==3.3.2
click==8.1.7
decorator==5.1.1
dnspython==2.6.1
email-validator==2.2.0
fastapi==0.114.2
fastapi-cli==0.0.5
fire==0.5.0
greenlet==3.1.0
h11==0.14.0
httpcore==1.0.5
httptools==0.6.1
httpx==0.27.2
idna==3.10
itsdangerous==2.2.0
jinja2==3.1.4
jsonschema==4.23.0
jsonschema-specifications==2023.12.1
markdown-it-py==3.0.0
markupsafe==2.1.5
mdurl==0.1.2
mimesis==18.0.0
mypy==1.11.2
mypy-extensions==1.0.0
orjson==3.10.7
py==1.11.0
pydantic==2.9.2
pydantic-core==2.23.4
pydantic-extra-types==2.9.0
pydantic-settings==2.5.2
pygments==2.18.0
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-multipart==0.0.9
pytz==2018.7
pyyaml==6.0.2
referencing==0.35.1
requests==2.32.3
requests-toolbelt==1.0.0
retry==0.9.2
rich==13.8.1
rpds-py==0.20.0
semver==3.0.2
shellingham==1.5.4
six==1.16.0
sniffio==1.3.1
sqlalchemy==2.0.35
starlette==0.38.5
termcolor==2.4.0
typer==0.12.5
typing-extensions==4.12.2
ujson==5.10.0
unidecode==1.3.8
urllib3==2.2.3
uvicorn==0.30.6
uvloop==0.20.0
validators==0.34.0
watchfiles==0.24.0
websockets==13.0.1
Empty file added submit_ce/__init__.py
Empty file.
Empty file added submit_ce/fastapi/__init__.py
Empty file.
Empty file.
Loading